add docs integration

This commit is contained in:
arcan1s
2014-08-10 11:05:29 +04:00
parent d44979e95e
commit 11db0fcf8d
23 changed files with 684 additions and 127 deletions

View File

@ -6,80 +6,121 @@
<rect>
<x>0</x>
<y>0</y>
<width>388</width>
<height>288</height>
<width>452</width>
<height>361</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="2" column="0">
<widget class="QLabel" name="label_description">
<property name="text">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignJustify|Qt::AlignVCenter</set>
</property>
<property name="textInteractionFlags">
<set>Qt::TextBrowserInteraction</set>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_name">
<property name="text">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="textInteractionFlags">
<set>Qt::TextBrowserInteraction</set>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_version">
<property name="text">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="textInteractionFlags">
<set>Qt::TextBrowserInteraction</set>
</property>
</widget>
</item>
<item row="6" column="0">
<spacer name="spacer_about">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_links">
<property name="text">
<string/>
</property>
<property name="textFormat">
<enum>Qt::RichText</enum>
</property>
<property name="openExternalLinks">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QScrollArea" name="scrollArea">
<property name="widgetResizable">
<bool>true</bool>
</property>
<property name="textInteractionFlags">
<set>Qt::TextBrowserInteraction</set>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>436</width>
<height>324</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QLabel" name="label_name">
<property name="text">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="textInteractionFlags">
<set>Qt::TextBrowserInteraction</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_version">
<property name="text">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="textInteractionFlags">
<set>Qt::TextBrowserInteraction</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_description">
<property name="text">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignJustify|Qt::AlignVCenter</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="textInteractionFlags">
<set>Qt::TextBrowserInteraction</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_translators">
<property name="text">
<string/>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_links">
<property name="text">
<string/>
</property>
<property name="textFormat">
<enum>Qt::RichText</enum>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
<property name="textInteractionFlags">
<set>Qt::TextBrowserInteraction</set>
</property>
</widget>
</item>
<item>
<spacer name="spacer_about">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</widget>
</item>
<item row="7" column="0">
<item>
<widget class="QLabel" name="label_license">
<property name="text">
<string/>
@ -90,6 +131,9 @@
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
@ -98,13 +142,6 @@
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_translators">
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>

View File

@ -79,13 +79,10 @@ void AboutWindow::createUi()
QWidget *aboutWidget = new QWidget();
uiAbout = new Ui::About;
uiAbout->setupUi(aboutWidget);
ui->verticalLayout->addWidget(aboutWidget);
ui->verticalLayout->insertWidget(0, aboutWidget);
createText();
QDialogButtonBox *buttonBox = new QDialogButtonBox;
buttonBox->addButton(QDialogButtonBox::Close);
ui->verticalLayout->addWidget(buttonBox);
connect(buttonBox->button(QDialogButtonBox::Close), SIGNAL(clicked(bool)), this, SLOT(close()));
connect(ui->buttonBox->button(QDialogButtonBox::Close), SIGNAL(clicked(bool)), this, SLOT(close()));
}

View File

@ -6,15 +6,23 @@
<rect>
<x>0</x>
<y>0</y>
<width>380</width>
<height>307</height>
<width>516</width>
<height>431</height>
</rect>
</property>
<property name="windowTitle">
<string>About</string>
</property>
<widget class="QWidget" name="centralwidget">
<layout class="QVBoxLayout" name="verticalLayout"/>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="standardButtons">
<set>QDialogButtonBox::Close</set>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
<resources/>

View File

@ -117,6 +117,39 @@ void MainWindow::showSettingsWindow()
}
void MainWindow::showApi()
{
if (debug) qDebug() << "[MainWindow]" << "[showApi]";
if (QDesktopServices::openUrl(QUrl(QString(DOCS_PATH) + QString("netctl-gui-dbus-api.html"))))
ui->statusBar->showMessage(QApplication::translate("MainWindow", "Done"));
else
ui->statusBar->showMessage(QApplication::translate("MainWindow", "Error"));
}
void MainWindow::showLibrary()
{
if (debug) qDebug() << "[MainWindow]" << "[showLibrary]";
if (QDesktopServices::openUrl(QUrl(QString(DOCS_PATH) + QString("html/index.html"))))
ui->statusBar->showMessage(QApplication::translate("MainWindow", "Done"));
else
ui->statusBar->showMessage(QApplication::translate("MainWindow", "Error"));
}
void MainWindow::showSecurityNotes()
{
if (debug) qDebug() << "[MainWindow]" << "[showSecurityNotes]";
if (QDesktopServices::openUrl(QUrl(QString(DOCS_PATH) + QString("netctl-gui-security-notes.html"))))
ui->statusBar->showMessage(QApplication::translate("MainWindow", "Done"));
else
ui->statusBar->showMessage(QApplication::translate("MainWindow", "Error"));
}
bool MainWindow::forceStartHelper()
{
if (debug) qDebug() << "[MainWindow]" << "[forceStartHelper]";

View File

@ -243,9 +243,12 @@ void MainWindow::createActions()
connect(ui->tabWidget, SIGNAL(currentChanged(int)), this, SLOT(updateTabs(int)));
connect(ui->actionAbout, SIGNAL(triggered(bool)), this, SLOT(showAboutWindow()));
connect(ui->actionApi, SIGNAL(triggered(bool)), this, SLOT(showApi()));
connect(ui->actionLibrary, SIGNAL(triggered(bool)), this, SLOT(showLibrary()));
connect(ui->actionNetctlAuto, SIGNAL(triggered(bool)), this, SLOT(showNetctlAutoWindow()));
connect(ui->actionSettings, SIGNAL(triggered(bool)), this, SLOT(showSettingsWindow()));
connect(ui->actionReport, SIGNAL(triggered(bool)), this, SLOT(reportABug()));
connect(ui->actionSecurity, SIGNAL(triggered(bool)), this, SLOT(showSecurityNotes()));
connect(ui->actionSettings, SIGNAL(triggered(bool)), this, SLOT(showSettingsWindow()));
connect(ui->actionQuit, SIGNAL(triggered(bool)), this, SLOT(closeMainWindow()));
// actions menu
@ -391,17 +394,6 @@ void MainWindow::deleteObjects()
}
void MainWindow::setIconsToTabs()
{
if (debug) qDebug() << "[MainWindow]" << "[setIconsToTabs]";
// tab widget
ui->tabWidget->setTabIcon(0, QIcon(":icon"));
ui->tabWidget->setTabIcon(1, QIcon::fromTheme("document-new"));
ui->tabWidget->setTabIcon(2, QIcon(":wifi"));
}
QMap<QString, QString> MainWindow::parseOptions(const QString options)
{
if (debug) qDebug() << "[MainWindow]" << "[parseOptions]";
@ -464,7 +456,6 @@ void MainWindow::updateConfiguration(const QMap<QString, QVariant> args)
// update ui
setTab(args[QString("tab")].toInt() - 1);
createActions();
setIconsToTabs();
// tray
if (isDaemon)

View File

@ -71,6 +71,10 @@ public slots:
void showMainWindow();
void showNetctlAutoWindow();
void showSettingsWindow();
// open docs
void showApi();
void showLibrary();
void showSecurityNotes();
// helper
bool forceStartHelper();
bool forceStopHelper();
@ -146,7 +150,6 @@ private:
void createObjects();
void deleteObjects();
void keyPressEvent(QKeyEvent *pressedKey);
void setIconsToTabs();
QString configPath;
bool debug = false;
bool hiddenNetwork;

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>475</width>
<height>503</height>
<width>471</width>
<height>499</height>
</rect>
</property>
<property name="windowTitle">
@ -21,6 +21,10 @@
<number>0</number>
</property>
<widget class="QWidget" name="tab_main">
<attribute name="icon">
<iconset resource="../../resources/resources.qrc">
<normaloff>:/icon.png</normaloff>:/icon.png</iconset>
</attribute>
<attribute name="title">
<string>Connect to profile</string>
</attribute>
@ -105,7 +109,9 @@
<string>Refresh</string>
</property>
<property name="icon">
<iconset theme="stock-refresh"/>
<iconset theme="stock-refresh">
<normaloff/>
</iconset>
</property>
<property name="shortcut">
<string>Ctrl+R</string>
@ -137,7 +143,9 @@
<string>Restart</string>
</property>
<property name="icon">
<iconset theme="stock-refresh"/>
<iconset theme="stock-refresh">
<normaloff/>
</iconset>
</property>
<property name="autoDefault">
<bool>true</bool>
@ -153,7 +161,9 @@
<string>Start</string>
</property>
<property name="icon">
<iconset theme="system-run"/>
<iconset theme="system-run">
<normaloff/>
</iconset>
</property>
<property name="autoDefault">
<bool>true</bool>
@ -171,6 +181,9 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
<attribute name="icon">
<iconset theme="document-new"/>
</attribute>
<attribute name="title">
<string>Create a new profile</string>
</attribute>
@ -212,8 +225,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>443</width>
<height>345</height>
<width>439</width>
<height>340</height>
</rect>
</property>
<property name="sizePolicy">
@ -234,7 +247,9 @@
<string>Clear</string>
</property>
<property name="icon">
<iconset theme="edit-clear"/>
<iconset theme="edit-clear">
<normaloff/>
</iconset>
</property>
</widget>
</item>
@ -257,7 +272,9 @@
<string>Save</string>
</property>
<property name="icon">
<iconset theme="document-save"/>
<iconset theme="document-save">
<normaloff/>
</iconset>
</property>
</widget>
</item>
@ -266,6 +283,10 @@
</layout>
</widget>
<widget class="QWidget" name="tab_wifi">
<attribute name="icon">
<iconset resource="../../resources/resources.qrc">
<normaloff>:/wifi.png</normaloff>:/wifi.png</iconset>
</attribute>
<attribute name="title">
<string>Connect to Wi-Fi</string>
</attribute>
@ -342,7 +363,9 @@
<string>Refresh</string>
</property>
<property name="icon">
<iconset theme="stock-refresh"/>
<iconset theme="stock-refresh">
<normaloff/>
</iconset>
</property>
<property name="shortcut">
<string>Ctrl+R</string>
@ -374,7 +397,9 @@
<string>Start</string>
</property>
<property name="icon">
<iconset theme="system-run"/>
<iconset theme="system-run">
<normaloff/>
</iconset>
</property>
<property name="autoDefault">
<bool>true</bool>
@ -394,7 +419,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>475</width>
<width>471</width>
<height>22</height>
</rect>
</property>
@ -429,6 +454,10 @@
<property name="title">
<string>Help</string>
</property>
<addaction name="actionSecurity"/>
<addaction name="actionApi"/>
<addaction name="actionLibrary"/>
<addaction name="separator"/>
<addaction name="actionReport"/>
<addaction name="actionAbout"/>
</widget>
@ -608,6 +637,26 @@
<string>Report a bug</string>
</property>
</action>
<action name="actionApi">
<property name="text">
<string>DBus API reference</string>
</property>
</action>
<action name="actionSecurity">
<property name="icon">
<iconset theme="security-medium">
<normaloff/>
</iconset>
</property>
<property name="text">
<string>Security notes</string>
</property>
</action>
<action name="actionLibrary">
<property name="text">
<string>Library documentation</string>
</property>
</action>
</widget>
<tabstops>
<tabstop>tabWidget</tabstop>
@ -622,6 +671,8 @@
<tabstop>pushButton_wifiRefresh</tabstop>
<tabstop>pushButton_wifiStart</tabstop>
</tabstops>
<resources/>
<resources>
<include location="../../resources/resources.qrc"/>
</resources>
<connections/>
</ui>

View File

@ -136,6 +136,12 @@ QString infoMessage()
infoMessage += QString("\tDBUS_HELPER_INTERFACE=%1\n").arg(QString(DBUS_HELPER_INTERFACE));
infoMessage += QString("\tDBUS_CTRL_PATH=%1\n").arg(QString(DBUS_CTRL_PATH));
infoMessage += QString("\tDBUS_LIB_PATH=%1\n").arg(QString(DBUS_LIB_PATH));
// docs path
infoMessage += QString("%1:\n").arg(QCoreApplication::translate("NetctlHelper", "Documentation"));
infoMessage += QString("\tDOCS_PATH=%1\n").arg(QString(DOCS_PATH));
QStringList docs = QDir(QString(DOCS_PATH)).entryList(QDir::NoDotAndDotDot);
for (int i=0; i<docs.count(); i++)
infoMessage += QString("\t%1\n").arg(docs[i]);
return infoMessage;
}

View File

@ -15,9 +15,9 @@
* along with netctl-gui. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/
#include "netctlguiadaptor.h"
#include "mainwindow.h"
#include "netctlguiadaptor.h"
NetctlGuiAdaptor::NetctlGuiAdaptor(MainWindow *parent)
@ -32,6 +32,12 @@ NetctlGuiAdaptor::~NetctlGuiAdaptor()
}
void NetctlGuiAdaptor::ApiDocs()
{
return mainWindow->showApi();
}
bool NetctlGuiAdaptor::Close()
{
mainWindow->closeMainWindow();
@ -45,6 +51,12 @@ QString NetctlGuiAdaptor::Information()
}
void NetctlGuiAdaptor::LibraryDocs()
{
return mainWindow->showLibrary();
}
bool NetctlGuiAdaptor::Restore()
{
mainWindow->show();
@ -52,6 +64,12 @@ bool NetctlGuiAdaptor::Restore()
}
void NetctlGuiAdaptor::SecurityDocs()
{
return mainWindow->showSecurityNotes();
}
QStringList NetctlGuiAdaptor::Settings()
{
return mainWindow->printSettings();

View File

@ -34,9 +34,12 @@ public:
~NetctlGuiAdaptor();
public slots:
void ApiDocs();
bool Close();
QString Information();
void LibraryDocs();
bool Restore();
void SecurityDocs();
QStringList Settings();
bool ShowAbout();
bool ShowMain();

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>654</width>
<height>315</height>
<width>686</width>
<height>403</height>
</rect>
</property>
<property name="windowTitle">
@ -136,8 +136,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>438</width>
<height>254</height>
<width>470</width>
<height>342</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_7">
@ -211,8 +211,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>438</width>
<height>254</height>
<width>470</width>
<height>342</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_13">
@ -352,6 +352,12 @@
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
@ -829,8 +835,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>438</width>
<height>254</height>
<width>436</width>
<height>252</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_11">