From 942be5a42edd3b472d8c5e8a777d59bea62fe819 Mon Sep 17 00:00:00 2001 From: 0xFEEDC0DE <0xfeedc0de64@gmail.com> Date: Sun, 11 Mar 2018 13:39:38 +0100 Subject: [PATCH] Added WeatherSettings --- plugins/weatherplugin/weatherplugin.cpp | 6 ++++++ plugins/weatherplugin/weatherplugin.h | 2 ++ plugins/weatherplugin/weatherplugin.pro | 2 ++ plugins/weatherplugin/weathersettings.cpp | 20 ++++++++++++++++++++ plugins/weatherplugin/weathersettings.h | 18 ++++++++++++++++++ zeiterfassungguilib/settingswidget.h | 2 +- 6 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 plugins/weatherplugin/weathersettings.cpp create mode 100644 plugins/weatherplugin/weathersettings.h diff --git a/plugins/weatherplugin/weatherplugin.cpp b/plugins/weatherplugin/weatherplugin.cpp index b308b11..35842f3 100644 --- a/plugins/weatherplugin/weatherplugin.cpp +++ b/plugins/weatherplugin/weatherplugin.cpp @@ -9,6 +9,7 @@ #include "mainwindow.h" #include "weatherwidget.h" +#include "weathersettings.h" WeatherPlugin::WeatherPlugin(QObject *parent) : ZeiterfassungPlugin(parent) @@ -34,3 +35,8 @@ void WeatherPlugin::attachTo(MainWindow &mainWindow) { mainWindow.statusBar()->addWidget(new WeatherWidget(mainWindow)); } + +SettingsWidget *WeatherPlugin::settingsWidget(QWidget *parent) +{ + return new WeatherSettings(parent); +} diff --git a/plugins/weatherplugin/weatherplugin.h b/plugins/weatherplugin/weatherplugin.h index 07f4f68..f9d7b79 100644 --- a/plugins/weatherplugin/weatherplugin.h +++ b/plugins/weatherplugin/weatherplugin.h @@ -17,6 +17,8 @@ public: // ZeiterfassungPlugin interface void attachTo(MainWindow &mainWindow) Q_DECL_OVERRIDE; + SettingsWidget *settingsWidget(QWidget *parent = Q_NULLPTR) Q_DECL_OVERRIDE; + private: QTranslator m_translator; }; diff --git a/plugins/weatherplugin/weatherplugin.pro b/plugins/weatherplugin/weatherplugin.pro index 02016bc..398a0a2 100644 --- a/plugins/weatherplugin/weatherplugin.pro +++ b/plugins/weatherplugin/weatherplugin.pro @@ -17,9 +17,11 @@ DEPENDPATH += $$PWD/$${PROJECT_ROOT}/zeiterfassungcorelib $$PWD/$${PROJECT_ROOT} DEFINES += QT_DEPRECATED_WARNINGS QT_DISABLE_DEPRECATED_BEFORE=0x060000 QT_MESSAGELOGCONTEXT HEADERS += weatherplugin.h \ + weathersettings.h \ weatherwidget.h SOURCES += weatherplugin.cpp \ + weathersettings.cpp \ weatherwidget.cpp FORMS += diff --git a/plugins/weatherplugin/weathersettings.cpp b/plugins/weatherplugin/weathersettings.cpp new file mode 100644 index 0000000..946ac68 --- /dev/null +++ b/plugins/weatherplugin/weathersettings.cpp @@ -0,0 +1,20 @@ +#include "weathersettings.h" + +#include +#include +#include + +WeatherSettings::WeatherSettings(QWidget *parent) : + SettingsWidget(parent) +{ + auto layout = new QFormLayout(this); + + layout->addRow(tr("Weather API:"), new QLineEdit(this)); + + setLayout(layout); +} + +void WeatherSettings::apply() +{ + qDebug() << "called"; +} diff --git a/plugins/weatherplugin/weathersettings.h b/plugins/weatherplugin/weathersettings.h new file mode 100644 index 0000000..e65e53c --- /dev/null +++ b/plugins/weatherplugin/weathersettings.h @@ -0,0 +1,18 @@ +#ifndef WEATHERSETTINGS_H +#define WEATHERSETTINGS_H + +#include + +#include "settingswidget.h" + +class WeatherSettings : public SettingsWidget +{ + Q_OBJECT +public: + explicit WeatherSettings(QWidget *parent = Q_NULLPTR); + +public Q_SLOTS: + void apply() Q_DECL_OVERRIDE; +}; + +#endif // WEATHERSETTINGS_H diff --git a/zeiterfassungguilib/settingswidget.h b/zeiterfassungguilib/settingswidget.h index d1d7a40..dc3dd6b 100644 --- a/zeiterfassungguilib/settingswidget.h +++ b/zeiterfassungguilib/settingswidget.h @@ -10,7 +10,7 @@ class ZEITERFASSUNGGUILIBSHARED_EXPORT SettingsWidget : public QWidget { Q_OBJECT public: - explicit SettingsWidget(QWidget *parent = nullptr); + explicit SettingsWidget(QWidget *parent = Q_NULLPTR); public Q_SLOTS: virtual void apply() { }