mirror of
https://github.com/arcan1s/netctl-gui.git
synced 2025-04-25 07:57:20 +00:00
rewrite errorwindow
This commit is contained in:
parent
5e1a4be134
commit
79fc70efa1
@ -16,88 +16,194 @@
|
|||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
#include "errorwindow.h"
|
#include "errorwindow.h"
|
||||||
#include "ui_errorwindow.h"
|
|
||||||
|
|
||||||
|
#include <QApplication>
|
||||||
|
#include <QGridLayout>
|
||||||
|
#include <QSpacerItem>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
|
|
||||||
ErrorWindow::ErrorWindow(QWidget *parent, const bool debugCmd, const int messageNumber)
|
ErrorWindow::ErrorWindow(QWidget *parent, const bool debugCmd)
|
||||||
: QMainWindow(parent),
|
: debug(debugCmd)
|
||||||
debug(debugCmd),
|
|
||||||
ui(new Ui::ErrorWindow)
|
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << "[ErrorWindow]" << "[ErrorWindow]" << ":" << "Initializate with error code" << messageNumber;
|
|
||||||
|
|
||||||
ui->setupUi(this);
|
|
||||||
setMessage(messageNumber);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ErrorWindow::~ErrorWindow()
|
ErrorWindow::~ErrorWindow()
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << "[ErrorWindow]" << "[~ErrorWindow]";
|
if (debug) qDebug() << "[ErrorWindow]" << "[~ErrorWindow]";
|
||||||
|
|
||||||
delete ui;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ErrorWindow::setMessage(const int mess)
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << "[ErrorWindow]" << "[setMessage]";
|
|
||||||
if (debug) qDebug() << "[ErrorWindow]" << "[setMessage]" << ":" << "Message" << mess;
|
|
||||||
|
|
||||||
QString message;
|
QStringList ErrorWindow::getMessage(const int mess)
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << "[ErrorWindow]" << "[getMessage]";
|
||||||
|
if (debug) qDebug() << "[ErrorWindow]" << "[getMessage]" << ":" << "Message" << mess;
|
||||||
|
|
||||||
|
QString message, title;
|
||||||
switch(mess) {
|
switch(mess) {
|
||||||
case 1:
|
case 1:
|
||||||
|
title = QApplication::translate("ErrorWindow", "Error!");
|
||||||
message = QApplication::translate("ErrorWindow", "Could not find components");
|
message = QApplication::translate("ErrorWindow", "Could not find components");
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
|
title = QApplication::translate("ErrorWindow", "Error!");
|
||||||
message = QApplication::translate("ErrorWindow", "Does not support yet");
|
message = QApplication::translate("ErrorWindow", "Does not support yet");
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
|
title = QApplication::translate("ErrorWindow", "Error!");
|
||||||
message = QApplication::translate("ErrorWindow", "Profile name is not set");
|
message = QApplication::translate("ErrorWindow", "Profile name is not set");
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
|
title = QApplication::translate("ErrorWindow", "Error!");
|
||||||
message = QApplication::translate("ErrorWindow", "Bind interfaces are not set");
|
message = QApplication::translate("ErrorWindow", "Bind interfaces are not set");
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
|
title = QApplication::translate("ErrorWindow", "Error!");
|
||||||
message = QApplication::translate("ErrorWindow", "Description is not set");
|
message = QApplication::translate("ErrorWindow", "Description is not set");
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
|
title = QApplication::translate("ErrorWindow", "Error!");
|
||||||
message = QApplication::translate("ErrorWindow", "Ip settings are not set");
|
message = QApplication::translate("ErrorWindow", "Ip settings are not set");
|
||||||
break;
|
break;
|
||||||
case 7:
|
case 7:
|
||||||
|
title = QApplication::translate("ErrorWindow", "Error!");
|
||||||
message = QApplication::translate("ErrorWindow", "Configuration file does not exist");
|
message = QApplication::translate("ErrorWindow", "Configuration file does not exist");
|
||||||
break;
|
break;
|
||||||
case 8:
|
case 8:
|
||||||
|
title = QApplication::translate("ErrorWindow", "Error!");
|
||||||
message = QApplication::translate("ErrorWindow", "Key is not set");
|
message = QApplication::translate("ErrorWindow", "Key is not set");
|
||||||
break;
|
break;
|
||||||
case 9:
|
case 9:
|
||||||
|
title = QApplication::translate("ErrorWindow", "Error!");
|
||||||
message = QApplication::translate("ErrorWindow", "Wireless settings are not set");
|
message = QApplication::translate("ErrorWindow", "Wireless settings are not set");
|
||||||
break;
|
break;
|
||||||
case 10:
|
case 10:
|
||||||
|
title = QApplication::translate("ErrorWindow", "Error!");
|
||||||
message = QApplication::translate("ErrorWindow", "Configuration file is not set");
|
message = QApplication::translate("ErrorWindow", "Configuration file is not set");
|
||||||
break;
|
break;
|
||||||
case 11:
|
case 11:
|
||||||
|
title = QApplication::translate("ErrorWindow", "Error!");
|
||||||
message = QApplication::translate("ErrorWindow", "ESSID is not set");
|
message = QApplication::translate("ErrorWindow", "ESSID is not set");
|
||||||
break;
|
break;
|
||||||
case 12:
|
case 12:
|
||||||
|
title = QApplication::translate("ErrorWindow", "Error!");
|
||||||
message = QApplication::translate("ErrorWindow", "MAC address is incorrect");
|
message = QApplication::translate("ErrorWindow", "MAC address is incorrect");
|
||||||
break;
|
break;
|
||||||
case 13:
|
case 13:
|
||||||
|
title = QApplication::translate("ErrorWindow", "Error!");
|
||||||
message = QApplication::translate("ErrorWindow", "Session ID is not set");
|
message = QApplication::translate("ErrorWindow", "Session ID is not set");
|
||||||
break;
|
break;
|
||||||
case 14:
|
case 14:
|
||||||
|
title = QApplication::translate("ErrorWindow", "Error!");
|
||||||
message = QApplication::translate("ErrorWindow", "APN is not set");
|
message = QApplication::translate("ErrorWindow", "APN is not set");
|
||||||
break;
|
break;
|
||||||
case 15:
|
case 15:
|
||||||
|
title = QApplication::translate("ErrorWindow", "Error!");
|
||||||
message = QApplication::translate("ErrorWindow", "APN is not set");
|
message = QApplication::translate("ErrorWindow", "APN is not set");
|
||||||
break;
|
break;
|
||||||
case 16:
|
case 16:
|
||||||
|
title = QApplication::translate("ErrorWindow", "Error!");
|
||||||
message = QApplication::translate("ErrorWindow", "Empty user/group name");
|
message = QApplication::translate("ErrorWindow", "Empty user/group name");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
title = QApplication::translate("ErrorWindow", "Error!");
|
||||||
message = QApplication::translate("ErrorWindow", "Unknown error");
|
message = QApplication::translate("ErrorWindow", "Unknown error");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
ui->label->setText(message);
|
QStringList fullMessage;
|
||||||
|
fullMessage.append(title);
|
||||||
|
fullMessage.append(message);
|
||||||
|
return fullMessage;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QMessageBox::Icon ErrorWindow::getIcon(const int mess)
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << "[ErrorWindow]" << "[getIcon]";
|
||||||
|
if (debug) qDebug() << "[ErrorWindow]" << "[getIcon]" << ":" << "Message" << mess;
|
||||||
|
|
||||||
|
QMessageBox::Icon icon;
|
||||||
|
switch(mess) {
|
||||||
|
case 1:
|
||||||
|
icon = QMessageBox::Critical;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
icon = QMessageBox::Critical;
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
icon = QMessageBox::Critical;
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
icon = QMessageBox::Critical;
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
icon = QMessageBox::Critical;
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
icon = QMessageBox::Critical;
|
||||||
|
break;
|
||||||
|
case 7:
|
||||||
|
icon = QMessageBox::Critical;
|
||||||
|
break;
|
||||||
|
case 8:
|
||||||
|
icon = QMessageBox::Critical;
|
||||||
|
break;
|
||||||
|
case 9:
|
||||||
|
icon = QMessageBox::Critical;
|
||||||
|
break;
|
||||||
|
case 10:
|
||||||
|
icon = QMessageBox::Critical;
|
||||||
|
break;
|
||||||
|
case 11:
|
||||||
|
icon = QMessageBox::Critical;
|
||||||
|
break;
|
||||||
|
case 12:
|
||||||
|
icon = QMessageBox::Critical;
|
||||||
|
break;
|
||||||
|
case 13:
|
||||||
|
icon = QMessageBox::Critical;
|
||||||
|
break;
|
||||||
|
case 14:
|
||||||
|
icon = QMessageBox::Critical;
|
||||||
|
break;
|
||||||
|
case 15:
|
||||||
|
icon = QMessageBox::Critical;
|
||||||
|
break;
|
||||||
|
case 16:
|
||||||
|
icon = QMessageBox::Critical;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
icon = QMessageBox::NoIcon;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return icon;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ErrorWindow::showWindow(const int mess, const QString sender)
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << "[ErrorWindow]" << "[showWindow]";
|
||||||
|
if (debug) qDebug() << "[ErrorWindow]" << "[showWindow]" << ":" << "Message" << mess;
|
||||||
|
if (debug) qDebug() << "[ErrorWindow]" << "[showWindow]" << ":" << "Sender" << sender;
|
||||||
|
|
||||||
|
QStringList message = getMessage(mess);
|
||||||
|
QMessageBox messageBox;
|
||||||
|
messageBox.setText(message[0]);
|
||||||
|
messageBox.setInformativeText(message[1]);
|
||||||
|
if (debug)
|
||||||
|
messageBox.setDetailedText(QApplication::translate("ErrorWindow", "Sender : %1").
|
||||||
|
arg(sender));
|
||||||
|
messageBox.setIcon(getIcon(mess));
|
||||||
|
messageBox.setStandardButtons(QMessageBox::Ok);
|
||||||
|
messageBox.setDefaultButton(QMessageBox::Ok);
|
||||||
|
|
||||||
|
QSpacerItem *horizontalSpacer = new QSpacerItem(400, 0, QSizePolicy::Minimum, QSizePolicy::Expanding);
|
||||||
|
QGridLayout *layout = (QGridLayout *)messageBox.layout();
|
||||||
|
layout->addItem(horizontalSpacer, layout->rowCount(), 0, 1, layout->columnCount());
|
||||||
|
|
||||||
|
messageBox.exec();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
@ -18,27 +18,28 @@
|
|||||||
#ifndef ERRORWINDOW_H
|
#ifndef ERRORWINDOW_H
|
||||||
#define ERRORWINDOW_H
|
#define ERRORWINDOW_H
|
||||||
|
|
||||||
#include <QMainWindow>
|
#include <QMessageBox>
|
||||||
|
#include <QObject>
|
||||||
|
|
||||||
|
|
||||||
namespace Ui {
|
class ErrorWindow : public QObject
|
||||||
class ErrorWindow;
|
|
||||||
}
|
|
||||||
|
|
||||||
class ErrorWindow : public QMainWindow
|
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit ErrorWindow(QWidget *parent = 0,
|
explicit ErrorWindow(QWidget *parent = 0,
|
||||||
const bool debugCmd = false,
|
const bool debugCmd = false);
|
||||||
const int messageNumber = 0);
|
|
||||||
~ErrorWindow();
|
~ErrorWindow();
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void showWindow(const int mess = 0,
|
||||||
|
const QString sender = QString());
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool debug;
|
bool debug;
|
||||||
Ui::ErrorWindow *ui;
|
QStringList getMessage(const int mess);
|
||||||
void setMessage(const int mess);
|
QMessageBox::Icon getIcon(const int mess);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif /* ERRORWINDOW_H */
|
#endif /* ERRORWINDOW_H */
|
||||||
|
@ -75,8 +75,11 @@ MainWindow::MainWindow(QWidget *parent,
|
|||||||
configuration = settingsWin->getSettings();
|
configuration = settingsWin->getSettings();
|
||||||
|
|
||||||
// gui
|
// gui
|
||||||
|
// windows
|
||||||
aboutWin = new AboutWindow(this, debug);
|
aboutWin = new AboutWindow(this, debug);
|
||||||
|
errorWin = new ErrorWindow(this, debug);
|
||||||
netctlAutoWin = new NetctlAutoWindow(this, debug, configuration);
|
netctlAutoWin = new NetctlAutoWindow(this, debug, configuration);
|
||||||
|
// profile widgets
|
||||||
generalWid = new GeneralWidget(this, configuration);
|
generalWid = new GeneralWidget(this, configuration);
|
||||||
ui->scrollAreaWidgetContents->layout()->addWidget(generalWid);
|
ui->scrollAreaWidgetContents->layout()->addWidget(generalWid);
|
||||||
ipWid = new IpWidget(this);
|
ipWid = new IpWidget(this);
|
||||||
@ -145,6 +148,7 @@ MainWindow::~MainWindow()
|
|||||||
delete wirelessWid;
|
delete wirelessWid;
|
||||||
|
|
||||||
delete aboutWin;
|
delete aboutWin;
|
||||||
|
delete errorWin;
|
||||||
delete netctlAutoWin;
|
delete netctlAutoWin;
|
||||||
delete settingsWin;
|
delete settingsWin;
|
||||||
delete ui;
|
delete ui;
|
||||||
@ -314,6 +318,7 @@ void MainWindow::updateTabs(const int tab)
|
|||||||
updateProfileTab();
|
updateProfileTab();
|
||||||
else if (tab == 2)
|
else if (tab == 2)
|
||||||
updateWifiTab();
|
updateWifiTab();
|
||||||
|
updateMenu(tab);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -336,11 +341,8 @@ void MainWindow::updateMenu(const int tab)
|
|||||||
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);
|
return errorWin->showWindow(1, QString("[MainWindow] : [updateMainTab]"));
|
||||||
errorWin->show();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
ui->tabWidget->setDisabled(true);
|
ui->tabWidget->setDisabled(true);
|
||||||
QList<QStringList> profiles = netctlCommand->getProfileList();
|
QList<QStringList> profiles = netctlCommand->getProfileList();
|
||||||
@ -454,11 +456,8 @@ 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);
|
return errorWin->showWindow(1, QString("[MainWindow] : [updateWifiTab]"));
|
||||||
errorWin->show();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
QList<QStringList> scanResults = wpaCommand->scanWifi();
|
QList<QStringList> scanResults = wpaCommand->scanWifi();
|
||||||
|
|
||||||
@ -633,11 +632,8 @@ 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);
|
return errorWin->showWindow(1, QString("[MainWindow] : [mainTabEnableProfile]"));
|
||||||
errorWin->show();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (ui->tableWidget_main->currentItem() == 0)
|
if (ui->tableWidget_main->currentItem() == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -665,11 +661,8 @@ 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);
|
return errorWin->showWindow(1, QString("[MainWindow] : [mainTabRestartProfile]"));
|
||||||
errorWin->show();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (ui->tableWidget_main->currentItem() == 0)
|
if (ui->tableWidget_main->currentItem() == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -688,11 +681,8 @@ 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);
|
return errorWin->showWindow(1, QString("[MainWindow] : [mainTabStartProfile]"));
|
||||||
errorWin->show();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (ui->tableWidget_main->currentItem() == 0)
|
if (ui->tableWidget_main->currentItem() == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -721,11 +711,8 @@ 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);
|
return errorWin->showWindow(1, QString("[MainWindow] : [mainTabRefreshButtons]"));
|
||||||
errorWin->show();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (current == 0) {
|
if (current == 0) {
|
||||||
ui->pushButton_mainRestart->setDisabled(true);
|
ui->pushButton_mainRestart->setDisabled(true);
|
||||||
ui->pushButton_mainStart->setDisabled(true);
|
ui->pushButton_mainStart->setDisabled(true);
|
||||||
@ -919,21 +906,12 @@ void MainWindow::profileTabCreateProfile()
|
|||||||
if (debug) qDebug() << "[MainWindow]" << "[profileTabCreateProfile]";
|
if (debug) qDebug() << "[MainWindow]" << "[profileTabCreateProfile]";
|
||||||
|
|
||||||
// error checking
|
// error checking
|
||||||
if (ui->comboBox_profile->currentText().isEmpty()) {
|
if (ui->comboBox_profile->currentText().isEmpty())
|
||||||
errorWin = new ErrorWindow(this, debug, 3);
|
return errorWin->showWindow(3, QString("[MainWindow] : [profileTabCreateProfile]"));
|
||||||
errorWin->show();
|
if (generalWid->isOk() == 1)
|
||||||
return;
|
return errorWin->showWindow(4, QString("[MainWindow] : [profileTabCreateProfile]"));
|
||||||
}
|
else if (generalWid->isOk() == 2)
|
||||||
if (generalWid->isOk() == 1) {
|
return errorWin->showWindow(5, QString("[MainWindow] : [profileTabCreateProfile]"));
|
||||||
errorWin = new ErrorWindow(this, debug, 4);
|
|
||||||
errorWin->show();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else if (generalWid->isOk() == 2) {
|
|
||||||
errorWin = new ErrorWindow(this, debug, 5);
|
|
||||||
errorWin->show();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if ((generalWid->connectionType->currentText() == QString("ethernet")) ||
|
if ((generalWid->connectionType->currentText() == QString("ethernet")) ||
|
||||||
(generalWid->connectionType->currentText() == QString("wireless")) ||
|
(generalWid->connectionType->currentText() == QString("wireless")) ||
|
||||||
(generalWid->connectionType->currentText() == QString("bond")) ||
|
(generalWid->connectionType->currentText() == QString("bond")) ||
|
||||||
@ -943,114 +921,60 @@ void MainWindow::profileTabCreateProfile()
|
|||||||
(generalWid->connectionType->currentText() == QString("tuntap")) ||
|
(generalWid->connectionType->currentText() == QString("tuntap")) ||
|
||||||
(generalWid->connectionType->currentText() == QString("vlan")) ||
|
(generalWid->connectionType->currentText() == QString("vlan")) ||
|
||||||
(generalWid->connectionType->currentText() == QString("macvlan"))) {
|
(generalWid->connectionType->currentText() == QString("macvlan"))) {
|
||||||
if (ipWid->isOk() == 1) {
|
if (ipWid->isOk() == 1)
|
||||||
errorWin = new ErrorWindow(this, debug, 6);
|
return errorWin->showWindow(6, QString("[MainWindow] : [profileTabCreateProfile]"));
|
||||||
errorWin->show();
|
else if (ipWid->isOk() == 2)
|
||||||
return;
|
return errorWin->showWindow(6, QString("[MainWindow] : [profileTabCreateProfile]"));
|
||||||
}
|
|
||||||
else if (ipWid->isOk() == 2) {
|
|
||||||
errorWin = new ErrorWindow(this, debug, 6);
|
|
||||||
errorWin->show();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (generalWid->connectionType->currentText() == QString("ethernet")) {
|
if (generalWid->connectionType->currentText() == QString("ethernet")) {
|
||||||
if (ethernetWid->isOk() == 1) {
|
if (ethernetWid->isOk() == 1)
|
||||||
errorWin = new ErrorWindow(this, debug, 7);
|
return errorWin->showWindow(7, QString("[MainWindow] : [profileTabCreateProfile]"));
|
||||||
errorWin->show();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if (generalWid->connectionType->currentText() == QString("wireless")) {
|
else if (generalWid->connectionType->currentText() == QString("wireless")) {
|
||||||
if (wirelessWid->isOk() == 1) {
|
if (wirelessWid->isOk() == 1)
|
||||||
errorWin = new ErrorWindow(this, debug, 8);
|
return errorWin->showWindow(8, QString("[MainWindow] : [profileTabCreateProfile]"));
|
||||||
errorWin->show();
|
else if (wirelessWid->isOk() == 2)
|
||||||
return;
|
return errorWin->showWindow(9, QString("[MainWindow] : [profileTabCreateProfile]"));
|
||||||
}
|
else if (wirelessWid->isOk() == 3)
|
||||||
else if (wirelessWid->isOk() == 2) {
|
return errorWin->showWindow(10, QString("[MainWindow] : [profileTabCreateProfile]"));
|
||||||
errorWin = new ErrorWindow(this, debug, 9);
|
else if (wirelessWid->isOk() == 4)
|
||||||
errorWin->show();
|
return errorWin->showWindow(7, QString("[MainWindow] : [profileTabCreateProfile]"));
|
||||||
return;
|
else if (wirelessWid->isOk() == 5)
|
||||||
}
|
return errorWin->showWindow(11, QString("[MainWindow] : [profileTabCreateProfile]"));
|
||||||
else if (wirelessWid->isOk() == 3) {
|
|
||||||
errorWin = new ErrorWindow(this, debug, 10);
|
|
||||||
errorWin->show();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else if (wirelessWid->isOk() == 4) {
|
|
||||||
errorWin = new ErrorWindow(this, debug, 7);
|
|
||||||
errorWin->show();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else if (wirelessWid->isOk() == 5) {
|
|
||||||
errorWin = new ErrorWindow(this, debug, 11);
|
|
||||||
errorWin->show();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if (generalWid->connectionType->currentText() == QString("bridge")) {
|
else if (generalWid->connectionType->currentText() == QString("bridge")) {
|
||||||
}
|
}
|
||||||
else if (generalWid->connectionType->currentText() == QString("pppoe")) {
|
else if (generalWid->connectionType->currentText() == QString("pppoe")) {
|
||||||
if (pppoeWid->isOk() == 1) {
|
if (pppoeWid->isOk() == 1)
|
||||||
errorWin = new ErrorWindow(this, debug, 7);
|
return errorWin->showWindow(7, QString("[MainWindow] : [profileTabCreateProfile]"));
|
||||||
errorWin->show();
|
else if (pppoeWid->isOk() == 2)
|
||||||
return;
|
return errorWin->showWindow(12, QString("[MainWindow] : [profileTabCreateProfile]"));
|
||||||
}
|
else if (pppoeWid->isOk() == 3)
|
||||||
else if (pppoeWid->isOk() == 2) {
|
return errorWin->showWindow(13, QString("[MainWindow] : [profileTabCreateProfile]"));
|
||||||
errorWin = new ErrorWindow(this, debug, 12);
|
else if (pppoeWid->isOk() == 4)
|
||||||
errorWin->show();
|
return errorWin->showWindow(12, QString("[MainWindow] : [profileTabCreateProfile]"));
|
||||||
return;
|
|
||||||
}
|
|
||||||
else if (pppoeWid->isOk() == 3) {
|
|
||||||
errorWin = new ErrorWindow(this, debug, 13);
|
|
||||||
errorWin->show();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else if (pppoeWid->isOk() == 4) {
|
|
||||||
errorWin = new ErrorWindow(this, debug, 12);
|
|
||||||
errorWin->show();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if (generalWid->connectionType->currentText() == QString("mobile_ppp")) {
|
else if (generalWid->connectionType->currentText() == QString("mobile_ppp")) {
|
||||||
if (mobileWid->isOk() == 1) {
|
if (mobileWid->isOk() == 1)
|
||||||
errorWin = new ErrorWindow(this, debug, 14);
|
return errorWin->showWindow(14, QString("[MainWindow] : [profileTabCreateProfile]"));
|
||||||
errorWin->show();
|
if (mobileWid->isOk() == 2)
|
||||||
return;
|
return errorWin->showWindow(7, QString("[MainWindow] : [profileTabCreateProfile]"));
|
||||||
}
|
|
||||||
if (mobileWid->isOk() == 2) {
|
|
||||||
errorWin = new ErrorWindow(this, debug, 7);
|
|
||||||
errorWin->show();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if (generalWid->connectionType->currentText() == QString("tunnel")) {
|
else if (generalWid->connectionType->currentText() == QString("tunnel")) {
|
||||||
}
|
}
|
||||||
else if (generalWid->connectionType->currentText() == QString("tuntap")) {
|
else if (generalWid->connectionType->currentText() == QString("tuntap")) {
|
||||||
if (tuntapWid->isOk() == 1) {
|
if (tuntapWid->isOk() == 1)
|
||||||
errorWin = new ErrorWindow(this, debug, 15);
|
return errorWin->showWindow(15, QString("[MainWindow] : [profileTabCreateProfile]"));
|
||||||
errorWin->show();
|
if (tuntapWid->isOk() == 2)
|
||||||
return;
|
return errorWin->showWindow(15, QString("[MainWindow] : [profileTabCreateProfile]"));
|
||||||
}
|
|
||||||
if (tuntapWid->isOk() == 2) {
|
|
||||||
errorWin = new ErrorWindow(this, debug, 15);
|
|
||||||
errorWin->show();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if (generalWid->connectionType->currentText() == QString("vlan")) {
|
else if (generalWid->connectionType->currentText() == QString("vlan")) {
|
||||||
if (ethernetWid->isOk() == 1) {
|
if (ethernetWid->isOk() == 1)
|
||||||
errorWin = new ErrorWindow(this, debug, 7);
|
return errorWin->showWindow(7, QString("[MainWindow] : [profileTabCreateProfile]"));
|
||||||
errorWin->show();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if (generalWid->connectionType->currentText() == QString("macvlan")) {
|
else if (generalWid->connectionType->currentText() == QString("macvlan")) {
|
||||||
if (ethernetWid->isOk() == 1) {
|
if (ethernetWid->isOk() == 1)
|
||||||
errorWin = new ErrorWindow(this, debug, 7);
|
return errorWin->showWindow(7, QString("[MainWindow] : [profileTabCreateProfile]"));
|
||||||
errorWin->show();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ui->tabWidget->setDisabled(true);
|
ui->tabWidget->setDisabled(true);
|
||||||
@ -1333,11 +1257,8 @@ 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);
|
return errorWin->showWindow(1, QString("[MainWindow] : [wifiTabStart]"));
|
||||||
errorWin->show();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (ui->tableWidget_wifi->currentItem() == 0)
|
if (ui->tableWidget_wifi->currentItem() == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -1404,11 +1325,8 @@ 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);
|
return errorWin->showWindow(1, QString("[MainWindow] : [wifiTabRefreshButtons]"));
|
||||||
errorWin->show();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (current == 0) {
|
if (current == 0) {
|
||||||
ui->pushButton_wifiStart->setDisabled(true);
|
ui->pushButton_wifiStart->setDisabled(true);
|
||||||
return;
|
return;
|
||||||
|
Loading…
Reference in New Issue
Block a user