normalized behaviour click trayIcon w/ wndow open + lim compose call
This commit is contained in:
parent
16604277fb
commit
4f3f8b3e56
2 changed files with 23 additions and 8 deletions
|
|
@ -679,7 +679,7 @@ void MainWindow::customEvent(QEvent* ev) {
|
||||||
this->addEndpointWidget((CustomWidgetEvent<EndpointHandler*>*)ev);
|
this->addEndpointWidget((CustomWidgetEvent<EndpointHandler*>*)ev);
|
||||||
} else if (ev->type() == (QEvent::Type)CustomQEvent::RecomposeMainWindow) {
|
} else if (ev->type() == (QEvent::Type)CustomQEvent::RecomposeMainWindow) {
|
||||||
ev->setAccepted(true);
|
ev->setAccepted(true);
|
||||||
this->compose();
|
if (this->isVisible()) this->compose();
|
||||||
}
|
}
|
||||||
QMainWindow::customEvent(ev);
|
QMainWindow::customEvent(ev);
|
||||||
}
|
}
|
||||||
|
|
@ -863,9 +863,6 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) {
|
||||||
//setAttribute(Qt::WA_TranslucentBackground);
|
//setAttribute(Qt::WA_TranslucentBackground);
|
||||||
//setStyleSheet("background-color: rgba(255,182,193,60%);");
|
//setStyleSheet("background-color: rgba(255,182,193,60%);");
|
||||||
setWindowTitle(STRING_TITLE);
|
setWindowTitle(STRING_TITLE);
|
||||||
connect(qApp, &QGuiApplication::applicationStateChanged, this, [=](Qt::ApplicationState state){
|
|
||||||
if(state == Qt::ApplicationState::ApplicationInactive) hide();
|
|
||||||
});
|
|
||||||
/*
|
/*
|
||||||
* Registering needed custom events
|
* Registering needed custom events
|
||||||
*/
|
*/
|
||||||
|
|
@ -880,6 +877,7 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) {
|
||||||
/* This spacer provides proper spacing when window vertically > widgets. */
|
/* This spacer provides proper spacing when window vertically > widgets. */
|
||||||
lastRowSpacer = new QSpacerItem(1, 1, QSizePolicy::Minimum, QSizePolicy::MinimumExpanding);
|
lastRowSpacer = new QSpacerItem(1, 1, QSizePolicy::Minimum, QSizePolicy::MinimumExpanding);
|
||||||
ewsUpdateTimer = new QTimer(this);
|
ewsUpdateTimer = new QTimer(this);
|
||||||
|
recentlyClosedTimer = new QTimer(this);
|
||||||
widget = new QWidget();
|
widget = new QWidget();
|
||||||
widgetLayout = new QGridLayout();
|
widgetLayout = new QGridLayout();
|
||||||
trayIcon = new QSystemTrayIcon();
|
trayIcon = new QSystemTrayIcon();
|
||||||
|
|
@ -890,6 +888,10 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) {
|
||||||
ewsUpdateTimer->setSingleShot(true);
|
ewsUpdateTimer->setSingleShot(true);
|
||||||
ewsUpdateTimer->setInterval(ewsUpdateTimerFrequency);
|
ewsUpdateTimer->setInterval(ewsUpdateTimerFrequency);
|
||||||
connect(ewsUpdateTimer, &QTimer::timeout, this, &MainWindow::reorderEndpointWidgetCollection);
|
connect(ewsUpdateTimer, &QTimer::timeout, this, &MainWindow::reorderEndpointWidgetCollection);
|
||||||
|
|
||||||
|
recentlyClosedTimer->setSingleShot(true);
|
||||||
|
recentlyClosedTimer->setInterval(recentlyClosedTimerFrequency);
|
||||||
|
connect(recentlyClosedTimer, &QTimer::timeout, this, [=]() { this->recentlyClosed = false; });
|
||||||
//widget->setMinimumSize(QSize(300,300));
|
//widget->setMinimumSize(QSize(300,300));
|
||||||
//widget->setLayout(widgetLayout);
|
//widget->setLayout(widgetLayout);
|
||||||
/*
|
/*
|
||||||
|
|
@ -936,7 +938,14 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) {
|
||||||
trayIcon->setToolTip(STRING_TITLE);
|
trayIcon->setToolTip(STRING_TITLE);
|
||||||
trayIcon->setContextMenu(trayIconMenu);
|
trayIcon->setContextMenu(trayIconMenu);
|
||||||
connect(trayIcon, &QSystemTrayIcon::activated, this, &MainWindow::trayIconActivated);
|
connect(trayIcon, &QSystemTrayIcon::activated, this, &MainWindow::trayIconActivated);
|
||||||
|
connect(qApp, &QGuiApplication::applicationStateChanged, this, [=](Qt::ApplicationState state){
|
||||||
|
if(state == Qt::ApplicationState::ApplicationInactive) {
|
||||||
|
this->hide();
|
||||||
|
//This recentlyClosed... kinda campy.
|
||||||
|
this->recentlyClosed = true;
|
||||||
|
this->recentlyClosedTimer->start();
|
||||||
|
}
|
||||||
|
});
|
||||||
/*
|
/*
|
||||||
* Set of function callback definitons for EndpointSituationCallback
|
* Set of function callback definitons for EndpointSituationCallback
|
||||||
*/
|
*/
|
||||||
|
|
@ -1034,9 +1043,12 @@ void MainWindow::closeEvent(QCloseEvent *event) {
|
||||||
void MainWindow::trayIconActivated(QSystemTrayIcon::ActivationReason reason) {
|
void MainWindow::trayIconActivated(QSystemTrayIcon::ActivationReason reason) {
|
||||||
switch (reason) {
|
switch (reason) {
|
||||||
case QSystemTrayIcon::Trigger:
|
case QSystemTrayIcon::Trigger:
|
||||||
this->compose();
|
if (!this->isVisible() && !recentlyClosed) {
|
||||||
this->showNormal();
|
log_to_file("Recently Closed: %d \n", recentlyClosed);
|
||||||
this->activateWindow();
|
this->compose();
|
||||||
|
this->showNormal();
|
||||||
|
this->activateWindow();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -261,6 +261,9 @@ private:
|
||||||
QTimer *ewsUpdateTimer;
|
QTimer *ewsUpdateTimer;
|
||||||
static constexpr uint64_t ewsUpdateTimerFrequency = 500;
|
static constexpr uint64_t ewsUpdateTimerFrequency = 500;
|
||||||
double widthRatio = 0.28;
|
double widthRatio = 0.28;
|
||||||
|
bool recentlyClosed = false;
|
||||||
|
uint8_t recentlyClosedTimerFrequency = 1000;
|
||||||
|
QTimer *recentlyClosedTimer;
|
||||||
|
|
||||||
QScrollArea *scrollArea;
|
QScrollArea *scrollArea;
|
||||||
HeaderWidget* hw;
|
HeaderWidget* hw;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue