From: Soren Stoutner Date: Tue, 18 Jan 2022 17:41:59 +0000 (-0700) Subject: Add the icon. X-Git-Tag: v0.1~78 X-Git-Url: https://gitweb.stoutner.com/?p=PrivacyBrowserPC.git;a=commitdiff_plain;h=597b6f74d41343f57e288694ec499e2303022f7e;hp=6b2e1320fae530d918e617bbf2eab7b34e454498 Add the icon. --- diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9c087ba --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +/build +/.kdev4 diff --git a/.kdev4/PrivacyBrowserPC.kdev4 b/.kdev4/PrivacyBrowserPC.kdev4 index 45d4a8d..9426400 100644 --- a/.kdev4/PrivacyBrowserPC.kdev4 +++ b/.kdev4/PrivacyBrowserPC.kdev4 @@ -1,5 +1,5 @@ [Buildset] -BuildItems=@Variant(\x00\x00\x00\t\x00\x00\x00\x00\x01\x00\x00\x00\x0b\x00\x00\x00\x00\x01\x00\x00\x00 \x00P\x00r\x00i\x00v\x00a\x00c\x00y\x00B\x00r\x00o\x00w\x00s\x00e\x00r\x00P\x00C) +BuildItems=@Variant(\x00\x00\x00\t\x00\x00\x00\x00\x01\x00\x00\x00\x0b\x00\x00\x00\x00\x01\x00\x00\x00\x1c\x00P\x00r\x00i\x00v\x00a\x00c\x00y\x00B\x00r\x00o\x00w\x00s\x00e\x00r) [CMake] Build Directory Count=1 @@ -12,5 +12,49 @@ CMake Binary=/usr/bin/cmake CMake Executable=/usr/bin/cmake Environment Profile= Extra Arguments= -Install Directory= +Install Directory=/usr Runtime=Host System + +[CustomDefinesAndIncludes][ProjectPath0] +Path=. +parseAmbiguousAsCPP=true +parserArguments=-ferror-limit=100 -fspell-checking -Wdocumentation -Wunused-parameter -Wunreachable-code -Wall -std=c++17 +parserArgumentsC=-ferror-limit=100 -fspell-checking -Wdocumentation -Wunused-parameter -Wunreachable-code -Wall -std=c99 +parserArgumentsCuda=-ferror-limit=100 -fspell-checking -Wdocumentation -Wunused-parameter -Wunreachable-code -Wall -std=c++11 +parserArgumentsOpenCL=-ferror-limit=100 -fspell-checking -Wdocumentation -Wunused-parameter -Wunreachable-code -Wall -cl-std=CL1.1 + +[CustomDefinesAndIncludes][ProjectPath0][Compiler] +Name=GCC + +[Launch] +Launch Configurations=Launch Configuration 0 + +[Launch][Launch Configuration 0] +Configured Launch Modes=execute +Configured Launchers=nativeAppLauncher +Name=New Compiled Binary Launcher +Type=Native Application + +[Launch][Launch Configuration 0][Data] +Arguments= +Debugger Shell= +Dependencies=@Variant(\x00\x00\x00\t\x00\x00\x00\x00\x00) +Dependency Action=Nothing +Display Demangle Names=true +Display Static Members=false +EnvironmentGroup= +Executable=file:///home/soren/projects/PrivacyBrowserPC/build/bin/privacybrowser +External Terminal=konsole --noclose --workdir %workdir -e %exe +GDB Path= +Kill Before Executing Again=4194304 +Project Target=PrivacyBrowserPC,src,privacybrowserpc +Remote GDB Config Script= +Remote GDB Run Script= +Remote GDB Shell Script= +Start With=ApplicationOutput +Use External Terminal=false +Working Directory= +isExecutable=true + +[Project] +VersionControlSupport=kdevgit diff --git a/CMakeLists.txt b/CMakeLists.txt index 2326479..ca98f35 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,11 +1,29 @@ +# Copyright © 2022 Soren Stoutner . +# +# This file is part of Privacy Browser PC . +# +# Privacy Browser PC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Privacy Browser PC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Privacy Browser PC. If not, see . + cmake_minimum_required(VERSION 3.16) -project(privacybrowserpc) +project(privacybrowser) +# Set the minimum framework versions. set(QT_MIN_VERSION "5.15.0") -set(KF_MIN_VERSION "5.83.0") +set(KDE_FRAMEWORKS_MIN_VERSION "5.83.0") -find_package(ECM ${KF_MIN_VERSION} REQUIRED NO_MODULE) +find_package(ECM ${KDE_FRAMEWORKS_MIN_VERSION} REQUIRED NO_MODULE) set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH}) include(KDEInstallDirs) @@ -18,7 +36,7 @@ include(FeatureSummary) find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS Core Gui Widgets) -find_package(KF5 ${KF_MIN_VERSION} REQUIRED COMPONENTS +find_package(KF5 ${KDE_FRAMEWORKS_MIN_VERSION} REQUIRED COMPONENTS ConfigWidgets CoreAddons Crash @@ -30,7 +48,6 @@ find_package(KF5 ${KF_MIN_VERSION} REQUIRED COMPONENTS add_subdirectory(doc) add_subdirectory(src) -add_subdirectory(icons) # Make it possible to use the po files fetched by the fetch-translations step ki18n_install(po) diff --git a/PrivacyBrowserPC.kdev4 b/PrivacyBrowserPC.kdev4 new file mode 100644 index 0000000..9125910 --- /dev/null +++ b/PrivacyBrowserPC.kdev4 @@ -0,0 +1,3 @@ +[Project] +Manager=KDevCMakeManager +Name=PrivacyBrowser diff --git a/README b/README deleted file mode 100644 index 21a8f91..0000000 --- a/README +++ /dev/null @@ -1,17 +0,0 @@ -How To Build This Template --=-=-=-=-=-=-=-=-=-=-=-=-= - ---- On Unix: - -cd -mkdir build -cd build -cmake -DCMAKE_INSTALL_PREFIX=$KDEDIRS -DCMAKE_BUILD_TYPE=Debug .. -make -make install or su -c 'make install' or sudo make install - -where $KDEDIRS points to your KDE installation prefix. - -Note: you can use another build path. Then cd in your build dir and: -export KDE_SRC=path_to_your_src -cmake $KDE_SRC -DCMAKE_INSTALL_PREFIX=$KDEDIRS -DCMAKE_BUILD_TYPE=Debug diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt index 77c1fb1..ffd9ed3 100644 --- a/doc/CMakeLists.txt +++ b/doc/CMakeLists.txt @@ -1 +1 @@ -kdoctools_create_handbook(index.docbook INSTALL_DESTINATION ${KDE_INSTALL_DOCBUNDLEDIR}/en SUBDIR privacybrowserpc) +kdoctools_create_handbook(index.docbook INSTALL_DESTINATION ${KDE_INSTALL_DOCBUNDLEDIR}/en SUBDIR privacybrowser) diff --git a/icons/16-apps-privacybrowserpc.png b/icons/16-apps-privacybrowserpc.png deleted file mode 100644 index 1d17e6f..0000000 Binary files a/icons/16-apps-privacybrowserpc.png and /dev/null differ diff --git a/icons/22-apps-privacybrowserpc.png b/icons/22-apps-privacybrowserpc.png deleted file mode 100644 index 68d7189..0000000 Binary files a/icons/22-apps-privacybrowserpc.png and /dev/null differ diff --git a/icons/32-apps-privacybrowserpc.png b/icons/32-apps-privacybrowserpc.png deleted file mode 100644 index 3f32111..0000000 Binary files a/icons/32-apps-privacybrowserpc.png and /dev/null differ diff --git a/icons/48-apps-privacybrowserpc.png b/icons/48-apps-privacybrowserpc.png deleted file mode 100644 index 38e246a..0000000 Binary files a/icons/48-apps-privacybrowserpc.png and /dev/null differ diff --git a/icons/CMakeLists.txt b/icons/CMakeLists.txt deleted file mode 100644 index cbea1cb..0000000 --- a/icons/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -set(privacybrowserpc_ICONS - 16-apps-privacybrowserpc.png - 22-apps-privacybrowserpc.png - 32-apps-privacybrowserpc.png - 48-apps-privacybrowserpc.png - sc-apps-privacybrowserpc.svgz -) - -ecm_install_icons(ICONS ${privacybrowserpc_ICONS} DESTINATION ${KDE_INSTALL_ICONDIR} THEME hicolor) diff --git a/icons/sc-apps-privacybrowserpc.svgz b/icons/sc-apps-privacybrowserpc.svgz deleted file mode 100644 index b29c626..0000000 Binary files a/icons/sc-apps-privacybrowserpc.svgz and /dev/null differ diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 75bdc67..077ff05 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,23 +1,41 @@ -add_executable(privacybrowserpc) +# Copyright © 2022 Soren Stoutner . +# +# This file is part of Privacy Browser PC . +# +# Privacy Browser PC is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Privacy Browser PC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Privacy Browser PC. If not, see . -target_sources(privacybrowserpc PRIVATE +# Create the executable and add the resources. +add_executable(privacybrowser resources.qrc) + +target_sources(privacybrowser PRIVATE main.cpp - privacybrowserpcwindow.cpp + mainwindow.cpp privacybrowserpcview.cpp ) -ecm_qt_declare_logging_category(privacybrowserpc +ecm_qt_declare_logging_category(privacybrowser HEADER privacybrowserpcdebug.h - IDENTIFIER PRIVACYBROWSERPC - CATEGORY_NAME "privacybrowserpc" + IDENTIFIER PRIVACYBROWSER + CATEGORY_NAME "privacybrowser" ) -kconfig_add_kcfg_files(privacybrowserpc PrivacyBrowserPCSettings.kcfgc) -ki18n_wrap_ui(privacybrowserpc +kconfig_add_kcfg_files(privacybrowser PrivacyBrowserPCSettings.kcfgc) +ki18n_wrap_ui(privacybrowser privacybrowserpcview.ui settings.ui ) -target_link_libraries(privacybrowserpc +target_link_libraries(privacybrowser KF5::CoreAddons KF5::I18n KF5::XmlGui @@ -27,7 +45,7 @@ target_link_libraries(privacybrowserpc Qt5::Widgets ) -install(TARGETS privacybrowserpc ${KDE_INSTALL_TARGETS_DEFAULT_ARGS}) -install(PROGRAMS org.example.privacybrowserpc.desktop DESTINATION ${KDE_INSTALL_APPDIR}) -install(FILES org.example.privacybrowserpc.appdata.xml DESTINATION ${KDE_INSTALL_METAINFODIR}) -install(FILES privacybrowserpcui.rc DESTINATION ${KDE_INSTALL_KXMLGUI5DIR}/privacybrowserpc) +install(TARGETS privacybrowser ${KDE_INSTALL_TARGETS_DEFAULT_ARGS}) +install(PROGRAMS com.stoutner.privacybrowser DESTINATION ${KDE_INSTALL_APPDIR}) +install(FILES com.stounter.privacybrowser.appdata.xml DESTINATION ${KDE_INSTALL_METAINFODIR}) +install(FILES privacybrowserpcui.rc DESTINATION ${KDE_INSTALL_KXMLGUI5DIR}/privacybrowser) # TODO diff --git a/src/icons/privacy_browser.svg b/src/icons/privacy_browser.svg new file mode 100644 index 0000000..5d39ed4 --- /dev/null +++ b/src/icons/privacy_browser.svg @@ -0,0 +1,105 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + diff --git a/src/main.cpp b/src/main.cpp index 41f54d1..f0ffdec 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,57 +1,91 @@ /* - SPDX-FileCopyrightText: %{CURRENT_YEAR} %{AUTHOR} <%{EMAIL}> + * Copyright © 2022 Soren Stoutner . + * + * This file is part of Privacy Browser PC . + * + * Privacy Browser PC is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Privacy Browser PC is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Privacy Browser PC. If not, see . + */ - SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL -*/ +// Application headers. +#include "mainwindow.h" +#include "privacybrowserpcdebug.h" // TODO. Rename. -// application header -#include "privacybrowserpcwindow.h" -#include "privacybrowserpcdebug.h" - -// KF headers +// KDE Frameworks headers. +#include #include #include -#include -#include +#include // TODO. This may not be needed. -// Qt headers -#include +// Qt headers. +#include // TODO. Probably not needed. Appears to be included in a sub header. #include -#include -#include +#include // TODO. Probably not needed. Appears to be included in a sub header. +#include // Probably not needed at all. - -int main(int argc, char **argv) +int main(int argc, char *argv[]) { + // Create the application. QApplication application(argc, argv); - KLocalizedString::setApplicationDomain("privacybrowserpc"); + // Set the localization application domain. + KLocalizedString::setApplicationDomain("privacybrowser"); + + // Initialize KCrash. KCrash::initialize(); - KAboutData aboutData( QStringLiteral("privacybrowserpc"), - i18n("PrivacyBrowserPC"), - QStringLiteral("%{VERSION}"), - i18n("A Simple Application written with KDE Frameworks"), - KAboutLicense::GPL, - i18n("Copyright %{CURRENT_YEAR}, %{AUTHOR} <%{EMAIL}>")); + // Instantiate about data. + KAboutData aboutData(QStringLiteral("privacybrowser"), i18n("Privacy Browser"), QStringLiteral("0.1")); - aboutData.addAuthor(i18n("%{AUTHOR}"),i18n("Author"), QStringLiteral("%{EMAIL}")); - aboutData.setOrganizationDomain("example.org"); - aboutData.setDesktopFileName(QStringLiteral("org.example.privacybrowserpc")); + // Add the author information. + aboutData.addAuthor(i18n("Soren Stoutner"),i18n("Principal developer"), QStringLiteral("soren@stoutner.com"), QStringLiteral("https://www.stoutner.com/")); + // Populate additional about data info. TODO, OrLaterVersions does not work. The solution is probably to use a custom license file. + aboutData.setBugAddress("https://redmine.stoutner.com/projects/privacy-browser/issues"); // TODO. Update the URL. + aboutData.setCopyrightStatement(i18n("Copyright © 2022 Soren Stoutner ")); + aboutData.setDesktopFileName(QStringLiteral("com.stoutner.privacybrowser")); + aboutData.setHomepage(QStringLiteral("https://www.stoutner.com/privacy-browser-pc/")); + aboutData.setLicense(KAboutLicense::GPL_V3, KAboutLicense::OrLaterVersions); + aboutData.setOrganizationDomain("stoutner.com"); + aboutData.setShortDescription(i18n("A web browser that respects your privacy.")); + + // Set the application data. KAboutData::setApplicationData(aboutData); - application.setWindowIcon(QIcon::fromTheme(QStringLiteral("privacybrowserpc"))); - QCommandLineParser parser; - aboutData.setupCommandLine(&parser); + // Set the window icon. + application.setWindowIcon(QIcon::fromTheme(QStringLiteral("privacybrowser"), QIcon(":/icons/privacy_browser.svg"))); + + // Create a command line parser. + QCommandLineParser commandLineParser; + + // Process the command line through about data (this adds --license and --author). + aboutData.setupCommandLine(&commandLineParser); - parser.process(application); - aboutData.processCommandLine(&parser); + // Process the application command line options (this adds --version, --help, and --help-all). + commandLineParser.process(application); + // Make it so. + aboutData.processCommandLine(&commandLineParser); + + // TODO. KDBusService appDBusService(KDBusService::Multiple | KDBusService::NoExitOnFailure); - PrivacyBrowserPCWindow *window = new PrivacyBrowserPCWindow; - window->show(); + // Create the main window. + MainWindow *mainWindowPointer = new MainWindow; + + // Show the main window. + mainWindowPointer->show(); + // Return the application. return application.exec(); } diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp new file mode 100644 index 0000000..739fca9 --- /dev/null +++ b/src/mainwindow.cpp @@ -0,0 +1,77 @@ +/* + * Copyright © 2022 Soren Stoutner . + * + * This file is part of Privacy Browser PC . + * + * Privacy Browser PC is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Privacy Browser PC is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Privacy Browser PC. If not, see . + */ + +// Application headers. +#include "mainwindow.h" +#include "privacybrowserpcview.h" +#include "privacybrowserpcdebug.h" + +// KDE Frameworks headers. +#include +#include + + +MainWindow::MainWindow() : KXmlGuiWindow() +{ + m_privacybrowserpcView = new PrivacyBrowserPCView(this); + setCentralWidget(m_privacybrowserpcView); + + 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); + + KStandardAction::openNew(this, SLOT(fileNew()), actionCollection); + KStandardAction::quit(qApp, SLOT(closeAllWindows()), actionCollection); + KStandardAction::preferences(this, SLOT(settingsConfigure()), actionCollection); + + setupGUI(); +} + +MainWindow::~MainWindow() +{ +} + +void MainWindow::fileNew() +{ + qCDebug(PRIVACYBROWSER) << "PrivacyBrowserPCWindow::fileNew()"; + (new MainWindow)->show(); +} + +void MainWindow::settingsConfigure() +{ + qCDebug(PRIVACYBROWSER) << "MainWindow::settingsConfigure()"; + // The preference dialog is derived from prefs_base.ui + // + // compare the names of the widgets in the .ui file + // to the names of the variables in the .kcfg file + //avoid to have 2 dialogs shown + if (KConfigDialog::showDialog(QStringLiteral("settings"))) { + return; + } + + KConfigDialog *dialog = new KConfigDialog(this, QStringLiteral("settings"), PrivacyBrowserPCSettings::self()); + QWidget *generalSettingsPage = new QWidget; + m_settings.setupUi(generalSettingsPage); + dialog->addPage(generalSettingsPage, i18nc("@title:tab", "General"), QStringLiteral("package_setting")); + connect(dialog, &KConfigDialog::settingsChanged, m_privacybrowserpcView, &PrivacyBrowserPCView::handleSettingsChanged); + dialog->setAttribute(Qt::WA_DeleteOnClose); + dialog->show(); +} diff --git a/src/mainwindow.h b/src/mainwindow.h new file mode 100644 index 0000000..a70db9f --- /dev/null +++ b/src/mainwindow.h @@ -0,0 +1,72 @@ +/* + * Copyright © 2022 Soren Stoutner . + * + * This file is part of Privacy Browser PC . + * + * Privacy Browser PC is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Privacy Browser PC is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Privacy Browser PC. If not, see . + */ + +#ifndef MAINWINDOW_H +#define MAINWINDOW_H + +// Application headers. +#include "ui_settings.h" +#include "PrivacyBrowserPCSettings.h" + +// KDE Frameworks headers. +#include + +// TODO. What is this doing here? +class PrivacyBrowserPCView; + +/** TODO. Remove. + * This class serves as the main window for privacybrowserpc. It handles the + * menus, toolbars and status bars. + * + * @short Main window class + * @author %{AUTHOR} <%{EMAIL}> + * @version %{VERSION} + */ +class MainWindow : public KXmlGuiWindow // TODO. Checkout documentation. +{ + // Include the Q_OBJECT macro. + Q_OBJECT + +public: + // The default constructor. + MainWindow(); + + + // The default destructor. TODO, this could probably be removed. + ~MainWindow() override; + +private Q_SLOTS: + /** + * Create a new window + */ + void fileNew(); + + /** + * Open the settings dialog + */ + void settingsConfigure(); + +private: + // this is the name of the root widget inside our Ui file + // you can rename it in designer and then change it here + Ui::Settings m_settings; + QAction *m_switchAction; + PrivacyBrowserPCView *m_privacybrowserpcView; +}; +#endif diff --git a/src/privacybrowserpcview.cpp b/src/privacybrowserpcview.cpp index 7a903aa..84e5eed 100644 --- a/src/privacybrowserpcview.cpp +++ b/src/privacybrowserpcview.cpp @@ -34,7 +34,7 @@ void PrivacyBrowserPCView::switchColors() void PrivacyBrowserPCView::handleSettingsChanged() { - qCDebug(PRIVACYBROWSERPC) << "PrivacyBrowserPCView::handleSettingsChanged()"; + qCDebug(PRIVACYBROWSER) << "PrivacyBrowserPCView::handleSettingsChanged()"; QPalette palette = m_ui.templateLabel->palette(); palette.setColor(QPalette::Window, PrivacyBrowserPCSettings::colorBackground()); palette.setColor(QPalette::WindowText, PrivacyBrowserPCSettings::colorForeground()); diff --git a/src/privacybrowserpcwindow.cpp b/src/privacybrowserpcwindow.cpp deleted file mode 100644 index d27ea98..0000000 --- a/src/privacybrowserpcwindow.cpp +++ /dev/null @@ -1,66 +0,0 @@ -/* - SPDX-FileCopyrightText: %{CURRENT_YEAR} %{AUTHOR} <%{EMAIL}> - - SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL -*/ - -// application headers -#include "privacybrowserpcwindow.h" - -#include "privacybrowserpcview.h" -#include "privacybrowserpcdebug.h" - -// KF headers -#include -#include - - -PrivacyBrowserPCWindow::PrivacyBrowserPCWindow() - : KXmlGuiWindow() -{ - m_privacybrowserpcView = new PrivacyBrowserPCView(this); - setCentralWidget(m_privacybrowserpcView); - - 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); - - KStandardAction::openNew(this, SLOT(fileNew()), actionCollection); - KStandardAction::quit(qApp, SLOT(closeAllWindows()), actionCollection); - KStandardAction::preferences(this, SLOT(settingsConfigure()), actionCollection); - - setupGUI(); -} - -PrivacyBrowserPCWindow::~PrivacyBrowserPCWindow() -{ -} - -void PrivacyBrowserPCWindow::fileNew() -{ - qCDebug(PRIVACYBROWSERPC) << "PrivacyBrowserPCWindow::fileNew()"; - (new PrivacyBrowserPCWindow)->show(); -} - -void PrivacyBrowserPCWindow::settingsConfigure() -{ - qCDebug(PRIVACYBROWSERPC) << "PrivacyBrowserPCWindow::settingsConfigure()"; - // The preference dialog is derived from prefs_base.ui - // - // compare the names of the widgets in the .ui file - // to the names of the variables in the .kcfg file - //avoid to have 2 dialogs shown - if (KConfigDialog::showDialog(QStringLiteral("settings"))) { - return; - } - - KConfigDialog *dialog = new KConfigDialog(this, QStringLiteral("settings"), PrivacyBrowserPCSettings::self()); - QWidget *generalSettingsPage = new QWidget; - m_settings.setupUi(generalSettingsPage); - dialog->addPage(generalSettingsPage, i18nc("@title:tab", "General"), QStringLiteral("package_setting")); - connect(dialog, &KConfigDialog::settingsChanged, m_privacybrowserpcView, &PrivacyBrowserPCView::handleSettingsChanged); - dialog->setAttribute(Qt::WA_DeleteOnClose); - dialog->show(); -} diff --git a/src/privacybrowserpcwindow.h b/src/privacybrowserpcwindow.h deleted file mode 100644 index 77fd554..0000000 --- a/src/privacybrowserpcwindow.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - SPDX-FileCopyrightText: %{CURRENT_YEAR} %{AUTHOR} <%{EMAIL}> - - SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL -*/ - -#ifndef PRIVACYBROWSERPCWINDOW_H -#define PRIVACYBROWSERPCWINDOW_H - -#include - -#include "ui_settings.h" -#include "PrivacyBrowserPCSettings.h" - -class PrivacyBrowserPCView; - -/** - * This class serves as the main window for privacybrowserpc. It handles the - * menus, toolbars and status bars. - * - * @short Main window class - * @author %{AUTHOR} <%{EMAIL}> - * @version %{VERSION} - */ -class PrivacyBrowserPCWindow : public KXmlGuiWindow -{ - Q_OBJECT -public: - /** - * Default Constructor - */ - PrivacyBrowserPCWindow(); - - /** - * Default Destructor - */ - ~PrivacyBrowserPCWindow() override; - -private Q_SLOTS: - /** - * Create a new window - */ - void fileNew(); - - /** - * Open the settings dialog - */ - void settingsConfigure(); - -private: - // this is the name of the root widget inside our Ui file - // you can rename it in designer and then change it here - Ui::Settings m_settings; - QAction *m_switchAction; - PrivacyBrowserPCView *m_privacybrowserpcView; -}; - -#endif // PRIVACYBROWSERPCWINDOW_H diff --git a/src/resources.qrc b/src/resources.qrc new file mode 100644 index 0000000..7603240 --- /dev/null +++ b/src/resources.qrc @@ -0,0 +1,24 @@ + + + + + + icons/privacy_browser.svg + +