mirror of
https://github.com/arcan1s/netctl-gui.git
synced 2026-10-18 11:18:05 +00:00
end of refactoring
This commit is contained in:
1 parent
3fb847a7b6
commit
7660deb787
5 files changed
+25
-30
No files matched your search
@@ -9,12 +9,15 @@ Ver.1.2.0:
|
|||||||
+ [gui] added clear() function to profileTab
|
+ [gui] added clear() function to profileTab
|
||||||
+ [gui] added support of netctl-auto
|
+ [gui] added support of netctl-auto
|
||||||
+ [lib] detached backend from frontend
|
+ [lib] detached backend from frontend
|
||||||
|
+ [lib] added error checking
|
||||||
+ [plasmoid] added support of netctl-auto
|
+ [plasmoid] added support of netctl-auto
|
||||||
+ [plasmoid] added dataengine configuration
|
+ [plasmoid] added dataengine configuration
|
||||||
* [all] small changes in the project architecture
|
* [all] changes in the project architecture
|
||||||
|
* [all] refactoring
|
||||||
* [gui] more debug information
|
* [gui] more debug information
|
||||||
* [gui] changed lineEdit_profile to comboBox
|
* [gui] changed lineEdit_profile to comboBox
|
||||||
* [gui] refactoring of configuration interface
|
* [gui] refactoring of configuration interface
|
||||||
|
* [lib] more debug information
|
||||||
* [plasmoid] edited configuration interface
|
* [plasmoid] edited configuration interface
|
||||||
|
|
||||||
Ver.1.1.0 (netctl-1.7 update):
|
Ver.1.1.0 (netctl-1.7 update):
|
||||||
|
|||||||
@@ -65,7 +65,6 @@ TODO (wish list)
|
|||||||
----------------
|
----------------
|
||||||
|
|
||||||
* man pages
|
* man pages
|
||||||
* code review
|
|
||||||
|
|
||||||
Links
|
Links
|
||||||
-----
|
-----
|
||||||
|
|||||||
@@ -140,7 +140,7 @@ int main(int argc, char *argv[])
|
|||||||
cout << versionMessage.toUtf8().data();
|
cout << versionMessage.toUtf8().data();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
MainWindow w(0, defaultSettings, debug, showNetctlAuto, showSettings, tabNumber);
|
MainWindow w(0, debug, defaultSettings, showNetctlAuto, showSettings, tabNumber);
|
||||||
w.show();
|
w.show();
|
||||||
return a.exec();
|
return a.exec();
|
||||||
}
|
}
|
||||||
@@ -45,8 +45,8 @@
|
|||||||
|
|
||||||
|
|
||||||
MainWindow::MainWindow(QWidget *parent,
|
MainWindow::MainWindow(QWidget *parent,
|
||||||
const bool defaultSettings,
|
|
||||||
const bool debugCmd,
|
const bool debugCmd,
|
||||||
|
const bool defaultSettings,
|
||||||
const bool showNetctlAuto,
|
const bool showNetctlAuto,
|
||||||
const bool showSettings,
|
const bool showSettings,
|
||||||
const int tabNum)
|
const int tabNum)
|
||||||
@@ -54,9 +54,11 @@ MainWindow::MainWindow(QWidget *parent,
|
|||||||
ui(new Ui::MainWindow),
|
ui(new Ui::MainWindow),
|
||||||
debug(debugCmd)
|
debug(debugCmd)
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << "[MainWindow]" << "[MainWindow]" << ":" << "defaultSettings" << defaultSettings;
|
|
||||||
if (debug) qDebug() << "[MainWindow]" << "[MainWindow]" << ":" << "tabNum" << tabNum;
|
|
||||||
if (debug) qDebug() << "[MainWindow]" << "[MainWindow]" << ":" << "debug" << debug;
|
if (debug) qDebug() << "[MainWindow]" << "[MainWindow]" << ":" << "debug" << debug;
|
||||||
|
if (debug) qDebug() << "[MainWindow]" << "[MainWindow]" << ":" << "defaultSettings" << defaultSettings;
|
||||||
|
if (debug) qDebug() << "[MainWindow]" << "[MainWindow]" << ":" << "showNetctlAuto" << showNetctlAuto;
|
||||||
|
if (debug) qDebug() << "[MainWindow]" << "[MainWindow]" << ":" << "showSettings" << showSettings;
|
||||||
|
if (debug) qDebug() << "[MainWindow]" << "[MainWindow]" << ":" << "tabNum" << tabNum;
|
||||||
|
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
ui->tabWidget->setCurrentIndex(tabNum-1);
|
ui->tabWidget->setCurrentIndex(tabNum-1);
|
||||||
@@ -157,10 +159,11 @@ bool MainWindow::checkExternalApps(const QString apps = QString("all"))
|
|||||||
commandLine.append(configuration[QString("WPAACTIOND_PATH")]);
|
commandLine.append(configuration[QString("WPAACTIOND_PATH")]);
|
||||||
}
|
}
|
||||||
QProcess command;
|
QProcess command;
|
||||||
if (debug) qDebug() << "[MainWindow]" << "[checkExternalApps]" << ":" << "Run cmd" << commandLine.join(QString(" "));
|
if (debug) qDebug() << "[MainWindow]" << "[checkExternalApps]" << ":" << "Run cmd" << commandLine.join(QChar(' '));
|
||||||
command.start(commandLine.join(QString(" ")));
|
command.start(commandLine.join(QChar(' ')));
|
||||||
command.waitForFinished(-1);
|
command.waitForFinished(-1);
|
||||||
if (debug) qDebug() << "[MainWindow]" << "[checkExternalApps]" << ":" << "Cmd returns" << command.exitCode();
|
if (debug) qDebug() << "[MainWindow]" << "[checkExternalApps]" << ":" << "Cmd returns" << command.exitCode();
|
||||||
|
|
||||||
if (command.exitCode() != 0)
|
if (command.exitCode() != 0)
|
||||||
return false;
|
return false;
|
||||||
else
|
else
|
||||||
@@ -187,13 +190,14 @@ void MainWindow::createActions()
|
|||||||
if (debug) qDebug() << "[MainWindow]" << "[createActions]";
|
if (debug) qDebug() << "[MainWindow]" << "[createActions]";
|
||||||
|
|
||||||
connect(ui->tabWidget, SIGNAL(currentChanged(int)), this, SLOT(updateTabs(int)));
|
connect(ui->tabWidget, SIGNAL(currentChanged(int)), this, SLOT(updateTabs(int)));
|
||||||
|
connect(ui->tabWidget, SIGNAL(currentChanged(int)), this, SLOT(updateMenu(int)));
|
||||||
connect(ui->actionNetctlAuto, SIGNAL(triggered(bool)), netctlAutoWin, SLOT(showWindow()));
|
connect(ui->actionNetctlAuto, SIGNAL(triggered(bool)), netctlAutoWin, SLOT(showWindow()));
|
||||||
ui->actionNetctlAuto->setVisible(checkExternalApps(QString("all")));
|
ui->actionNetctlAuto->setVisible(checkExternalApps(QString("all")));
|
||||||
connect(ui->actionSettings, SIGNAL(triggered(bool)), settingsWin, SLOT(showWindow()));
|
connect(ui->actionSettings, SIGNAL(triggered(bool)), settingsWin, SLOT(showWindow()));
|
||||||
connect(ui->actionQuit, SIGNAL(triggered(bool)), this, SLOT(close()));
|
connect(ui->actionQuit, SIGNAL(triggered(bool)), this, SLOT(close()));
|
||||||
|
|
||||||
// actions menu
|
// actions menu
|
||||||
connect(ui->menuActions, SIGNAL(aboutToShow()), this, SLOT(updateMenu()));
|
//connect(ui->menuActions, SIGNAL(aboutToShow()), this, SLOT(updateMenu()));
|
||||||
connect(ui->actionMainEdit, SIGNAL(triggered(bool)), this, SLOT(mainTabEditProfile()));
|
connect(ui->actionMainEdit, SIGNAL(triggered(bool)), this, SLOT(mainTabEditProfile()));
|
||||||
connect(ui->actionMainEnable, SIGNAL(triggered(bool)), this, SLOT(mainTabEnableProfile()));
|
connect(ui->actionMainEnable, SIGNAL(triggered(bool)), this, SLOT(mainTabEnableProfile()));
|
||||||
connect(ui->actionMainRefresh, SIGNAL(triggered(bool)), this, SLOT(updateMainTab()));
|
connect(ui->actionMainRefresh, SIGNAL(triggered(bool)), this, SLOT(updateMainTab()));
|
||||||
@@ -249,16 +253,12 @@ void MainWindow::setIconsToButtons()
|
|||||||
ui->tabWidget->setTabIcon(0, QIcon(":icon"));
|
ui->tabWidget->setTabIcon(0, QIcon(":icon"));
|
||||||
ui->tabWidget->setTabIcon(1, QIcon::fromTheme("document-new"));
|
ui->tabWidget->setTabIcon(1, QIcon::fromTheme("document-new"));
|
||||||
ui->tabWidget->setTabIcon(2, QIcon(":wifi"));
|
ui->tabWidget->setTabIcon(2, QIcon(":wifi"));
|
||||||
|
|
||||||
// main tab
|
// main tab
|
||||||
ui->pushButton_mainRefresh->setIcon(QIcon::fromTheme("stock-refresh"));
|
ui->pushButton_mainRefresh->setIcon(QIcon::fromTheme("stock-refresh"));
|
||||||
ui->pushButton_mainRestart->setIcon(QIcon::fromTheme("stock-refresh"));
|
ui->pushButton_mainRestart->setIcon(QIcon::fromTheme("stock-refresh"));
|
||||||
|
|
||||||
// profile tab
|
// profile tab
|
||||||
ui->pushButton_profileClear->setIcon(QIcon::fromTheme("edit-clear"));
|
ui->pushButton_profileClear->setIcon(QIcon::fromTheme("edit-clear"));
|
||||||
ui->pushButton_profileSave->setIcon(QIcon::fromTheme("document-save"));
|
ui->pushButton_profileSave->setIcon(QIcon::fromTheme("document-save"));
|
||||||
|
|
||||||
|
|
||||||
// wifi tab
|
// wifi tab
|
||||||
ui->pushButton_wifiRefresh->setIcon(QIcon::fromTheme("stock-refresh"));
|
ui->pushButton_wifiRefresh->setIcon(QIcon::fromTheme("stock-refresh"));
|
||||||
}
|
}
|
||||||
@@ -302,13 +302,13 @@ void MainWindow::updateTabs(const int tab)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MainWindow::updateMenu()
|
void MainWindow::updateMenu(const int tab)
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << "[MainWindow]" << "[updateMenu]";
|
if (debug) qDebug() << "[MainWindow]" << "[updateMenu]";
|
||||||
|
if (debug) qDebug() << "[MainWindow]" << "[updateMenu]" << ":" << "Update tab" << tab;
|
||||||
|
|
||||||
setMenuActionsShown(false);
|
setMenuActionsShown(false);
|
||||||
int tab = ui->tabWidget->currentIndex();
|
|
||||||
if (debug) qDebug() << "[MainWindow]" << "[updateMenu]" << ":" << "Current tab" << tab;
|
|
||||||
if (tab == 0)
|
if (tab == 0)
|
||||||
updateMenuMain();
|
updateMenuMain();
|
||||||
else if (tab == 1)
|
else if (tab == 1)
|
||||||
@@ -321,7 +321,6 @@ void MainWindow::updateMenu()
|
|||||||
void MainWindow::updateMainTab()
|
void MainWindow::updateMainTab()
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << "[MainWindow]" << "[updateMainTab]";
|
if (debug) qDebug() << "[MainWindow]" << "[updateMainTab]";
|
||||||
|
|
||||||
if (!checkExternalApps(QString("netctl"))) {
|
if (!checkExternalApps(QString("netctl"))) {
|
||||||
errorWin = new ErrorWindow(this, debug, 1);
|
errorWin = new ErrorWindow(this, debug, 1);
|
||||||
errorWin->show();
|
errorWin->show();
|
||||||
@@ -439,7 +438,6 @@ void MainWindow::updateMenuProfile()
|
|||||||
void MainWindow::updateWifiTab()
|
void MainWindow::updateWifiTab()
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << "[MainWindow]" << "[updateWifiTab]";
|
if (debug) qDebug() << "[MainWindow]" << "[updateWifiTab]";
|
||||||
|
|
||||||
wifiTabSetEnabled(checkExternalApps(QString("wpasup")));
|
wifiTabSetEnabled(checkExternalApps(QString("wpasup")));
|
||||||
if (!checkExternalApps(QString("wpasup"))) {
|
if (!checkExternalApps(QString("wpasup"))) {
|
||||||
errorWin = new ErrorWindow(this, debug, 1);
|
errorWin = new ErrorWindow(this, debug, 1);
|
||||||
@@ -519,7 +517,6 @@ void MainWindow::updateMenuWifi()
|
|||||||
void MainWindow::mainTabContextualMenu(const QPoint &pos)
|
void MainWindow::mainTabContextualMenu(const QPoint &pos)
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << "[MainWindow]" << "[mainTabContextualMenu]";
|
if (debug) qDebug() << "[MainWindow]" << "[mainTabContextualMenu]";
|
||||||
|
|
||||||
if (ui->tableWidget_main->currentItem() == 0)
|
if (ui->tableWidget_main->currentItem() == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -620,7 +617,6 @@ void MainWindow::mainTabRemoveProfile()
|
|||||||
void MainWindow::mainTabEnableProfile()
|
void MainWindow::mainTabEnableProfile()
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << "[MainWindow]" << "[mainTabEnableProfile]";
|
if (debug) qDebug() << "[MainWindow]" << "[mainTabEnableProfile]";
|
||||||
|
|
||||||
if (!checkExternalApps(QString("netctl"))) {
|
if (!checkExternalApps(QString("netctl"))) {
|
||||||
errorWin = new ErrorWindow(this, debug, 1);
|
errorWin = new ErrorWindow(this, debug, 1);
|
||||||
errorWin->show();
|
errorWin->show();
|
||||||
@@ -653,7 +649,6 @@ void MainWindow::mainTabEnableProfile()
|
|||||||
void MainWindow::mainTabRestartProfile()
|
void MainWindow::mainTabRestartProfile()
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << "[MainWindow]" << "[mainTabRestartProfile]";
|
if (debug) qDebug() << "[MainWindow]" << "[mainTabRestartProfile]";
|
||||||
|
|
||||||
if (!checkExternalApps(QString("netctl"))) {
|
if (!checkExternalApps(QString("netctl"))) {
|
||||||
errorWin = new ErrorWindow(this, debug, 1);
|
errorWin = new ErrorWindow(this, debug, 1);
|
||||||
errorWin->show();
|
errorWin->show();
|
||||||
@@ -677,7 +672,6 @@ void MainWindow::mainTabRestartProfile()
|
|||||||
void MainWindow::mainTabStartProfile()
|
void MainWindow::mainTabStartProfile()
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << "[MainWindow]" << "[mainTabStartProfile]";
|
if (debug) qDebug() << "[MainWindow]" << "[mainTabStartProfile]";
|
||||||
|
|
||||||
if (!checkExternalApps(QString("netctl"))) {
|
if (!checkExternalApps(QString("netctl"))) {
|
||||||
errorWin = new ErrorWindow(this, debug, 1);
|
errorWin = new ErrorWindow(this, debug, 1);
|
||||||
errorWin->show();
|
errorWin->show();
|
||||||
@@ -711,7 +705,6 @@ void MainWindow::mainTabRefreshButtons(QTableWidgetItem *current, QTableWidgetIt
|
|||||||
{
|
{
|
||||||
Q_UNUSED(previous);
|
Q_UNUSED(previous);
|
||||||
if (debug) qDebug() << "[MainWindow]" << "[mainTabRefreshButtons]";
|
if (debug) qDebug() << "[MainWindow]" << "[mainTabRefreshButtons]";
|
||||||
|
|
||||||
if (!checkExternalApps(QString("netctl"))) {
|
if (!checkExternalApps(QString("netctl"))) {
|
||||||
errorWin = new ErrorWindow(this, debug, 1);
|
errorWin = new ErrorWindow(this, debug, 1);
|
||||||
errorWin->show();
|
errorWin->show();
|
||||||
@@ -1210,7 +1203,6 @@ void MainWindow::profileTabRemoveProfile()
|
|||||||
void MainWindow::wifiTabContextualMenu(const QPoint &pos)
|
void MainWindow::wifiTabContextualMenu(const QPoint &pos)
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << "[MainWindow]" << "[wifiTabContextualMenu]";
|
if (debug) qDebug() << "[MainWindow]" << "[wifiTabContextualMenu]";
|
||||||
|
|
||||||
if (ui->tableWidget_wifi->currentItem() == 0)
|
if (ui->tableWidget_wifi->currentItem() == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -1274,7 +1266,7 @@ void MainWindow::connectToUnknownEssid(const QString passwd)
|
|||||||
{
|
{
|
||||||
if (debug) qDebug() << "[MainWindow]" << "[connectToUnknownEssid]";
|
if (debug) qDebug() << "[MainWindow]" << "[connectToUnknownEssid]";
|
||||||
|
|
||||||
if (!passwd.isEmpty())
|
if (passwdWid != 0)
|
||||||
delete passwdWid;
|
delete passwdWid;
|
||||||
|
|
||||||
QMap<QString, QString> settings;
|
QMap<QString, QString> settings;
|
||||||
@@ -1298,7 +1290,7 @@ void MainWindow::connectToUnknownEssid(const QString passwd)
|
|||||||
settings[QString("Hidden")] = QString("yes");
|
settings[QString("Hidden")] = QString("yes");
|
||||||
|
|
||||||
QString profile = QString("netctl-gui-") + settings[QString("ESSID")];
|
QString profile = QString("netctl-gui-") + settings[QString("ESSID")];
|
||||||
profile.remove(QString("'"));
|
profile.remove(QChar('"')).remove(QChar('\''));
|
||||||
QString profileTempName = netctlProfile->createProfile(profile, settings);
|
QString profileTempName = netctlProfile->createProfile(profile, settings);
|
||||||
if (netctlProfile->copyProfile(profileTempName))
|
if (netctlProfile->copyProfile(profileTempName))
|
||||||
netctlCommand->startProfile(profile);
|
netctlCommand->startProfile(profile);
|
||||||
@@ -1325,7 +1317,6 @@ void MainWindow::setHiddenName(const QString name)
|
|||||||
void MainWindow::wifiTabStart()
|
void MainWindow::wifiTabStart()
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << "[MainWindow]" << "[wifiTabStart]";
|
if (debug) qDebug() << "[MainWindow]" << "[wifiTabStart]";
|
||||||
|
|
||||||
if (!checkExternalApps(QString("wpasup"))) {
|
if (!checkExternalApps(QString("wpasup"))) {
|
||||||
errorWin = new ErrorWindow(this, debug, 1);
|
errorWin = new ErrorWindow(this, debug, 1);
|
||||||
errorWin->show();
|
errorWin->show();
|
||||||
@@ -1333,6 +1324,8 @@ void MainWindow::wifiTabStart()
|
|||||||
}
|
}
|
||||||
if (ui->tableWidget_wifi->currentItem() == 0)
|
if (ui->tableWidget_wifi->currentItem() == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
// name is hidden
|
||||||
if (ui->tableWidget_wifi->item(ui->tableWidget_wifi->currentItem()->row(), 0)->text() == QString("<hidden>")) {
|
if (ui->tableWidget_wifi->item(ui->tableWidget_wifi->currentItem()->row(), 0)->text() == QString("<hidden>")) {
|
||||||
hiddenNetwork = true;
|
hiddenNetwork = true;
|
||||||
passwdWid = new PasswdWidget(this);
|
passwdWid = new PasswdWidget(this);
|
||||||
@@ -1347,6 +1340,7 @@ void MainWindow::wifiTabStart()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// name isn't hidden
|
||||||
ui->tabWidget->setDisabled(true);
|
ui->tabWidget->setDisabled(true);
|
||||||
hiddenNetwork = false;
|
hiddenNetwork = false;
|
||||||
QString profile = ui->tableWidget_wifi->item(ui->tableWidget_wifi->currentItem()->row(), 0)->text();
|
QString profile = ui->tableWidget_wifi->item(ui->tableWidget_wifi->currentItem()->row(), 0)->text();
|
||||||
@@ -1394,7 +1388,6 @@ void MainWindow::wifiTabRefreshButtons(QTableWidgetItem *current, QTableWidgetIt
|
|||||||
{
|
{
|
||||||
Q_UNUSED(previous);
|
Q_UNUSED(previous);
|
||||||
if (debug) qDebug() << "[MainWindow]" << "[wifiTabRefreshButtons]";
|
if (debug) qDebug() << "[MainWindow]" << "[wifiTabRefreshButtons]";
|
||||||
|
|
||||||
if (!checkExternalApps(QString("wpasup"))) {
|
if (!checkExternalApps(QString("wpasup"))) {
|
||||||
errorWin = new ErrorWindow(this, debug, 1);
|
errorWin = new ErrorWindow(this, debug, 1);
|
||||||
errorWin->show();
|
errorWin->show();
|
||||||
|
|||||||
@@ -52,8 +52,8 @@ class MainWindow : public QMainWindow
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
explicit MainWindow(QWidget *parent = 0,
|
explicit MainWindow(QWidget *parent = 0,
|
||||||
const bool defaultSettings = false,
|
|
||||||
const bool debugCmd = false,
|
const bool debugCmd = false,
|
||||||
|
const bool defaultSettings = false,
|
||||||
const bool showNetctlAuto = false,
|
const bool showNetctlAuto = false,
|
||||||
const bool showSettings = false,
|
const bool showSettings = false,
|
||||||
const int tabNum = 1);
|
const int tabNum = 1);
|
||||||
@@ -61,6 +61,7 @@ public:
|
|||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void updateTabs(const int tab);
|
void updateTabs(const int tab);
|
||||||
|
void updateMenu(const int tab);
|
||||||
// wifi tab slots
|
// wifi tab slots
|
||||||
void connectToUnknownEssid(const QString passwd);
|
void connectToUnknownEssid(const QString passwd);
|
||||||
void setHiddenName(const QString name);
|
void setHiddenName(const QString name);
|
||||||
@@ -68,7 +69,6 @@ public slots:
|
|||||||
private slots:
|
private slots:
|
||||||
// menu update slots
|
// menu update slots
|
||||||
void setMenuActionsShown(const bool state = true);
|
void setMenuActionsShown(const bool state = true);
|
||||||
void updateMenu();
|
|
||||||
void updateMenuMain();
|
void updateMenuMain();
|
||||||
void updateMenuProfile();
|
void updateMenuProfile();
|
||||||
void updateMenuWifi();
|
void updateMenuWifi();
|
||||||
|
|||||||
Reference in new issue
Block a user