Skip to content

Commit 9eff816

Browse files
committed
holidays-menu-cation
1 parent 563887c commit 9eff816

File tree

2 files changed

+24
-18
lines changed

2 files changed

+24
-18
lines changed

gui/davis_gui.cpp

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ DavisGUI::DavisGUI(QWidget* parent)
4040
ui->setupUi(this);
4141
isAboutWindowShowed = false;
4242
m_isMinStyleWindow = false;
43+
m_isUseCustomSkins = false;
4344
m_skin = checkSkin();
4445
this->setAcceptDrops(true);
4546
QHBoxLayout* hbl = ui->horizontalLayout_menu;
@@ -81,10 +82,27 @@ DavisGUI::DavisGUI(QWidget* parent)
8182
menu_matrix_view->addAction(action_surface);
8283
menu_matrix_view->addAction(action_heatmap);
8384

84-
action_fitPlotToAllWindow = new QAction("Graph fit to window");
85+
action_fitPlotToAllWindow = new QAction("Fit graph to window");
8586
action_fitPlotToAllWindow->setCheckable(true);
8687
menu_root->addAction(action_fitPlotToAllWindow);
8788

89+
action_holidaysSkins = new QAction("Holidays custom skins");
90+
action_holidaysSkins->setCheckable(true);
91+
menu_root->addAction(action_holidaysSkins);
92+
connect(action_holidaysSkins, &QAction::triggered, [this]() {
93+
m_isUseCustomSkins = action_holidaysSkins->isChecked();
94+
Skins skin = m_skin;
95+
m_skin = checkSkin();
96+
if (m_skin == skin) {
97+
return;
98+
}
99+
if (m_isMinStyleWindow) {
100+
setMinStyleWindow(0);
101+
} else {
102+
setMaxStyleWindow(0);
103+
}
104+
});
105+
88106
mb->addMenu(menu_root);
89107
hbl->addWidget(mb);
90108
hbl->addItem(new QSpacerItem(2, 25, QSizePolicy::Expanding, QSizePolicy::Expanding));
@@ -162,20 +180,14 @@ DavisGUI::DavisGUI(QWidget* parent)
162180
connect(this, &DavisGUI::hideProgressBar, barCool, &coolProgressBar::stopAnimation);
163181

164182
qpbOpen = new AnimatedButton("Open", QColor(120, 120, 120), QColor(42, 130, 218), this);
165-
//qpbOpen->setGeometry(65, 180, 90, 30);
166-
167183
qpbBuffer = new AnimatedButton("Past from clipboard (Ctrl+V)",
168184
QColor(120, 120, 120),
169185
QColor(42, 130, 218),
170186
this);
171-
//qpbBuffer->setGeometry(165, 180, 170, 30);
172187

173188
connect(qpbOpen, &QPushButton::released, this, &DavisGUI::selectAndShowFiles);
174189
connect(qpbBuffer, &QPushButton::released, this, &DavisGUI::pasteFromClipboard);
175190

176-
177-
178-
179191
// New Year
180192
QString fileGifPath = ":/res/newYear.gif";
181193
QMovie* movie = new QMovie(fileGifPath);
@@ -369,6 +381,9 @@ bool DavisGUI::mayBeShowMatrixToMatrix(QJsonArray& stamps,
369381
}
370382

371383
Skins DavisGUI::checkSkin() {
384+
if (!m_isUseCustomSkins) {
385+
return Skins::DEFAULT;
386+
}
372387
Skins skin;
373388
QDate currentDate = QDate::currentDate();
374389
if ((currentDate.month() == 12 && currentDate.day() >= 15)
@@ -1031,17 +1046,6 @@ void DavisGUI::mouseMoveEvent(QMouseEvent* event) {
10311046
void DavisGUI::keyPressEvent(QKeyEvent* event) {
10321047
if (event->modifiers() == Qt::ControlModifier && event->key() == Qt::Key_V) {
10331048
pasteFromClipboard();
1034-
} else if (event->modifiers() == Qt::ControlModifier && event->key() == Qt::Key_1) {
1035-
if (m_skin == Skins::DEFAULT) {
1036-
m_skin = Skins::NEWYEAR;
1037-
} else {
1038-
m_skin = Skins::DEFAULT;
1039-
}
1040-
if (m_isMinStyleWindow) {
1041-
setMinStyleWindow(0);
1042-
} else {
1043-
setMaxStyleWindow(0);
1044-
}
10451049
} else {
10461050
QMainWindow::keyPressEvent(event);
10471051
}

gui/davis_gui.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ class DavisGUI : public QMainWindow {
7676
QAction* action_surface;
7777
QAction* action_heatmap;
7878
QAction* action_fitPlotToAllWindow;
79+
QAction* action_holidaysSkins;
7980
About_window* aboutWindow;
8081
bool isAboutWindowShowed;
8182
QAction* m_copy_paste_action;
@@ -86,6 +87,7 @@ class DavisGUI : public QMainWindow {
8687
QJsonArray service_json_keys;
8788
coolProgressBar* barCool;
8889
QLabel* label_gif;
90+
bool m_isUseCustomSkins;
8991
Skins m_skin;
9092

9193
};

0 commit comments

Comments
 (0)