mirror of
https://github.com/status-im/snorenotify.git
synced 2025-02-26 06:55:14 +00:00
move settings dialog to core, add a config exe
This commit is contained in:
parent
8cf88a448d
commit
a0ebe1b722
@ -9,6 +9,9 @@ include(KDEInstallDirs)
|
||||
include(KDECompilerSettings)
|
||||
include(KDECMakeSettings)
|
||||
|
||||
include(ECMAddAppIcon)
|
||||
include(ECMInstallIcons)
|
||||
|
||||
include(GenerateExportHeader)
|
||||
include(FeatureSummary)
|
||||
|
||||
|
@ -2,4 +2,5 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/core
|
||||
|
||||
add_subdirectory(core)
|
||||
add_subdirectory(daemon)
|
||||
add_subdirectory(settings)
|
||||
add_subdirectory(plugins)
|
||||
|
@ -14,6 +14,9 @@ QT5_ADD_RESOURCES(SNORENOTIFY_RCS ${SNORE_RCS})
|
||||
add_subdirectory(notification)
|
||||
add_subdirectory(plugins)
|
||||
|
||||
|
||||
qt5_wrap_ui(UI settingsdialog.ui)
|
||||
|
||||
list(APPEND SnoreNotify_SRCS
|
||||
snore.cpp
|
||||
snore_p.cpp
|
||||
@ -23,6 +26,8 @@ list(APPEND SnoreNotify_SRCS
|
||||
alert_p.cpp
|
||||
hint.cpp
|
||||
log.cpp
|
||||
settingsdialog.cpp
|
||||
${UI}
|
||||
${CMAKE_CURRENT_BINARY_DIR}/version.cpp
|
||||
${SNORENOTIFY_RCS}
|
||||
)
|
||||
@ -34,6 +39,7 @@ list(APPEND SnoreNotify_HDR
|
||||
alert.h
|
||||
hint.h
|
||||
log.h
|
||||
settingsdialog.h
|
||||
${CMAKE_CURRENT_BINARY_DIR}/snore_exports.h
|
||||
version.h
|
||||
)
|
||||
|
101
src/core/settingsdialog.cpp
Normal file
101
src/core/settingsdialog.cpp
Normal file
@ -0,0 +1,101 @@
|
||||
/*
|
||||
SnoreNotify is a Notification Framework based on Qt
|
||||
Copyright (C) 2015 Patrick von Reth <vonreth@kde.org>
|
||||
|
||||
SnoreNotify is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
SnoreNotify 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 Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with SnoreNotify. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "settingsdialog.h"
|
||||
#include "ui_settingsdialog.h"
|
||||
#include "snore.h"
|
||||
|
||||
#include <QAbstractButton>
|
||||
#include <QTabWidget>
|
||||
#include <QFormLayout>
|
||||
#include <QCheckBox>
|
||||
|
||||
using namespace Snore;
|
||||
|
||||
SettingsDialog::SettingsDialog(SnoreCore *snore, QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::SettingsDialog),
|
||||
m_snore(snore),
|
||||
m_app(new Application("SnoreSettings", Icon(":/root/snore.png"))),
|
||||
m_alert(new Alert("Test", Icon(":/root/snore.png")))
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
m_app->addAlert(*m_alert);
|
||||
|
||||
for (auto widget : snore->settingWidgets()) {
|
||||
ui->tabWidget->addTab(widget, widget->name());
|
||||
m_tabs.append(widget);
|
||||
}
|
||||
load();
|
||||
}
|
||||
|
||||
SettingsDialog::~SettingsDialog()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void Snore::SettingsDialog::on_pushButton_clicked()
|
||||
{
|
||||
if (!m_snore->aplications().contains(m_app->name())) {
|
||||
m_snore->registerApplication(*m_app);
|
||||
}
|
||||
Notification noti(*m_app, *m_alert, "Hello World",
|
||||
"<i>This is Snore</i><br>"
|
||||
"<a href=\"https://github.com/TheOneRing/Snorenotify\">Project Website</a><br>",
|
||||
Icon(":/root/snore.png"));
|
||||
noti.addAction(Action(1, "Test Action"));
|
||||
m_snore->broadcastNotification(noti);
|
||||
}
|
||||
|
||||
void SettingsDialog::load()
|
||||
{
|
||||
snoreDebug(SNORE_DEBUG) << "loading";
|
||||
ui->primaryBackendComboBox->clear();
|
||||
QStringList list = m_snore->pluginNames(SnorePlugin::BACKEND);
|
||||
ui->primaryBackendComboBox->addItems(list);
|
||||
ui->primaryBackendComboBox->setCurrentIndex(list.indexOf(m_snore->primaryNotificationBackend()));
|
||||
for (auto widget : m_tabs) {
|
||||
widget->loadSettings();
|
||||
}
|
||||
}
|
||||
|
||||
void SettingsDialog::save()
|
||||
{
|
||||
snoreDebug(SNORE_DEBUG) << "saving";
|
||||
m_snore->setPrimaryNotificationBackend(ui->primaryBackendComboBox->currentText());
|
||||
for (auto w : m_tabs) {
|
||||
w->saveSettings();
|
||||
}
|
||||
}
|
||||
|
||||
void Snore::SettingsDialog::on_buttonBox_clicked(QAbstractButton *button)
|
||||
{
|
||||
switch (ui->buttonBox->buttonRole(button)) {
|
||||
case QDialogButtonBox::AcceptRole:
|
||||
case QDialogButtonBox::ApplyRole:
|
||||
save();
|
||||
break;
|
||||
case QDialogButtonBox::ResetRole:
|
||||
load();
|
||||
break;
|
||||
case QDialogButtonBox::RejectRole:
|
||||
break;
|
||||
default:
|
||||
snoreDebug(SNORE_WARNING) << "unhandled role" << button->text();
|
||||
}
|
||||
}
|
@ -18,12 +18,19 @@
|
||||
#ifndef SETTINGSDIALOG_H
|
||||
#define SETTINGSDIALOG_H
|
||||
|
||||
#include "snore_exports.h"
|
||||
|
||||
#include <QDialog>
|
||||
#include <QScopedPointer>
|
||||
|
||||
class QAbstractButton;
|
||||
|
||||
namespace Snore
|
||||
{
|
||||
class SnoreCore;
|
||||
class PluginSettingsWidget;
|
||||
class Application;
|
||||
class Alert;
|
||||
}
|
||||
|
||||
namespace Ui
|
||||
@ -31,21 +38,31 @@ namespace Ui
|
||||
class SettingsDialog;
|
||||
}
|
||||
|
||||
class SettingsDialog : public QDialog
|
||||
namespace Snore
|
||||
{
|
||||
class SNORE_EXPORT SettingsDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit SettingsDialog(Snore::SnoreCore *snore, QWidget *parent = 0);
|
||||
explicit SettingsDialog(SnoreCore *snore, QWidget *parent = 0);
|
||||
~SettingsDialog();
|
||||
|
||||
private slots:
|
||||
void on_buttonBox_accepted();
|
||||
void on_pushButton_clicked();
|
||||
void load();
|
||||
void save();
|
||||
|
||||
void on_buttonBox_clicked(QAbstractButton *button);
|
||||
|
||||
private:
|
||||
Ui::SettingsDialog *ui;
|
||||
Snore::SnoreCore *m_snore;
|
||||
SnoreCore *m_snore;
|
||||
QScopedPointer<Application> m_app;
|
||||
QScopedPointer<Alert> m_alert;
|
||||
QList<Snore::PluginSettingsWidget *> m_tabs;
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
#endif // SETTINGSDIALOG_H
|
@ -30,6 +30,12 @@
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
|
||||
</property>
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="primaryBackendComboBox"/>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="primaryBackendLabel">
|
||||
<property name="text">
|
||||
@ -37,22 +43,26 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="primaryBackendComboBox"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton">
|
||||
<property name="text">
|
||||
<string>Display Test Notification</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
<set>QDialogButtonBox::Apply|QDialogButtonBox::Cancel|QDialogButtonBox::Ok|QDialogButtonBox::Reset</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
@ -85,7 +85,7 @@ void SnoreCore::loadPlugins(SnorePlugin::PluginTypes types)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
d->initPrimaryNotificationBackend();
|
||||
snoreDebug(SNORE_INFO) << "Loaded Plugins:" << d->m_pluginNames;
|
||||
}
|
||||
|
||||
@ -140,63 +140,7 @@ const QStringList SnoreCore::pluginNames(SnorePlugin::PluginTypes type) const
|
||||
bool SnoreCore::setPrimaryNotificationBackend(const QString &backend)
|
||||
{
|
||||
Q_D(SnoreCore);
|
||||
if (backend == primaryNotificationBackend()) {
|
||||
return true;
|
||||
}
|
||||
const QHash<QString, PluginContainer *> backends = PluginContainer::pluginCache(SnorePlugin::BACKEND);
|
||||
if (!backends.contains(backend)) {
|
||||
snoreDebug(SNORE_DEBUG) << "Unknown Backend:" << backend;
|
||||
return false;
|
||||
}
|
||||
snoreDebug(SNORE_DEBUG) << "Setting Notification Backend to:" << backend;
|
||||
SnoreBackend *b = qobject_cast<SnoreBackend *>(backends.value(backend)->load());
|
||||
if (!b->isInitialized()) {
|
||||
if (!b->initialize()) {
|
||||
snoreDebug(SNORE_DEBUG) << "Failed to initialize" << b->name();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (d->m_notificationBackend) {
|
||||
d->m_notificationBackend->deinitialize();
|
||||
}
|
||||
|
||||
d->m_notificationBackend = b;
|
||||
settings()->setValue("PrimaryBackend", backend);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SnoreCore::setPrimaryNotificationBackend()
|
||||
{
|
||||
Q_D(SnoreCore);
|
||||
if (d->setBackendIfAvailible(settings()->value("PrimaryBackend").toString())) {
|
||||
return true;
|
||||
}
|
||||
#ifdef Q_OS_WIN
|
||||
if (QSysInfo::windowsVersion() >= QSysInfo::WV_WINDOWS8 && d->setBackendIfAvailible("Windows 8")) {
|
||||
return true;
|
||||
}
|
||||
if (d->setBackendIfAvailible("Growl")) {
|
||||
return true;
|
||||
}
|
||||
if (d->setBackendIfAvailible("Snarl")) {
|
||||
return true;
|
||||
}
|
||||
#elif defined(Q_OS_LINUX)
|
||||
if (d->setBackendIfAvailible("FreedesktopNotification")) {
|
||||
return true;
|
||||
}
|
||||
#elif defined(Q_OS_MAC)
|
||||
if (d->setBackendIfAvailible("OSX Notification Center")) {
|
||||
return true;
|
||||
}
|
||||
if (d->setBackendIfAvailible("Growl")) {
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
if (d->setBackendIfAvailible("Snore")) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return d->setBackendIfAvailible(backend);
|
||||
}
|
||||
|
||||
const QString SnoreCore::primaryNotificationBackend() const
|
||||
|
@ -119,12 +119,6 @@ public:
|
||||
*/
|
||||
bool setPrimaryNotificationBackend(const QString &backend);
|
||||
|
||||
/**
|
||||
* Tries to set one of all backends availible on this platform as backend.
|
||||
* @see primaryNotificationBackend
|
||||
* @return whether a backend was succesfully set
|
||||
*/
|
||||
bool setPrimaryNotificationBackend();
|
||||
/**
|
||||
*
|
||||
* @return the name of the active primary backend
|
||||
|
@ -71,7 +71,62 @@ bool SnoreCorePrivate::setBackendIfAvailible(const QString &backend)
|
||||
{
|
||||
Q_Q(SnoreCore);
|
||||
if (m_pluginNames[SnorePlugin::BACKEND].contains(backend)) {
|
||||
return q->setPrimaryNotificationBackend(backend);
|
||||
if (backend == q->primaryNotificationBackend()) {
|
||||
return true;
|
||||
}
|
||||
const QHash<QString, PluginContainer *> backends = PluginContainer::pluginCache(SnorePlugin::BACKEND);
|
||||
if (!backends.contains(backend)) {
|
||||
snoreDebug(SNORE_DEBUG) << "Unknown Backend:" << backend;
|
||||
return false;
|
||||
}
|
||||
snoreDebug(SNORE_DEBUG) << "Setting Notification Backend to:" << backend;
|
||||
SnoreBackend *b = qobject_cast<SnoreBackend *>(backends.value(backend)->load());
|
||||
if (!b->isInitialized()) {
|
||||
if (!b->initialize()) {
|
||||
snoreDebug(SNORE_DEBUG) << "Failed to initialize" << b->name();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (m_notificationBackend) {
|
||||
m_notificationBackend->deinitialize();
|
||||
}
|
||||
|
||||
m_notificationBackend = b;
|
||||
m_settings->setValue("PrimaryBackend", backend);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool SnoreCorePrivate::initPrimaryNotificationBackend()
|
||||
{
|
||||
if (setBackendIfAvailible(m_settings->value("PrimaryBackend").toString())) {
|
||||
return true;
|
||||
}
|
||||
#ifdef Q_OS_WIN
|
||||
if (QSysInfo::windowsVersion() >= QSysInfo::WV_WINDOWS8 && setBackendIfAvailible("Windows 8")) {
|
||||
return true;
|
||||
}
|
||||
if (setBackendIfAvailible("Growl")) {
|
||||
return true;
|
||||
}
|
||||
if (setBackendIfAvailible("Snarl")) {
|
||||
return true;
|
||||
}
|
||||
#elif defined(Q_OS_LINUX)
|
||||
if (setBackendIfAvailible("FreedesktopNotification")) {
|
||||
return true;
|
||||
}
|
||||
#elif defined(Q_OS_MAC)
|
||||
if (setBackendIfAvailible("OSX Notification Center")) {
|
||||
return true;
|
||||
}
|
||||
if (setBackendIfAvailible("Growl")) {
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
if (setBackendIfAvailible("Snore")) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -68,6 +68,8 @@ public:
|
||||
return q_ptr;
|
||||
}
|
||||
|
||||
bool initPrimaryNotificationBackend();
|
||||
|
||||
signals:
|
||||
void applicationRegistered(const Snore::Application &);
|
||||
void applicationDeregistered(const Snore::Application &);
|
||||
|
@ -1,12 +1,8 @@
|
||||
if(WITH_SNORE_DAEMON)
|
||||
include(ECMAddAppIcon)
|
||||
include(ECMInstallIcons)
|
||||
ecm_add_app_icon(SNORENOTIFY_DAEMON_DEPS ICONS ${PROJECT_SOURCE_DIR}/data/128-apps-snore.png)
|
||||
|
||||
qt5_wrap_ui(UI settingsdialog.ui)
|
||||
|
||||
add_executable( snorenotify WIN32 main.cpp snorenotify.cpp trayicon.cpp settingsdialog.cpp ${UI} ${SNORENOTIFY_DAEMON_DEPS})
|
||||
target_link_libraries( snorenotify libsnore Qt5::Gui Qt5::Widgets )
|
||||
add_executable( snorenotify WIN32 main.cpp snorenotify.cpp trayicon.cpp ${SNORENOTIFY_DAEMON_DEPS})
|
||||
target_link_libraries( snorenotify Snore::Libsnore)
|
||||
install(TARGETS snorenotify ${KDE_INSTALL_TARGETS_DEFAULT_ARGS})
|
||||
|
||||
if(UNIX)
|
||||
|
@ -1,56 +0,0 @@
|
||||
/*
|
||||
SnoreNotify is a Notification Framework based on Qt
|
||||
Copyright (C) 2015 Patrick von Reth <vonreth@kde.org>
|
||||
|
||||
SnoreNotify is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
SnoreNotify 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 Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with SnoreNotify. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "settingsdialog.h"
|
||||
#include "ui_settingsdialog.h"
|
||||
#include "snore.h"
|
||||
|
||||
#include <QTabWidget>
|
||||
#include <QFormLayout>
|
||||
#include <QCheckBox>
|
||||
|
||||
using namespace Snore;
|
||||
|
||||
SettingsDialog::SettingsDialog(SnoreCore *snore, QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::SettingsDialog),
|
||||
m_snore(snore)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
QStringList list = snore->pluginNames(SnorePlugin::BACKEND);
|
||||
ui->primaryBackendComboBox->addItems(list);
|
||||
ui->primaryBackendComboBox->setCurrentIndex(list.indexOf(snore->primaryNotificationBackend()));
|
||||
for (auto widget : snore->settingWidgets()) {
|
||||
ui->tabWidget->addTab(widget, widget->name());
|
||||
widget->loadSettings();
|
||||
m_tabs.append(widget);
|
||||
}
|
||||
}
|
||||
|
||||
SettingsDialog::~SettingsDialog()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void SettingsDialog::on_buttonBox_accepted()
|
||||
{
|
||||
m_snore->setPrimaryNotificationBackend(ui->primaryBackendComboBox->currentText());
|
||||
for (auto w : m_tabs) {
|
||||
w->saveSettings();
|
||||
}
|
||||
}
|
@ -27,16 +27,13 @@
|
||||
|
||||
using namespace Snore;
|
||||
|
||||
SnoreNotify::SnoreNotify():
|
||||
m_settings("SnoreNotify", "SnoreNotify")
|
||||
SnoreNotify::SnoreNotify()
|
||||
{
|
||||
m_trayIcon = new TrayIcon();
|
||||
m_snore = new SnoreCore();
|
||||
m_snore->loadPlugins(SnorePlugin::ALL);
|
||||
load();
|
||||
m_trayIcon->initConextMenu(m_snore);
|
||||
|
||||
connect(qApp, SIGNAL(aboutToQuit()), this, SLOT(exit()));
|
||||
snoreDebug(SNORE_DEBUG) << "Snorenotfiy initialized with" << m_snore->primaryNotificationBackend();
|
||||
}
|
||||
|
||||
@ -46,29 +43,3 @@ SnoreNotify::~SnoreNotify()
|
||||
delete m_trayIcon;
|
||||
}
|
||||
|
||||
void SnoreNotify::load()
|
||||
{
|
||||
QString backend = m_settings.value("notificationBackend").toString();
|
||||
if (!backend.isEmpty()) {
|
||||
if (!m_snore->setPrimaryNotificationBackend(backend)) {
|
||||
m_snore->setPrimaryNotificationBackend();
|
||||
}
|
||||
} else {
|
||||
m_snore->setPrimaryNotificationBackend();
|
||||
}
|
||||
}
|
||||
void SnoreNotify::save()
|
||||
{
|
||||
m_settings.setValue("notificationBackend", m_snore->primaryNotificationBackend());
|
||||
}
|
||||
|
||||
void SnoreNotify::exit()
|
||||
{
|
||||
snoreDebug(SNORE_DEBUG) << "Saving snore settings";
|
||||
foreach(const Application & a, m_snore->aplications()) {
|
||||
m_snore->deregisterApplication(a);
|
||||
}
|
||||
save();
|
||||
m_trayIcon->hide();
|
||||
}
|
||||
|
||||
|
@ -32,16 +32,10 @@ class SnoreNotify: public QObject
|
||||
public:
|
||||
SnoreNotify();
|
||||
~SnoreNotify();
|
||||
void load();
|
||||
void save();
|
||||
|
||||
private:
|
||||
class TrayIcon *m_trayIcon;
|
||||
Snore::SnoreCore *m_snore;
|
||||
QSettings m_settings;
|
||||
|
||||
private slots:
|
||||
void exit();
|
||||
};
|
||||
|
||||
#endif // SNORENOTIFY_H
|
||||
|
@ -17,7 +17,7 @@
|
||||
*/
|
||||
|
||||
#include "trayicon.h"
|
||||
#include "settingsdialog.h"
|
||||
#include "core/settingsdialog.h"
|
||||
#include "core/snore.h"
|
||||
#include "core/snore_p.h"
|
||||
|
||||
|
@ -22,6 +22,11 @@
|
||||
#include <QAction>
|
||||
#include "core/snore.h"
|
||||
|
||||
namespace Snore
|
||||
{
|
||||
class SettingsDialog;
|
||||
}
|
||||
|
||||
class TrayIcon: public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
@ -38,7 +43,7 @@ private:
|
||||
Snore::SnoreCore *m_snore;
|
||||
Snore::Application m_app;
|
||||
Snore::Alert m_alert;
|
||||
class SettingsDialog *m_settings;
|
||||
Snore::SettingsDialog *m_settings;
|
||||
|
||||
QHash<QTimer *, Snore::Notification> m_notifications;
|
||||
|
||||
|
12
src/settings/CMakeLists.txt
Normal file
12
src/settings/CMakeLists.txt
Normal file
@ -0,0 +1,12 @@
|
||||
ecm_add_app_icon(SNORENOTIFY_DAEMON_DEPS ICONS ${PROJECT_SOURCE_DIR}/data/128-apps-snore.png)
|
||||
|
||||
add_executable( snoresettings WIN32 main.cpp ${UI} ${SNORENOTIFY_DAEMON_DEPS})
|
||||
target_link_libraries( snoresettings Snore::Libsnore )
|
||||
install(TARGETS snoresettings ${KDE_INSTALL_TARGETS_DEFAULT_ARGS})
|
||||
|
||||
#if(UNIX)
|
||||
# ecm_install_icons(ICONS ${PROJECT_SOURCE_DIR}/data/128-apps-snore.png DESTINATION ${KDE_INSTALL_ICONDIR})
|
||||
# configure_file("${CMAKE_CURRENT_SOURCE_DIR}/snorenotify.desktop.in" "${CMAKE_CURRENT_BINARY_DIR}/snorenotify.desktop" @ONLY)
|
||||
# install(FILES "${CMAKE_CURRENT_BINARY_DIR}/snorenotify.desktop" DESTINATION ${KDE_INSTALL_APPDIR})
|
||||
#endif()
|
||||
|
26
src/settings/main.cpp
Normal file
26
src/settings/main.cpp
Normal file
@ -0,0 +1,26 @@
|
||||
|
||||
#include "core/settingsdialog.h"
|
||||
#include "core/snore.h"
|
||||
#include "core/version.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QMainWindow>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QApplication app(argc, argv);
|
||||
app.setApplicationName("SnoreSettings");
|
||||
app.setOrganizationName("SnoreNotify");
|
||||
app.setApplicationVersion(Snore::Version::version());
|
||||
app.setQuitOnLastWindowClosed(true);
|
||||
|
||||
Snore::SnoreCore snore;
|
||||
snore.loadPlugins(Snore::SnorePlugin::ALL);
|
||||
|
||||
Snore::SettingsDialog diag(&snore);
|
||||
// diag.setWindowIcon(QIcon(":/root/snore.png"));
|
||||
diag.setWindowTitle("SnoreSettings");
|
||||
diag.show();
|
||||
return app.exec();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user