*/
// Application headers.
+#include "mainview.h"
#include "mainwindow.h"
-#include "privacybrowserpcview.h"
#include "privacybrowserdebug.h"
#include "settings.h"
#include <KActionCollection>
#include <KConfigDialog>
-
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();
}
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();
}