add status to tray menu
parent
cdf4ba8c90
commit
e47f09ec9c
|
@ -243,6 +243,18 @@ void Window::createActions()
|
||||||
|
|
||||||
stopAction = new QAction(tr("Stop"), this);
|
stopAction = new QAction(tr("Stop"), this);
|
||||||
connect(stopAction, &QAction::triggered, this, &Window::stopMinikube);
|
connect(stopAction, &QAction::triggered, this, &Window::stopMinikube);
|
||||||
|
|
||||||
|
statusAction = new QAction(tr("Status:"), this);
|
||||||
|
statusAction->setEnabled(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Window::updateStatus(Cluster cluster)
|
||||||
|
{
|
||||||
|
QString status = cluster.status();
|
||||||
|
if (status.isEmpty()) {
|
||||||
|
status = "Stopped";
|
||||||
|
}
|
||||||
|
statusAction->setText("Status: " + status);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Window::restoreWindow()
|
void Window::restoreWindow()
|
||||||
|
@ -264,6 +276,8 @@ static QString minikubePath()
|
||||||
void Window::createTrayIcon()
|
void Window::createTrayIcon()
|
||||||
{
|
{
|
||||||
trayIconMenu = new QMenu(this);
|
trayIconMenu = new QMenu(this);
|
||||||
|
trayIconMenu->addAction(statusAction);
|
||||||
|
trayIconMenu->addSeparator();
|
||||||
trayIconMenu->addAction(startAction);
|
trayIconMenu->addAction(startAction);
|
||||||
trayIconMenu->addAction(pauseAction);
|
trayIconMenu->addAction(pauseAction);
|
||||||
trayIconMenu->addAction(stopAction);
|
trayIconMenu->addAction(stopAction);
|
||||||
|
@ -502,6 +516,7 @@ void Window::updateButtons()
|
||||||
updateAdvancedButtons(cluster);
|
updateAdvancedButtons(cluster);
|
||||||
}
|
}
|
||||||
updateTrayActions(cluster);
|
updateTrayActions(cluster);
|
||||||
|
updateStatus(cluster);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Window::updateTrayActions(Cluster cluster)
|
void Window::updateTrayActions(Cluster cluster)
|
||||||
|
|
|
@ -102,6 +102,7 @@ private:
|
||||||
// Tray icon
|
// Tray icon
|
||||||
void createTrayIcon();
|
void createTrayIcon();
|
||||||
void createActions();
|
void createActions();
|
||||||
|
void updateStatus(Cluster cluster);
|
||||||
void updateTrayActions(Cluster cluster);
|
void updateTrayActions(Cluster cluster);
|
||||||
QAction *minimizeAction;
|
QAction *minimizeAction;
|
||||||
QAction *restoreAction;
|
QAction *restoreAction;
|
||||||
|
@ -109,6 +110,7 @@ private:
|
||||||
QAction *startAction;
|
QAction *startAction;
|
||||||
QAction *pauseAction;
|
QAction *pauseAction;
|
||||||
QAction *stopAction;
|
QAction *stopAction;
|
||||||
|
QAction *statusAction;
|
||||||
QSystemTrayIcon *trayIcon;
|
QSystemTrayIcon *trayIcon;
|
||||||
QMenu *trayIconMenu;
|
QMenu *trayIconMenu;
|
||||||
QIcon *trayIconIcon;
|
QIcon *trayIconIcon;
|
||||||
|
|
Loading…
Reference in New Issue