-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathslots.cpp
85 lines (64 loc) · 2.25 KB
/
slots.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include "saveconfig.h"
void MainWindow::enableCheckboxClicked()
{
bool checked = ui->enableConfigCheckbox->isChecked();
ui->mainStackedWidget->setEnabled(checked);
this->enableSaveButtons(true);
this->config->enable(checked);
}
void MainWindow::themeRadioButtonClicked(){
QRadioButton * themeRadioButton = (QRadioButton *)sender();
QString theme = themeRadioButton->objectName();
if(theme == "darkThemeRadioButton"){
this->config->setTheme(DARK_THEME_CODE);
ui->lightThemeRadioButton->setChecked(false);
}
else {
this->config->setTheme(LIGHT_THEME_CODE);
ui->darkThemeRadioButton->setChecked(false);
}
themeRadioButton->setChecked(true);
updateWalColorPalette();
enableSaveButtons(true);
}
void MainWindow::colorClicked(){
QPushButton * colorLabel = (QPushButton *)sender();
QString name = colorLabel->objectName();
config->setAccentColorCode(name);
enableSaveButtons(true);
QStringList colors = walColors->getColors();
QString index = colorLabel->text();
setPlasmaAccentColor(colors[index.toInt()]);
ui->accentColorLabel->setText(QString(ACCENT_COLOR_LABEL) + ": " + this->config->getAccentColorCode());
copyToClipboard(colors[index.toInt()]);
}
void MainWindow::backendRadioButtonClicked(){
QRadioButton * button = (QRadioButton *)sender();
button->setChecked(true);
this->config->setBackEnd(button->text());
updateWalColorPalette();
enableSaveButtons(true);
}
void MainWindow::saveButtonClicked()
{
// create a file with the configuration set by the user and save it to default location
SaveConfig save(this, config);
save.saveConfig("");
ui->saveButton->setDisabled(true);
}
void MainWindow::saveAsButtonClicked()
{
// create a file with the configuration set by the user and save it to user selected location
QString fileName = QFileDialog::getSaveFileName(this, "Save as", QDir::homePath(), "Config files(*.conf)");
SaveConfig save(this, config);
save.saveConfig(fileName);
ui->saveButton->setDisabled(true);
ui->saveAsButton->setDisabled(true);
}
void MainWindow::cancelButtonClicked()
{
// quit the application
QApplication::quit();
}