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_wifi->setColumnHidden(3, true);
|
||||
ui->tableWidget_wifi->setColumnHidden(4, true);
|
||||
ui->tabWidget->setCurrentIndex(tabNum-1);
|
||||
aboutWin = new AboutWindow(this, debug);
|
||||
errorWin = new ErrorWindow(this, debug);
|
||||
netctlAutoWin = new NetctlAutoWindow(this, debug, configuration);
|
||||
@ -129,16 +128,16 @@ MainWindow::MainWindow(QWidget *parent,
|
||||
wirelessWid = new WirelessWidget(this, configuration);
|
||||
ui->scrollAreaWidgetContents->layout()->addWidget(wirelessWid);
|
||||
|
||||
setTab(tabNum-1);
|
||||
createActions();
|
||||
setIconsToTabs();
|
||||
updateTabs(ui->tabWidget->currentIndex());
|
||||
|
||||
if (showAbout)
|
||||
aboutWin->show();
|
||||
showAboutWindow();
|
||||
if (showNetctlAuto)
|
||||
netctlAutoWin->showWindow();
|
||||
showNetctlAutoWindow();
|
||||
if (showSettings)
|
||||
settingsWin->showWindow();
|
||||
showSettingsWindow();
|
||||
|
||||
if (selectEssid != QString("ESSID")) {
|
||||
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())
|
||||
netctlAutoWin->showWindow();
|
||||
else
|
||||
netctlAutoWin->hide();
|
||||
aboutWin->show();
|
||||
}
|
||||
|
||||
|
||||
@ -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)
|
||||
{
|
||||
if (debug) qDebug() << "[MainWindow]" << "[updateTabs]";
|
||||
|
@ -68,12 +68,13 @@ public:
|
||||
const int tabNum = 1);
|
||||
~MainWindow();
|
||||
QString getInformation();
|
||||
bool isNetctlAutoWindowHidden();
|
||||
QStringList getSettings();
|
||||
|
||||
protected:
|
||||
void closeEvent(QCloseEvent *event);
|
||||
|
||||
public slots:
|
||||
void setTab(const int tab);
|
||||
void updateTabs(const int tab);
|
||||
void updateMenu();
|
||||
// wifi tab slots
|
||||
@ -81,8 +82,10 @@ public slots:
|
||||
void setHiddenName(const QString name);
|
||||
// actions from trayicon
|
||||
void closeMainWindow();
|
||||
void showNetctlAutoWindow();
|
||||
void showAboutWindow();
|
||||
void showMainWindow();
|
||||
void showNetctlAutoWindow();
|
||||
void showSettingsWindow();
|
||||
|
||||
private slots:
|
||||
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()
|
||||
{
|
||||
if (debug) qDebug() << "[NetctlGuiAdaptor]" << "[RestoreWindow]";
|
||||
@ -43,3 +60,47 @@ bool NetctlGuiAdaptor::RestoreWindow()
|
||||
mainWindow->show();
|
||||
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
|
||||
|
||||
#include <QDBusAbstractAdaptor>
|
||||
#include <QStringList>
|
||||
|
||||
|
||||
class MainWindow;
|
||||
@ -34,7 +35,14 @@ public:
|
||||
~NetctlGuiAdaptor();
|
||||
|
||||
public slots:
|
||||
bool Close();
|
||||
QString Information();
|
||||
bool RestoreWindow();
|
||||
QStringList Settings();
|
||||
bool ShowAbout();
|
||||
bool ShowMain();
|
||||
bool ShowNetctlAuto();
|
||||
bool ShowSettings();
|
||||
|
||||
private:
|
||||
bool debug;
|
||||
|
@ -120,10 +120,6 @@ void TrayIcon::itemActivated(const QSystemTrayIcon::ActivationReason reason)
|
||||
showMainWindow->setText(QApplication::translate("TrayIcon", "Show"));
|
||||
else
|
||||
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;
|
||||
default:
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user