diff --git a/resources/images/start.svg b/resources/images/start.svg
index 3618490..1fe184f 100644
--- a/resources/images/start.svg
+++ b/resources/images/start.svg
@@ -29,7 +29,7 @@
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="11.075102"
- inkscape:cx="21.164078"
+ inkscape:cx="3.8278945"
inkscape:cy="37.89422"
inkscape:document-units="mm"
inkscape:current-layer="layer1"
@@ -66,7 +66,7 @@
cx="10.16686" />
+ inkscape:transform-center-x="-2.7115727"
+ transform="matrix(1.5600283,0,0,1.2063187,-4.7701764,-58.85576)"
+ inkscape:transform-center-y="-1.4014245e-05" />
diff --git a/resources/images/stop.svg b/resources/images/stop.svg
index 4195661..69a3278 100644
--- a/resources/images/stop.svg
+++ b/resources/images/stop.svg
@@ -29,7 +29,7 @@
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="11.075102"
- inkscape:cx="21.164078"
+ inkscape:cx="3.8278945"
inkscape:cy="37.795276"
inkscape:document-units="mm"
inkscape:current-layer="g820"
@@ -61,22 +61,22 @@
+ id="g829"
+ transform="translate(-0.52916598)">
+ width="3.6904879"
+ height="14.883423"
+ x="5.2865081"
+ y="279.55829" />
+ style="fill:#800000;fill-opacity:0.86666667;stroke:none;stroke-width:0.80171472;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:normal" />
diff --git a/source/gotime/startStop_project_action.cpp b/source/gotime/startStop_project_action.cpp
index 46094ad..30b674e 100644
--- a/source/gotime/startStop_project_action.cpp
+++ b/source/gotime/startStop_project_action.cpp
@@ -18,22 +18,21 @@ StartProjectAction::StartProjectAction(Project &project, GotimeControl *control,
connect(control, SIGNAL(projectStarted(const Project &)),
this, SLOT(projectStarted(const Project &)));
+
connect(control, SIGNAL(projectStopped(const Project &)),
this, SLOT(projectStopped(const Project &)));
-// connect(control, SIGNAL(projectCancelled(const Project &)),
-// this, SLOT(projectStopped(const Project &)));
}
void StartProjectAction::projectStarted(const Project &project) {
if (project.getID() == _project.getID()) {
- this->setText("Stop: " + project.getName());
+ this->setText(project.getName());
this->setIcon(QIcon(":/images/stop.svg"));
}
}
void StartProjectAction::projectStopped(const Project &project) {
if (project.getID() == _project.getID()) {
- this->setText("Start: " + project.getName());
+ this->setText(project.getName());
this->setIcon(QIcon(":/images/start.svg"));
}
}
diff --git a/source/gotime_tray_icon.cpp b/source/gotime_tray_icon.cpp
index c60b366..147f15b 100644
--- a/source/gotime_tray_icon.cpp
+++ b/source/gotime_tray_icon.cpp
@@ -13,20 +13,21 @@ GotimeTrayIcon::GotimeTrayIcon(GotimeControl *control, QMainWindow *mainWindow)
loadIcons();
_menu = new QMenu();
- _menu->addSection(tr("Projects"));
- _separatorAction = _menu->addSeparator();
- _separatorAction->setText("Actions");
+ _stopTaskAction = new QAction("Stop active project...");
+ _stopTaskAction->setToolTip("Stop the current project and record data.");
+ connect(_stopTaskAction, SIGNAL(triggered()), control, SLOT(stopActivity()));
+ _menu->addAction(_stopTaskAction);
- QAction *stopAction = new QAction("Stop timer...");
- connect(stopAction, SIGNAL(triggered()), control, SLOT(stopActivity()));
- _menu->addAction(stopAction);
+ _cancelTaskAction = new QAction("Cancel active project...");
+ _cancelTaskAction->setToolTip("Stop the active project without recording new data.");
+ connect(_cancelTaskAction, SIGNAL(triggered()), control, SLOT(cancelActivity()));
+ _menu->addAction(_cancelTaskAction);
- QAction *cancelAction = new QAction("Cancel timer...");
- connect(cancelAction, SIGNAL(triggered()), control, SLOT(cancelActivity()));
- _menu->addAction(cancelAction);
+ _menu->addSection(tr("Projects"));
- _menu->addSeparator();
+ _separatorAction = _menu->addSeparator();
+ _separatorAction->setText("Actions");
QAction *showWindowAction = new QAction("&Show window", this);
connect(showWindowAction, &QAction::triggered, mainWindow, &QMainWindow::show);
_menu->addAction(showWindowAction);
@@ -57,7 +58,6 @@ GotimeTrayIcon::GotimeTrayIcon(GotimeControl *control, QMainWindow *mainWindow)
projectStarted(project);
} else {
-
projectStopped(project);
}
}
@@ -90,7 +90,6 @@ void GotimeTrayIcon::updateStatus() {
void GotimeTrayIcon::loadIcons() {
_stoppedIcon = QPixmap(":/images/trayicon-stopped.svg");
-
_activeIcons << QPixmap(":/images/trayicon-1.svg");
_activeIcons << QPixmap(":/images/trayicon-2.svg");
_activeIcons << QPixmap(":/images/trayicon-3.svg");
@@ -108,6 +107,12 @@ void GotimeTrayIcon::projectStarted(const Project &) {
if (!_statusUpdateTimer->isActive()) {
_statusUpdateTimer->start(2500);
}
+
+ _stopTaskAction->setEnabled(true);
+ _cancelTaskAction->setEnabled(true);
+
+ updateStatus();
+ updateProjects();
}
void GotimeTrayIcon::projectStopped(const Project &) {
@@ -115,6 +120,12 @@ void GotimeTrayIcon::projectStopped(const Project &) {
_iconTimer->stop();
_statusUpdateTimer->stop();
+
+ _stopTaskAction->setEnabled(false);
+ _cancelTaskAction->setEnabled(false);
+
+ updateStatus();
+ updateProjects();
}
void GotimeTrayIcon::updateIcon() {
diff --git a/source/gotime_tray_icon.h b/source/gotime_tray_icon.h
index 205db6d..297fd9a 100644
--- a/source/gotime_tray_icon.h
+++ b/source/gotime_tray_icon.h
@@ -34,6 +34,8 @@ private slots:
GotimeControl *_control;
QSystemTrayIcon *_trayIcon;
QList _projectActions;
+ QAction *_stopTaskAction;
+ QAction *_cancelTaskAction;
QAction *_separatorAction;
int _activeIconIndex;