diff --git a/src/daemon/trayicon.cpp b/src/daemon/trayicon.cpp index 8b01540..58b48cb 100644 --- a/src/daemon/trayicon.cpp +++ b/src/daemon/trayicon.cpp @@ -41,8 +41,8 @@ TrayIcon::TrayIcon(): void TrayIcon::initConextMenu() { m_settings = new SettingsDialog(); - QDialogButtonBox *box = new QDialogButtonBox(QDialogButtonBox::Apply|QDialogButtonBox::Cancel|QDialogButtonBox::Ok|QDialogButtonBox::Reset, m_settings); - connect(box, &QDialogButtonBox::clicked,[&,box](QAbstractButton *button){ + QDialogButtonBox *box = new QDialogButtonBox(QDialogButtonBox::Apply | QDialogButtonBox::Cancel | QDialogButtonBox::Ok | QDialogButtonBox::Reset, m_settings); + connect(box, &QDialogButtonBox::clicked, [ &, box](QAbstractButton * button) { switch (box->buttonRole(button)) { case QDialogButtonBox::AcceptRole: m_settings->accept(); @@ -63,7 +63,6 @@ void TrayIcon::initConextMenu() }); m_settings->layout()->addWidget(box); - // connect(m_settings, &SettingsDialog::finished, m_settings, &SettingsDialog::hide); m_trayIcon->setVisible(true); diff --git a/src/libsnore/notification/notification.cpp b/src/libsnore/notification/notification.cpp index 9efb5e1..f0cc00d 100644 --- a/src/libsnore/notification/notification.cpp +++ b/src/libsnore/notification/notification.cpp @@ -25,7 +25,6 @@ using namespace Snore; - Notification::Notification() : d(NULL) { diff --git a/src/libsnore/plugins/plugincontainer.cpp b/src/libsnore/plugins/plugincontainer.cpp index 6876ee5..259cb29 100644 --- a/src/libsnore/plugins/plugincontainer.cpp +++ b/src/libsnore/plugins/plugincontainer.cpp @@ -87,7 +87,7 @@ bool PluginContainer::isLoaded() const void PluginContainer::updatePluginCache() { snoreDebug(SNORE_DEBUG) << "Updating plugin cache"; - for(auto list : s_pluginCache) { + for (auto list : s_pluginCache) { foreach(PluginContainer * p, list.values()) { delete p; } diff --git a/src/libsnore/plugins/plugins.cpp b/src/libsnore/plugins/plugins.cpp index 80b8da6..67c814e 100644 --- a/src/libsnore/plugins/plugins.cpp +++ b/src/libsnore/plugins/plugins.cpp @@ -140,7 +140,6 @@ const QList &SnorePlugin::types() return t; } - QDebug operator<<(QDebug debug, const Snore::SnorePlugin::PluginTypes &flags) { QMetaEnum e = SnorePlugin::staticMetaObject.enumerator(SnorePlugin::staticMetaObject.indexOfEnumerator("PluginType")); @@ -164,7 +163,6 @@ QDebug operator<<(QDebug debug, const Snore::SnorePlugin::PluginTypes &flags) } - QDataStream &operator<<(QDataStream &out, const Snore::SnorePlugin::PluginTypes &type) { out << static_cast(type); diff --git a/src/libsnore/plugins/plugins.h b/src/libsnore/plugins/plugins.h index 78de606..df8c9c6 100644 --- a/src/libsnore/plugins/plugins.h +++ b/src/libsnore/plugins/plugins.h @@ -47,7 +47,6 @@ public: static QString typeToString(const PluginTypes t); static const QList &types(); - SnorePlugin(const QString &name); virtual ~SnorePlugin(); virtual bool initialize(); @@ -90,5 +89,4 @@ SNORE_EXPORT QDebug operator<<(QDebug, const Snore::SnorePlugin::PluginTypes &); SNORE_EXPORT QDataStream &operator<<(QDataStream &out, const Snore::SnorePlugin::PluginTypes &type); SNORE_EXPORT QDataStream &operator>>(QDataStream &in, Snore::SnorePlugin::PluginTypes &type); - #endif//SNORE_PLUGINS_H diff --git a/src/libsnore/settingsdialog.cpp b/src/libsnore/settingsdialog.cpp index d4c51b2..f7e646e 100644 --- a/src/libsnore/settingsdialog.cpp +++ b/src/libsnore/settingsdialog.cpp @@ -43,11 +43,10 @@ SettingsDialog::~SettingsDialog() void SettingsDialog::initTabs() { SnorePlugin::PluginTypes types = SnoreCore::instance().value("PluginTypes", LOCAL_SETTING).value(); - if(types == SnorePlugin::NONE) - { + if (types == SnorePlugin::NONE) { types = SnorePlugin::ALL; } - auto addWidgets = [&](QTabWidget *target, QWidget *container, SnorePlugin::PluginTypes type){ + auto addWidgets = [&](QTabWidget * target, QWidget * container, SnorePlugin::PluginTypes type) { bool enabled = false; target->clear(); if (types & type) { @@ -59,7 +58,7 @@ void SettingsDialog::initTabs() } if (enabled) { if (ui->tabWidget->indexOf(container) == -1) { - ui->tabWidget->addTab(container,container->property("TAB_NAME").toString()); + ui->tabWidget->addTab(container, container->property("TAB_NAME").toString()); } } else { int index = ui->tabWidget->indexOf(container); @@ -76,9 +75,9 @@ void SettingsDialog::initTabs() void Snore::SettingsDialog::on_pushButton_clicked() { Application app = SnoreCorePrivate::instance()->defaultApplication(); - Notification noti(app, app.defaultAlert(),tr("Hello World"), + Notification noti(app, app.defaultAlert(), tr("Hello World"), QString("%1
" - "%2
").arg(tr("This is Snore"), tr("Project Website") ), + "%2
").arg(tr("This is Snore"), tr("Project Website")), app.icon()); noti.addAction(Action(1, tr("Test Action"))); SnoreCore::instance().broadcastNotification(noti); diff --git a/src/libsnore/settingsdialog.h b/src/libsnore/settingsdialog.h index aa97533..7d6cd39 100644 --- a/src/libsnore/settingsdialog.h +++ b/src/libsnore/settingsdialog.h @@ -51,7 +51,6 @@ public: //TODO: move to private header void initTabs(); - public slots: void setVisible(bool b) override; void accept(); diff --git a/src/libsnore/snore.cpp b/src/libsnore/snore.cpp index 5f0d2b0..ec53891 100644 --- a/src/libsnore/snore.cpp +++ b/src/libsnore/snore.cpp @@ -36,7 +36,7 @@ using namespace Snore; SnoreCore::SnoreCore(QObject *parent): QObject(parent) { - if (QThread::currentThread() != parent->thread() ) { + if (QThread::currentThread() != parent->thread()) { moveToThread(parent->thread()); } d_ptr = new SnoreCorePrivate(); @@ -48,7 +48,7 @@ SnoreCore::SnoreCore(QObject *parent): SnoreCore &SnoreCore::instance() { static SnoreCore *instance = nullptr; - if(!instance) { + if (!instance) { SnoreCorePrivate::loadTranslator(); SnoreCorePrivate::registerMetaTypes(); instance = new SnoreCore(qApp); @@ -64,7 +64,7 @@ SnoreCore::~SnoreCore() void SnoreCore::loadPlugins(SnorePlugin::PluginTypes types) { - if (QThread::currentThread() != thread() ) { + if (QThread::currentThread() != thread()) { snoreDebug(SNORE_DEBUG) << "Delayed Plugin loading." << QThread::currentThread() << thread(); QMetaObject::invokeMethod(this, "loadPlugins", Qt::BlockingQueuedConnection, Q_ARG(Snore::SnorePlugin::PluginTypes, types)); return; @@ -213,8 +213,8 @@ QList SnoreCore::settingWidgets(SnorePlugin::PluginTypes list.append(widget); } } - qSort(list.begin(),list.end(),[](PluginSettingsWidget *a,PluginSettingsWidget *b){ - return a->name() < b->name(); + qSort(list.begin(), list.end(), [](PluginSettingsWidget * a, PluginSettingsWidget * b) { + return a->name() < b->name(); }); return list; } diff --git a/src/libsnore/snore_p.cpp b/src/libsnore/snore_p.cpp index 4d7fe40..243124b 100644 --- a/src/libsnore/snore_p.cpp +++ b/src/libsnore/snore_p.cpp @@ -173,7 +173,8 @@ void SnoreCorePrivate::syncSettings() } } -QStringList SnoreCorePrivate::knownClients(){ +QStringList SnoreCorePrivate::knownClients() +{ QStringList out; m_settings->beginGroup(versionSchema()); m_settings->beginGroup("LocalSettings"); @@ -234,22 +235,19 @@ void SnoreCorePrivate::slotAboutToQuit() } } -void SnoreCorePrivate::loadTranslator(){ - auto installTranslator = [](const QString &locale) - { +void SnoreCorePrivate::loadTranslator() +{ + auto installTranslator = [](const QString & locale) { snoreDebug(SNORE_DEBUG) << locale; - if(locale != "C") { - QTranslator* translator = new QTranslator( qApp->instance() ); - if ( translator->load(locale, ":/lang/libsnore/") ) - { + if (locale != "C") { + QTranslator *translator = new QTranslator(qApp->instance()); + if (translator->load(locale, ":/lang/libsnore/")) { snoreDebug(SNORE_INFO) << "Using system locale:" << locale; - snoreDebug(SNORE_INFO) << qApp->installTranslator( translator ); - } - else - { + snoreDebug(SNORE_INFO) << qApp->installTranslator(translator); + } else { translator->deleteLater(); QString fileName = QString(":/lang/libsnore/%1.qm").arg(locale); - snoreDebug(SNORE_WARNING)<< "Failed to load translations for:" << locale << fileName << QFile::exists(fileName) ; + snoreDebug(SNORE_WARNING) << "Failed to load translations for:" << locale << fileName << QFile::exists(fileName) ; return false; } } diff --git a/src/libsnore/snore_p.h b/src/libsnore/snore_p.h index 57e1364..6514e5d 100644 --- a/src/libsnore/snore_p.h +++ b/src/libsnore/snore_p.h @@ -77,7 +77,7 @@ public: QString normalizeKey(const QString &key, SettingsType type) const { if (type == LOCAL_SETTING) { - return QString("%1/LocalSettings/%2/%3").arg(versionSchema(),m_localSettingsPrefix, key); + return QString("%1/LocalSettings/%2/%3").arg(versionSchema(), m_localSettingsPrefix, key); } else { return QString("%1/%2").arg(versionSchema(), key); } diff --git a/src/plugins/backends/snore/snorenotifier.cpp b/src/plugins/backends/snore/snorenotifier.cpp index ae94ee3..c334849 100644 --- a/src/plugins/backends/snore/snorenotifier.cpp +++ b/src/plugins/backends/snore/snorenotifier.cpp @@ -39,7 +39,7 @@ SnoreNotifier::SnoreNotifier(): SnoreNotifier::~SnoreNotifier() { - for(auto w : m_widgets) { + for (auto w : m_widgets) { w->deleteLater(); } } diff --git a/src/plugins/backends/snore/snorenotifier.h b/src/plugins/backends/snore/snorenotifier.h index 50a46a1..1de6a1d 100644 --- a/src/plugins/backends/snore/snorenotifier.h +++ b/src/plugins/backends/snore/snorenotifier.h @@ -49,7 +49,7 @@ private slots: private: QList m_queue; - QVector m_widgets; + QVector m_widgets; QTimer *m_timer; }; diff --git a/src/settings/settingswindow.h b/src/settings/settingswindow.h index d780b2d..f9323ee 100644 --- a/src/settings/settingswindow.h +++ b/src/settings/settingswindow.h @@ -3,7 +3,8 @@ #include -namespace Ui { +namespace Ui +{ class SettingsWindow; }