Skip to content

Commit

Permalink
holidays-menu-cation
Browse files Browse the repository at this point in the history
  • Loading branch information
AntonMrt committed Dec 29, 2024
1 parent 563887c commit 9eff816
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 18 deletions.
40 changes: 22 additions & 18 deletions gui/davis_gui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ DavisGUI::DavisGUI(QWidget* parent)
ui->setupUi(this);
isAboutWindowShowed = false;
m_isMinStyleWindow = false;
m_isUseCustomSkins = false;
m_skin = checkSkin();
this->setAcceptDrops(true);
QHBoxLayout* hbl = ui->horizontalLayout_menu;
Expand Down Expand Up @@ -81,10 +82,27 @@ DavisGUI::DavisGUI(QWidget* parent)
menu_matrix_view->addAction(action_surface);
menu_matrix_view->addAction(action_heatmap);

action_fitPlotToAllWindow = new QAction("Graph fit to window");
action_fitPlotToAllWindow = new QAction("Fit graph to window");
action_fitPlotToAllWindow->setCheckable(true);
menu_root->addAction(action_fitPlotToAllWindow);

action_holidaysSkins = new QAction("Holidays custom skins");
action_holidaysSkins->setCheckable(true);
menu_root->addAction(action_holidaysSkins);
connect(action_holidaysSkins, &QAction::triggered, [this]() {
m_isUseCustomSkins = action_holidaysSkins->isChecked();
Skins skin = m_skin;
m_skin = checkSkin();
if (m_skin == skin) {
return;
}
if (m_isMinStyleWindow) {
setMinStyleWindow(0);
} else {
setMaxStyleWindow(0);
}
});

mb->addMenu(menu_root);
hbl->addWidget(mb);
hbl->addItem(new QSpacerItem(2, 25, QSizePolicy::Expanding, QSizePolicy::Expanding));
Expand Down Expand Up @@ -162,20 +180,14 @@ DavisGUI::DavisGUI(QWidget* parent)
connect(this, &DavisGUI::hideProgressBar, barCool, &coolProgressBar::stopAnimation);

qpbOpen = new AnimatedButton("Open", QColor(120, 120, 120), QColor(42, 130, 218), this);
//qpbOpen->setGeometry(65, 180, 90, 30);

qpbBuffer = new AnimatedButton("Past from clipboard (Ctrl+V)",
QColor(120, 120, 120),
QColor(42, 130, 218),
this);
//qpbBuffer->setGeometry(165, 180, 170, 30);

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




// New Year
QString fileGifPath = ":/res/newYear.gif";
QMovie* movie = new QMovie(fileGifPath);
Expand Down Expand Up @@ -369,6 +381,9 @@ bool DavisGUI::mayBeShowMatrixToMatrix(QJsonArray& stamps,
}

Skins DavisGUI::checkSkin() {
if (!m_isUseCustomSkins) {
return Skins::DEFAULT;
}
Skins skin;
QDate currentDate = QDate::currentDate();
if ((currentDate.month() == 12 && currentDate.day() >= 15)
Expand Down Expand Up @@ -1031,17 +1046,6 @@ void DavisGUI::mouseMoveEvent(QMouseEvent* event) {
void DavisGUI::keyPressEvent(QKeyEvent* event) {
if (event->modifiers() == Qt::ControlModifier && event->key() == Qt::Key_V) {
pasteFromClipboard();
} else if (event->modifiers() == Qt::ControlModifier && event->key() == Qt::Key_1) {
if (m_skin == Skins::DEFAULT) {
m_skin = Skins::NEWYEAR;
} else {
m_skin = Skins::DEFAULT;
}
if (m_isMinStyleWindow) {
setMinStyleWindow(0);
} else {
setMaxStyleWindow(0);
}
} else {
QMainWindow::keyPressEvent(event);
}
Expand Down
2 changes: 2 additions & 0 deletions gui/davis_gui.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ class DavisGUI : public QMainWindow {
QAction* action_surface;
QAction* action_heatmap;
QAction* action_fitPlotToAllWindow;
QAction* action_holidaysSkins;
About_window* aboutWindow;
bool isAboutWindowShowed;
QAction* m_copy_paste_action;
Expand All @@ -86,6 +87,7 @@ class DavisGUI : public QMainWindow {
QJsonArray service_json_keys;
coolProgressBar* barCool;
QLabel* label_gif;
bool m_isUseCustomSkins;
Skins m_skin;

};
Expand Down

0 comments on commit 9eff816

Please sign in to comment.