Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix naming #347

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions config/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
project(lxqt-config-notificationd)

set(NOTIFICATIONS_CONF_SRC
advancedsettings.cpp
basicsettings.cpp
generalsettings.cpp
appearancesettings.cpp
mainwindow.cpp
main.cpp
)

set(NOTIFICATIONS_CONF_UI
advancedsettings.ui
basicsettings.ui
generalsettings.ui
appearancesettings.ui
)


Expand Down
30 changes: 15 additions & 15 deletions config/basicsettings.cpp → config/appearancesettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,28 +29,28 @@

#include <LXQt/Notification>

#include "basicsettings.h"
#include "appearancesettings.h"
#include "mainwindow.h"


BasicSettings::BasicSettings(LXQt::Settings* settings, QWidget *parent) :
AppearanceSettings::AppearanceSettings(LXQt::Settings* settings, QWidget *parent) :
QWidget(parent),
mSettings(settings)
{
setupUi(this);

restoreSettings();

connect(topLeftRB, &QRadioButton::clicked, this, &BasicSettings::updateNotification);
connect(topCenterRB, &QRadioButton::clicked, this, &BasicSettings::updateNotification);
connect(topRightRB, &QRadioButton::clicked, this, &BasicSettings::updateNotification);
connect(centerLeftRB, &QRadioButton::clicked, this, &BasicSettings::updateNotification);
connect(centerRightRB, &QRadioButton::clicked, this, &BasicSettings::updateNotification);
connect(bottomLeftRB, &QRadioButton::clicked, this, &BasicSettings::updateNotification);
connect(bottomCenterRB, &QRadioButton::clicked, this, &BasicSettings::updateNotification);
connect(bottomRightRB, &QRadioButton::clicked, this, &BasicSettings::updateNotification);
connect(topLeftRB, &QRadioButton::clicked, this, &AppearanceSettings::updateNotification);
connect(topCenterRB, &QRadioButton::clicked, this, &AppearanceSettings::updateNotification);
connect(topRightRB, &QRadioButton::clicked, this, &AppearanceSettings::updateNotification);
connect(centerLeftRB, &QRadioButton::clicked, this, &AppearanceSettings::updateNotification);
connect(centerRightRB, &QRadioButton::clicked, this, &AppearanceSettings::updateNotification);
connect(bottomLeftRB, &QRadioButton::clicked, this, &AppearanceSettings::updateNotification);
connect(bottomCenterRB, &QRadioButton::clicked, this, &AppearanceSettings::updateNotification);
connect(bottomRightRB, &QRadioButton::clicked, this, &AppearanceSettings::updateNotification);

connect(previewButton, &QAbstractButton::clicked, this, &BasicSettings::previewNotification);
connect(previewButton, &QAbstractButton::clicked, this, &AppearanceSettings::previewNotification);

LXQt::Notification *serverTest = new LXQt::Notification(QString(), this);
serverTest->queryServerInfo();
Expand Down Expand Up @@ -82,9 +82,9 @@ BasicSettings::BasicSettings(LXQt::Settings* settings, QWidget *parent) :
});
}

BasicSettings::~BasicSettings() = default;
AppearanceSettings::~AppearanceSettings() = default;

void BasicSettings::restoreSettings()
void AppearanceSettings::restoreSettings()
{
QString placement = mSettings->value(QL1S("placement"),
QL1S("bottom-right")).toString().toLower();
Expand All @@ -107,7 +107,7 @@ void BasicSettings::restoreSettings()
bottomRightRB->setChecked(true);
}

void BasicSettings::updateNotification()
void AppearanceSettings::updateNotification()
{
QString align;
if (topLeftRB->isChecked())
Expand All @@ -130,7 +130,7 @@ void BasicSettings::updateNotification()
mSettings->setValue(QL1S("placement"), align);
}

void BasicSettings::previewNotification()
void AppearanceSettings::previewNotification()
{
QString str;
if (topLeftRB->isChecked())
Expand Down
14 changes: 7 additions & 7 deletions config/basicsettings.h → config/appearancesettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,20 @@
*
* END_COMMON_COPYRIGHT_HEADER */

#ifndef BASICSETTINGS_H
#define BASICSETTINGS_H
#ifndef APPEARANCESETTINGS_H
#define APPEARANCESETTINGS_H

#include <LXQt/Settings>
#include <QWidget>
#include "ui_basicsettings.h"
#include "ui_appearancesettings.h"


class BasicSettings : public QWidget, public Ui::BasicSettings
class AppearanceSettings : public QWidget, public Ui::AppearanceSettings
{
Q_OBJECT
public:
explicit BasicSettings(LXQt::Settings* settings, QWidget* parent = nullptr);
~BasicSettings();
explicit AppearanceSettings(LXQt::Settings* settings, QWidget* parent = nullptr);
~AppearanceSettings();

public slots:
void restoreSettings();
Expand All @@ -51,4 +51,4 @@ private slots:
LXQt::Settings* mSettings;
};

#endif // BASICSETTINGS_H
#endif // APPEARANCESETTINGS_H
2 changes: 1 addition & 1 deletion config/basicsettings.ui → config/appearancesettings.ui
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>BasicSettings</class>
<class>AppearanceSettings</class>
<widget class="QWidget" name="BasicSettings">
<property name="geometry">
<rect>
Expand Down
24 changes: 12 additions & 12 deletions config/advancedsettings.cpp → config/generalsettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,29 +27,29 @@

#include <QFileDialog>

#include "advancedsettings.h"
#include "generalsettings.h"
#include "mainwindow.h"


AdvancedSettings::AdvancedSettings(LXQt::Settings* settings, QWidget *parent):
GeneralSettings::GeneralSettings(LXQt::Settings* settings, QWidget *parent):
QWidget(parent),
mSettings(settings)
{
setupUi(this);
restoreSettings();

connect(serverDecidesBox, QOverload<int>::of(&QSpinBox::valueChanged), this, &AdvancedSettings::save);
connect(spacingBox, QOverload<int>::of(&QSpinBox::valueChanged), this, &AdvancedSettings::save);
connect(widthBox, QOverload<int>::of(&QSpinBox::valueChanged), this, &AdvancedSettings::save);
connect(unattendedBox, QOverload<int>::of(&QSpinBox::valueChanged), this, &AdvancedSettings::save);
connect(blackListEdit, &QLineEdit::editingFinished, this, &AdvancedSettings::save);
connect(doNotDisturbBtn, &QCheckBox::clicked, this, &AdvancedSettings::save);
connect(screenWithMouseBtn, &QCheckBox::clicked, this, &AdvancedSettings::save);
connect(serverDecidesBox, QOverload<int>::of(&QSpinBox::valueChanged), this, &GeneralSettings::save);
connect(spacingBox, QOverload<int>::of(&QSpinBox::valueChanged), this, &GeneralSettings::save);
connect(widthBox, QOverload<int>::of(&QSpinBox::valueChanged), this, &GeneralSettings::save);
connect(unattendedBox, QOverload<int>::of(&QSpinBox::valueChanged), this, &GeneralSettings::save);
connect(blackListEdit, &QLineEdit::editingFinished, this, &GeneralSettings::save);
connect(doNotDisturbBtn, &QCheckBox::clicked, this, &GeneralSettings::save);
connect(screenWithMouseBtn, &QCheckBox::clicked, this, &GeneralSettings::save);
}

AdvancedSettings::~AdvancedSettings() = default;
GeneralSettings::~GeneralSettings() = default;

void AdvancedSettings::restoreSettings()
void GeneralSettings::restoreSettings()
{
int serverDecides = mSettings->value(QL1S("server_decides"), 10).toInt();
if (serverDecides <= 0)
Expand All @@ -68,7 +68,7 @@ void AdvancedSettings::restoreSettings()
screenWithMouseBtn->setChecked(mSettings->value(QL1S("screenWithMouse"), false).toBool());
}

void AdvancedSettings::save()
void GeneralSettings::save()
{
mSettings->setValue(QL1S("server_decides"), serverDecidesBox->value());
mSettings->setValue(QL1S("spacing"), spacingBox->value());
Expand Down
12 changes: 6 additions & 6 deletions config/advancedsettings.h → config/generalsettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,20 @@
*
* END_COMMON_COPYRIGHT_HEADER */

#ifndef ADVANCEDSETTINGS_H
#define ADVANCEDSETTINGS_H
#ifndef GENERALSETTINGS_H
#define GENERALSETTINGS_H

#include <LXQt/Settings>
#include <QWidget>
#include "ui_advancedsettings.h"
#include "ui_generalsettings.h"

class AdvancedSettings : public QWidget, public Ui::AdvancedSettings
class GeneralSettings : public QWidget, public Ui::GeneralSettings
{
Q_OBJECT

public:
explicit AdvancedSettings(LXQt::Settings* settings, QWidget* parent = nullptr);
~AdvancedSettings();
explicit GeneralSettings(LXQt::Settings* settings, QWidget* parent = nullptr);
~GeneralSettings();

public slots:
void restoreSettings();
Expand Down
2 changes: 1 addition & 1 deletion config/advancedsettings.ui → config/generalsettings.ui
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>AdvancedSettings</class>
<class>GeneralSettings</class>
<widget class="QWidget" name="AdvancedSettings">
<property name="geometry">
<rect>
Expand Down
14 changes: 7 additions & 7 deletions config/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,20 +33,20 @@
#include <LXQt/ConfigDialog>

#include "mainwindow.h"
#include "basicsettings.h"
#include "advancedsettings.h"
#include "generalsettings.h"
#include "appearancesettings.h"


MainWindow::MainWindow(QWidget *parent) :
LXQt::ConfigDialog(tr("Desktop Notifications"), new LXQt::Settings(QSL("notifications")), parent)
{
AdvancedSettings* menu = new AdvancedSettings(mSettings, this);
GeneralSettings* menu = new GeneralSettings(mSettings, this);
addPage(menu, tr("General Settings"), QSL("preferences-desktop-notification-bell"));
connect(this, &MainWindow::reset, menu, &AdvancedSettings::restoreSettings);
connect(this, &MainWindow::reset, menu, &GeneralSettings::restoreSettings);

BasicSettings* basic = new BasicSettings(mSettings, this);
addPage(basic, tr("Position"), QSL("preferences-desktop-notification"));
connect(this, &MainWindow::reset, basic, &BasicSettings::restoreSettings);
AppearanceSettings* Appearance = new AppearanceSettings(mSettings, this);
addPage(Appearance, tr("Position"), QSL("preferences-desktop-notification"));
connect(this, &MainWindow::reset, Appearance, &AppearanceSettings::restoreSettings);
}

MainWindow::~MainWindow()
Expand Down
Loading