diff --git a/sources/gui/src/mainwindow.cpp b/sources/gui/src/mainwindow.cpp
index 9a63d4f..1b88ddc 100644
--- a/sources/gui/src/mainwindow.cpp
+++ b/sources/gui/src/mainwindow.cpp
@@ -166,6 +166,7 @@ void MainWindow::createActions()
connect(ui->pushButton_mainStart, SIGNAL(clicked(bool)), this, SLOT(mainTabStartProfile()));
connect(ui->tableWidget_main, SIGNAL(itemActivated(QTableWidgetItem *)), this, SLOT(mainTabStartProfile()));
connect(ui->tableWidget_main, SIGNAL(currentItemChanged(QTableWidgetItem *, QTableWidgetItem *)), this, SLOT(mainTabRefreshButtons(QTableWidgetItem *, QTableWidgetItem *)));
+ connect(ui->tableWidget_main, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(mainTabContextualMenu(QPoint)));
// profile tab events
connect(ui->lineEdit_profile, SIGNAL(returnPressed()), this, SLOT(profileTabLoadProfile()));
@@ -308,6 +309,60 @@ void MainWindow::updateWifiTab()
// main tab slots
+void MainWindow::mainTabContextualMenu(const QPoint &pos)
+{
+ if (debug) qDebug() << "[MainWindow]" << "[mainTabContextualMenu]";
+
+ // create menu
+ QMenu menu(this);
+ QAction *refreshTable = menu.addAction(QApplication::translate("MainWindow", "Refresh"));
+ menu.addSeparator();
+ QAction *startProfile = menu.addAction(QApplication::translate("MainWindow", "Start profile"));
+ QAction *restartProfile = menu.addAction(QApplication::translate("MainWindow", "Restart profile"));
+ QAction *enableProfile = menu.addAction(QApplication::translate("MainWindow", "Enable profile"));
+ menu.addSeparator();
+ QAction *removeProfile = menu.addAction(QApplication::translate("MainWindow", "Remove profile"));
+
+ // set text
+ QString item = ui->tableWidget_main->item(ui->tableWidget_main->currentItem()->row(), 2)->text();
+ if (!checkState(QString("inactive"), item)) {
+ restartProfile->setVisible(true);
+ startProfile->setText(QApplication::translate("MainWindow", "Stop profile"));
+ }
+ else {
+ restartProfile->setVisible(false);
+ startProfile->setText(QApplication::translate("MainWindow", "Start profile"));
+ }
+ if (checkState(QString("enabled"), item))
+ enableProfile->setText(QApplication::translate("MainWindow", "Disable profile"));
+ else
+ enableProfile->setText(QApplication::translate("MainWindow", "Enable profile"));
+
+ // actions
+ QAction *action = menu.exec(ui->tableWidget_main->viewport()->mapToGlobal(pos));
+ if (action == refreshTable) {
+ if (debug) qDebug() << "[MainWindow]" << "[mainTabContextualMenu]" << "Refresh table";
+ updateMainTab();
+ }
+ else if (action == startProfile) {
+ if (debug) qDebug() << "[MainWindow]" << "[mainTabContextualMenu]" << "Start profile";
+ mainTabStartProfile();
+ }
+ else if (action == restartProfile) {
+ if (debug) qDebug() << "[MainWindow]" << "[mainTabContextualMenu]" << "Restart profile";
+ mainTabRestartProfile();
+ }
+ else if (action == enableProfile) {
+ if (debug) qDebug() << "[MainWindow]" << "[mainTabContextualMenu]" << "Enable profile";
+ mainTabEnableProfile();
+ }
+ else if (action == removeProfile) {
+ if (debug) qDebug() << "[MainWindow]" << "[mainTabContextualMenu]" << "Remove profile";
+ mainTabRemoveProfile();
+ }
+}
+
+
void MainWindow::mainTabRemoveProfile()
{
if (debug) qDebug() << "[MainWindow]" << "[mainTabRemoveProfile]";
diff --git a/sources/gui/src/mainwindow.h b/sources/gui/src/mainwindow.h
index 24a643a..062c9b1 100644
--- a/sources/gui/src/mainwindow.h
+++ b/sources/gui/src/mainwindow.h
@@ -70,6 +70,7 @@ private slots:
void updateProfileTab();
void updateWifiTab();
// main tab slots
+ void mainTabContextualMenu(const QPoint &pos);
void mainTabRemoveProfile();
void mainTabEnableProfile();
void mainTabRestartProfile();
diff --git a/sources/gui/src/mainwindow.ui b/sources/gui/src/mainwindow.ui
index 21dde8d..37aeb7b 100644
--- a/sources/gui/src/mainwindow.ui
+++ b/sources/gui/src/mainwindow.ui
@@ -6,8 +6,8 @@
0
0
- 491
- 519
+ 489
+ 517
@@ -27,6 +27,9 @@
-
+
+ Qt::CustomContextMenu
+
QAbstractItemView::NoEditTriggers
@@ -200,8 +203,8 @@
0
0
- 96
- 26
+ 457
+ 359
@@ -365,7 +368,7 @@
0
0
- 491
+ 489
22