Prepare to release 1.4.1

update docs, update ui
deprecate description function
This commit is contained in:
arcan1s
2015-03-16 05:14:53 +03:00
parent 3f49988cef
commit a2b1d46900
17 changed files with 161 additions and 174 deletions

View File

@ -26,6 +26,9 @@
<property name="text">
<string>netctl-auto is running</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>

View File

@ -121,32 +121,6 @@ Qt::ToolBarArea MainWindow::getToolBarArea()
}
QStringList MainWindow::printInformation()
{
if (debug) qDebug() << PDEBUG;
QStringList output;
output.append(QApplication::translate("MainWindow", "none"));
output.append(QApplication::translate("MainWindow", "(none)"));
netctlCurrent current = printTrayInformation();
if (current.current.isEmpty()) return output;
QStringList profiles;
for (int i=0; i<current.current.count(); i++) {
QString status;
if (current.netctlAuto)
status = QApplication::translate("MainWindow", "(netctl-auto)");
else if (current.enables[i])
status = QApplication::translate("MainWindow", "(enabled)");
else
status = QApplication::translate("MainWindow", "(static)");
profiles.append(QString("%1 %2").arg(current.current[i]).arg(status));
}
return output;
}
QStringList MainWindow::printSettings()
{
if (debug) qDebug() << PDEBUG;
@ -234,7 +208,7 @@ void MainWindow::showMainWindow()
if (debug) qDebug() << PDEBUG;
if (isHidden()) {
updateTabs(ui->stackedWidget->currentIndex());
setTab(ui->stackedWidget->currentIndex());
show();
} else
hide();
@ -336,12 +310,24 @@ void MainWindow::setTab(int tab)
{
if (debug) qDebug() << PDEBUG;
if (debug) qDebug() << PDEBUG << ":" << "Set tab" << tab;
if (ui->stackedWidget->currentWidget() == nullptr) return;
if ((tab > 2) || (tab < 0)) tab = 0;
if (tab == ui->stackedWidget->currentIndex())
updateTabs(tab);
else
ui->stackedWidget->setCurrentIndex(tab);
if (tab != ui->stackedWidget->currentIndex())
return ui->stackedWidget->setCurrentIndex(tab);
switch (tab) {
case 1:
newProfileWidget->update();
break;
case 2:
wifiMenuWidget->update();
break;
case 0:
default:
mainWidget->update();
break;
}
}
@ -426,26 +412,6 @@ void MainWindow::updateConfiguration(const QMap<QString, QVariant> args)
}
void MainWindow::updateTabs(const int tab)
{
if (debug) qDebug() << PDEBUG;
if (debug) qDebug() << PDEBUG << ":" << "Update tab" << tab;
switch (tab) {
case 1:
newProfileWidget->update();
break;
case 2:
wifiMenuWidget->update();
break;
case 0:
default:
mainWidget->update();
break;
}
}
void MainWindow::updateToolBarState(const Qt::ToolBarArea area)
{
if (debug) qDebug() << PDEBUG;
@ -460,27 +426,17 @@ void MainWindow::updateToolBarState(const Qt::ToolBarArea area)
// private slots
void MainWindow::setMainTab()
void MainWindow::setTabByAction(QAction *action)
{
if (debug) qDebug() << PDEBUG;
if (action == nullptr) return;
return setTab(0);
}
void MainWindow::setProfileTab()
{
if (debug) qDebug() << PDEBUG;
return setTab(1);
}
void MainWindow::setWifiTab()
{
if (debug) qDebug() << PDEBUG;
return setTab(2);
if (action == ui->actionNetctl)
setTab(0);
else if (action == ui->actionProfiles)
setTab(1);
else if (action == ui->actionWiFi_menu)
setTab(2);
}
@ -513,10 +469,8 @@ void MainWindow::createActions()
{
if (debug) qDebug() << PDEBUG;
connect(ui->toolBar, SIGNAL(actionTriggered(QAction *)), this, SLOT(setTabByAction(QAction *)));
connect(ui->actionNetctl_auto, SIGNAL(triggered()), this, SLOT(showNetctlAutoWindow()));
connect(ui->actionNetctl, SIGNAL(triggered()), this, SLOT(setMainTab()));
connect(ui->actionProfiles, SIGNAL(triggered()), this, SLOT(setProfileTab()));
connect(ui->actionWiFi_menu, SIGNAL(triggered()), this, SLOT(setWifiTab()));
connect(ui->stackedWidget, SIGNAL(currentChanged(int)), this, SLOT(setTab(int)));
connect(this, SIGNAL(needToBeConfigured()), this, SLOT(showSettingsWindow()));
@ -572,9 +526,9 @@ void MainWindow::createObjects()
trayIcon = new TrayIcon(this, configuration, debug);
// windows
ui->retranslateUi(this);
ui->layout_main->addWidget(mainWidget);
ui->layout_new->addWidget(newProfileWidget);
ui->layout_wifi->addWidget(wifiMenuWidget);
ui->stackedWidget->addWidget(mainWidget);
ui->stackedWidget->addWidget(newProfileWidget);
ui->stackedWidget->addWidget(wifiMenuWidget);
updateToolBarState(static_cast<Qt::ToolBarArea>(configuration[QString("MAIN_TOOLBAR")].toInt()));
aboutWin = new AboutWindow(this, debug);
settingsWin = new SettingsWindow(this, debug, configPath);
@ -585,6 +539,9 @@ void MainWindow::deleteObjects()
{
if (debug) qDebug() << PDEBUG;
// workaround to avoid crash on window closing
disconnect(ui->stackedWidget, SIGNAL(currentChanged(int)), this, SLOT(setTab(int)));
QDBusConnection::sessionBus().unregisterObject(DBUS_OBJECT_PATH);
QDBusConnection::sessionBus().unregisterService(DBUS_SERVICE);
if (netctlCommand != nullptr) delete netctlCommand;

View File

@ -48,7 +48,6 @@ public:
QTranslator *appTranslator = 0);
~MainWindow();
Qt::ToolBarArea getToolBarArea();
QStringList printInformation();
QStringList printSettings();
netctlCurrent printTrayInformation();
bool isHelperActive();
@ -83,16 +82,16 @@ public slots:
void showMessage(const bool status);
void storeToolBars();
void updateConfiguration(const QMap<QString, QVariant> args = QMap<QString, QVariant>());
void updateTabs(const int tab);
void updateToolBarState(const Qt::ToolBarArea area = Qt::TopToolBarArea);
signals:
void needToBeConfigured();
void needShowAboutWindow();
void needShowNetctlAutoWindow();
void needShowSettingsWindow();
private slots:
void setMainTab();
void setProfileTab();
void setWifiTab();
void setTabByAction(QAction *action);
void reportABug();
private:

View File

@ -23,27 +23,6 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
<widget class="QWidget" name="page_main">
<layout class="QVBoxLayout" name="layout_main">
<property name="margin">
<number>0</number>
</property>
</layout>
</widget>
<widget class="QWidget" name="page_new">
<layout class="QVBoxLayout" name="layout_new">
<property name="margin">
<number>0</number>
</property>
</layout>
</widget>
<widget class="QWidget" name="page_wifi">
<layout class="QVBoxLayout" name="layout_wifi">
<property name="margin">
<number>0</number>
</property>
</layout>
</widget>
</widget>
</item>
</layout>

View File

@ -54,12 +54,6 @@ bool NetctlGuiAdaptor::Close()
}
QStringList NetctlGuiAdaptor::Information()
{
return mainWindow->printInformation();
}
void NetctlGuiAdaptor::LibraryDocs()
{
return mainWindow->showLibrary();

View File

@ -37,7 +37,6 @@ public slots:
bool Active();
void ApiDocs();
bool Close();
QStringList Information();
void LibraryDocs();
QString Pony();
bool Restore();

View File

@ -188,9 +188,10 @@ void TrayIcon::enableProfileTraySlot()
{
if (debug) qDebug() << PDEBUG;
QString profile = mainWindow->printInformation()[0];
QStringList profiles = mainWindow->printTrayInformation().current;
if (profiles.isEmpty()) return;
enableProfileSlot(profile, mainWindow->netctlInterface, useHelper, debug);
enableProfileSlot(profiles[0], mainWindow->netctlInterface, useHelper, debug);
}
@ -198,9 +199,10 @@ void TrayIcon::restartProfileTraySlot()
{
if (debug) qDebug() << PDEBUG;
QString profile = mainWindow->printInformation()[0];
QStringList profiles = mainWindow->printTrayInformation().current;
if (profiles.isEmpty()) return;
restartProfileSlot(profile, mainWindow->netctlInterface, useHelper, debug);
restartProfileSlot(profiles[0], mainWindow->netctlInterface, useHelper, debug);
}
@ -208,7 +210,13 @@ void TrayIcon::startProfileTraySlot(QAction *action)
{
if (debug) qDebug() << PDEBUG;
QString profile = action == nullptr ? mainWindow->printInformation()[0] : action->text().remove(QChar('&'));
QString profile;
if (action == nullptr) {
QStringList profiles = mainWindow->printTrayInformation().current;
if (profiles.isEmpty()) return;
profile = profiles[0];
} else
profile = action->text().remove(QChar('&'));
startProfileSlot(profile, mainWindow->netctlInterface, useHelper, debug);
}
@ -227,7 +235,8 @@ void TrayIcon::switchToProfileTraySlot(QAction *action)
if (debug) qDebug() << PDEBUG;
if (action == nullptr) return;
QString profile = action->text().remove(QChar('&'));
QStringList profiles = mainWindow->printTrayInformation().current;
if (profiles.isEmpty()) return;
switchToProfileSlot(profile, mainWindow->netctlInterface, useHelper, debug);
switchToProfileSlot(profiles[0], mainWindow->netctlInterface, useHelper, debug);
}