mirror of
https://github.com/arcan1s/netctl-gui.git
synced 2025-04-24 15:37:23 +00:00
add org.netctlgui.netctlgui /netctlgui
This commit is contained in:
parent
ff78d390ae
commit
86753070e8
@ -101,7 +101,6 @@ MainWindow::MainWindow(QWidget *parent,
|
|||||||
ui->tableWidget_main->setColumnHidden(3, true);
|
ui->tableWidget_main->setColumnHidden(3, true);
|
||||||
ui->tableWidget_wifi->setColumnHidden(3, true);
|
ui->tableWidget_wifi->setColumnHidden(3, true);
|
||||||
ui->tableWidget_wifi->setColumnHidden(4, true);
|
ui->tableWidget_wifi->setColumnHidden(4, true);
|
||||||
ui->tabWidget->setCurrentIndex(tabNum-1);
|
|
||||||
aboutWin = new AboutWindow(this, debug);
|
aboutWin = new AboutWindow(this, debug);
|
||||||
errorWin = new ErrorWindow(this, debug);
|
errorWin = new ErrorWindow(this, debug);
|
||||||
netctlAutoWin = new NetctlAutoWindow(this, debug, configuration);
|
netctlAutoWin = new NetctlAutoWindow(this, debug, configuration);
|
||||||
@ -129,16 +128,16 @@ MainWindow::MainWindow(QWidget *parent,
|
|||||||
wirelessWid = new WirelessWidget(this, configuration);
|
wirelessWid = new WirelessWidget(this, configuration);
|
||||||
ui->scrollAreaWidgetContents->layout()->addWidget(wirelessWid);
|
ui->scrollAreaWidgetContents->layout()->addWidget(wirelessWid);
|
||||||
|
|
||||||
|
setTab(tabNum-1);
|
||||||
createActions();
|
createActions();
|
||||||
setIconsToTabs();
|
setIconsToTabs();
|
||||||
updateTabs(ui->tabWidget->currentIndex());
|
|
||||||
|
|
||||||
if (showAbout)
|
if (showAbout)
|
||||||
aboutWin->show();
|
showAboutWindow();
|
||||||
if (showNetctlAuto)
|
if (showNetctlAuto)
|
||||||
netctlAutoWin->showWindow();
|
showNetctlAutoWindow();
|
||||||
if (showSettings)
|
if (showSettings)
|
||||||
settingsWin->showWindow();
|
showSettingsWindow();
|
||||||
|
|
||||||
if (selectEssid != QString("ESSID")) {
|
if (selectEssid != QString("ESSID")) {
|
||||||
for (int i=0; i<ui->tableWidget_wifi->rowCount(); i++)
|
for (int i=0; i<ui->tableWidget_wifi->rowCount(); i++)
|
||||||
@ -234,11 +233,16 @@ QString MainWindow::getInformation()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool MainWindow::isNetctlAutoWindowHidden()
|
QStringList MainWindow::getSettings()
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << "[MainWindow]" << "[isNetctlAutoWindowHidden]";
|
if (debug) qDebug() << "[MainWindow]" << "[getSettings]";
|
||||||
|
|
||||||
return netctlAutoWin->isHidden();
|
QStringList settingsList;
|
||||||
|
for (int i=0; i<configuration.keys().count(); i++)
|
||||||
|
settingsList.append(configuration.keys()[i] + QString("=") +
|
||||||
|
configuration[configuration.keys()[i]]);
|
||||||
|
|
||||||
|
return settingsList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -452,14 +456,11 @@ void MainWindow::closeMainWindow()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MainWindow::showNetctlAutoWindow()
|
void MainWindow::showAboutWindow()
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << "[MainWindow]" << "[showNetctlAutoWindow]";
|
if (debug) qDebug() << "[MainWindow]" << "[showAboutWindow]";
|
||||||
|
|
||||||
if (netctlAutoWin->isHidden())
|
aboutWin->show();
|
||||||
netctlAutoWin->showWindow();
|
|
||||||
else
|
|
||||||
netctlAutoWin->hide();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -474,6 +475,32 @@ void MainWindow::showMainWindow()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void MainWindow::showNetctlAutoWindow()
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << "[MainWindow]" << "[showNetctlAutoWindow]";
|
||||||
|
|
||||||
|
netctlAutoWin->showWindow();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void MainWindow::showSettingsWindow()
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << "[MainWindow]" << "[showSettingsWindow]";
|
||||||
|
|
||||||
|
settingsWin->showWindow();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void MainWindow::setTab(const int tab)
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << "[MainWindow]" << "[setTab]";
|
||||||
|
if (debug) qDebug() << "[MainWindow]" << "[setTab]" << ":" << "Update tab" << tab;
|
||||||
|
|
||||||
|
ui->tabWidget->setCurrentIndex(tab);
|
||||||
|
updateTabs(tab);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void MainWindow::updateTabs(const int tab)
|
void MainWindow::updateTabs(const int tab)
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << "[MainWindow]" << "[updateTabs]";
|
if (debug) qDebug() << "[MainWindow]" << "[updateTabs]";
|
||||||
|
@ -68,12 +68,13 @@ public:
|
|||||||
const int tabNum = 1);
|
const int tabNum = 1);
|
||||||
~MainWindow();
|
~MainWindow();
|
||||||
QString getInformation();
|
QString getInformation();
|
||||||
bool isNetctlAutoWindowHidden();
|
QStringList getSettings();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void closeEvent(QCloseEvent *event);
|
void closeEvent(QCloseEvent *event);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
void setTab(const int tab);
|
||||||
void updateTabs(const int tab);
|
void updateTabs(const int tab);
|
||||||
void updateMenu();
|
void updateMenu();
|
||||||
// wifi tab slots
|
// wifi tab slots
|
||||||
@ -81,8 +82,10 @@ public slots:
|
|||||||
void setHiddenName(const QString name);
|
void setHiddenName(const QString name);
|
||||||
// actions from trayicon
|
// actions from trayicon
|
||||||
void closeMainWindow();
|
void closeMainWindow();
|
||||||
void showNetctlAutoWindow();
|
void showAboutWindow();
|
||||||
void showMainWindow();
|
void showMainWindow();
|
||||||
|
void showNetctlAutoWindow();
|
||||||
|
void showSettingsWindow();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void reportABug();
|
void reportABug();
|
||||||
|
@ -36,6 +36,23 @@ NetctlGuiAdaptor::~NetctlGuiAdaptor()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool NetctlGuiAdaptor::Close()
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << "[NetctlGuiAdaptor]" << "[Close]";
|
||||||
|
|
||||||
|
mainWindow->closeMainWindow();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QString NetctlGuiAdaptor::Information()
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << "[NetctlGuiAdaptor]" << "[Information]";
|
||||||
|
|
||||||
|
return mainWindow->getInformation();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool NetctlGuiAdaptor::RestoreWindow()
|
bool NetctlGuiAdaptor::RestoreWindow()
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << "[NetctlGuiAdaptor]" << "[RestoreWindow]";
|
if (debug) qDebug() << "[NetctlGuiAdaptor]" << "[RestoreWindow]";
|
||||||
@ -43,3 +60,47 @@ bool NetctlGuiAdaptor::RestoreWindow()
|
|||||||
mainWindow->show();
|
mainWindow->show();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QStringList NetctlGuiAdaptor::Settings()
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << "[NetctlGuiAdaptor]" << "[Settings]";
|
||||||
|
|
||||||
|
return mainWindow->getSettings();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool NetctlGuiAdaptor::ShowAbout()
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << "[NetctlGuiAdaptor]" << "[ShowAbout]";
|
||||||
|
|
||||||
|
mainWindow->showAboutWindow();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool NetctlGuiAdaptor::ShowMain()
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << "[NetctlGuiAdaptor]" << "[ShowMain]";
|
||||||
|
|
||||||
|
mainWindow->showMainWindow();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool NetctlGuiAdaptor::ShowNetctlAuto()
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << "[NetctlGuiAdaptor]" << "[ShowNetctlAuto]";
|
||||||
|
|
||||||
|
mainWindow->showNetctlAutoWindow();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool NetctlGuiAdaptor::ShowSettings()
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << "[NetctlGuiAdaptor]" << "[ShowSettings]";
|
||||||
|
|
||||||
|
mainWindow->showSettingsWindow();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
#define NETCTLGUIADAPTOR_H
|
#define NETCTLGUIADAPTOR_H
|
||||||
|
|
||||||
#include <QDBusAbstractAdaptor>
|
#include <QDBusAbstractAdaptor>
|
||||||
|
#include <QStringList>
|
||||||
|
|
||||||
|
|
||||||
class MainWindow;
|
class MainWindow;
|
||||||
@ -34,7 +35,14 @@ public:
|
|||||||
~NetctlGuiAdaptor();
|
~NetctlGuiAdaptor();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
bool Close();
|
||||||
|
QString Information();
|
||||||
bool RestoreWindow();
|
bool RestoreWindow();
|
||||||
|
QStringList Settings();
|
||||||
|
bool ShowAbout();
|
||||||
|
bool ShowMain();
|
||||||
|
bool ShowNetctlAuto();
|
||||||
|
bool ShowSettings();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool debug;
|
bool debug;
|
||||||
|
@ -120,10 +120,6 @@ void TrayIcon::itemActivated(const QSystemTrayIcon::ActivationReason reason)
|
|||||||
showMainWindow->setText(QApplication::translate("TrayIcon", "Show"));
|
showMainWindow->setText(QApplication::translate("TrayIcon", "Show"));
|
||||||
else
|
else
|
||||||
showMainWindow->setText(QApplication::translate("TrayIcon", "Hide"));
|
showMainWindow->setText(QApplication::translate("TrayIcon", "Hide"));
|
||||||
if (mainWindow->isNetctlAutoWindowHidden())
|
|
||||||
showNetctlAutoWindow->setText(QApplication::translate("TrayIcon", "Show netctl-auto"));
|
|
||||||
else
|
|
||||||
showNetctlAutoWindow->setText(QApplication::translate("TrayIcon", "Hide netctl-auto"));
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user