X-Git-Url: https://gitweb.stoutner.com/?p=PrivacyBrowserPC.git;a=blobdiff_plain;f=src%2Fmainwindow.cpp;h=9cde452405cdd43ee1a71c2e8843caa66fae56ed;hp=d0c4e1b0062c0d3634e8de66cb17558c415f41d9;hb=153c5c0d60eaf3185cb4419032fb0fdaeb78907c;hpb=ad39882c17bfd7d96cbcfd3873d4dd332722e84f diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index d0c4e1b..9cde452 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -18,8 +18,8 @@ */ // Application headers. +#include "mainview.h" #include "mainwindow.h" -#include "privacybrowserpcview.h" #include "privacybrowserdebug.h" #include "settings.h" @@ -27,32 +27,38 @@ #include #include - MainWindow::MainWindow() : KXmlGuiWindow() { - m_privacybrowserpcView = new PrivacyBrowserPCView(this); - setCentralWidget(m_privacybrowserpcView); + // Instantiate the main view pointer. + mainViewPointer = new MainView(this); - KActionCollection* actionCollection = this->actionCollection(); - m_switchAction = actionCollection->addAction(QStringLiteral("switch_action")); - m_switchAction->setText(i18nc("@action", "Switch Colors")); - m_switchAction->setIcon(QIcon::fromTheme(QStringLiteral("fill-color"))); - connect(m_switchAction, &QAction::triggered, m_privacybrowserpcView, &PrivacyBrowserPCView::switchColors); + // Set the main view as the central widget. + setCentralWidget(mainViewPointer); - KStandardAction::openNew(this, SLOT(fileNew()), actionCollection); - KStandardAction::quit(qApp, SLOT(closeAllWindows()), actionCollection); - KStandardAction::preferences(this, SLOT(settingsConfigure()), actionCollection); + // Get a handle for the action collectoin. + KActionCollection *actionCollectionPointer = this->actionCollection(); - setupGUI(); -} + // Create a switch colorsaction pointer. + QAction *switchColorsActionPointer; -MainWindow::~MainWindow() -{ + // Populate the switch colors action pointer. + switchColorsActionPointer = actionCollectionPointer->addAction(QStringLiteral("switch_action")); + switchColorsActionPointer->setText(i18nc("@action", "Switch Colors")); + switchColorsActionPointer->setIcon(QIcon::fromTheme(QStringLiteral("fill-color"))); + + // Connect the signals to the slots. + connect(switchColorsActionPointer, &QAction::triggered, mainViewPointer, &MainView::switchColors); + + KStandardAction::openNew(this, SLOT(fileNew()), actionCollectionPointer); + KStandardAction::quit(qApp, SLOT(closeAllWindows()), actionCollectionPointer); + KStandardAction::preferences(this, SLOT(settingsConfigure()), actionCollectionPointer); + + setupGUI(); } void MainWindow::fileNew() { - qCDebug(PRIVACYBROWSER) << "PrivacyBrowserPCWindow::fileNew()"; + qCDebug(PRIVACYBROWSER) << "MainWindow::fileNew()"; (new MainWindow)->show(); } @@ -70,9 +76,9 @@ void MainWindow::settingsConfigure() KConfigDialog *dialog = new KConfigDialog(this, QStringLiteral("settings"), Settings::self()); QWidget *generalSettingsPage = new QWidget; - m_settings.setupUi(generalSettingsPage); + settingsWidget.setupUi(generalSettingsPage); dialog->addPage(generalSettingsPage, i18nc("@title:tab", "General"), QStringLiteral("package_setting")); - connect(dialog, &KConfigDialog::settingsChanged, m_privacybrowserpcView, &PrivacyBrowserPCView::handleSettingsChanged); + connect(dialog, &KConfigDialog::settingsChanged, mainViewPointer, &MainView::handleSettingsChanged); dialog->setAttribute(Qt::WA_DeleteOnClose); dialog->show(); }