mirror of
https://github.com/arcan1s/netctl-gui.git
synced 2025-04-25 07:57:20 +00:00
added about window
This commit is contained in:
parent
2e35cd356e
commit
2f40ae7913
@ -12,7 +12,6 @@ set (PROJECT_VERSION_PATCH 0)
|
|||||||
set (PROJECT_VERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH})
|
set (PROJECT_VERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH})
|
||||||
string (TIMESTAMP CURRENT_DATE UTC)
|
string (TIMESTAMP CURRENT_DATE UTC)
|
||||||
string (TIMESTAMP CURRENT_YEAR "%Y")
|
string (TIMESTAMP CURRENT_YEAR "%Y")
|
||||||
configure_file (${CMAKE_SOURCE_DIR}/version.h.in ${CMAKE_CURRENT_BINARY_DIR}/version.h)
|
|
||||||
|
|
||||||
message (STATUS "Project: ${PROJECT_NAME}")
|
message (STATUS "Project: ${PROJECT_NAME}")
|
||||||
message (STATUS "Version: ${PROJECT_VERSION}")
|
message (STATUS "Version: ${PROJECT_VERSION}")
|
||||||
@ -41,6 +40,8 @@ else ()
|
|||||||
message (STATUS "Unknown compiler")
|
message (STATUS "Unknown compiler")
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
|
configure_file (${CMAKE_SOURCE_DIR}/version.h.in ${CMAKE_CURRENT_BINARY_DIR}/version.h)
|
||||||
|
|
||||||
# resources
|
# resources
|
||||||
set (PROJECT_LIBRARY netctlgui)
|
set (PROJECT_LIBRARY netctlgui)
|
||||||
set (PROJECT_RESOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/resources)
|
set (PROJECT_RESOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/resources)
|
||||||
|
105
sources/gui/src/about.ui
Normal file
105
sources/gui/src/about.ui
Normal file
@ -0,0 +1,105 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>About</class>
|
||||||
|
<widget class="QWidget" name="About">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>398</width>
|
||||||
|
<height>298</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Form</string>
|
||||||
|
</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">
|
||||||
|
<widget class="QLabel" name="label_license">
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<property name="textFormat">
|
||||||
|
<enum>Qt::RichText</enum>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
<property name="textInteractionFlags">
|
||||||
|
<set>Qt::TextBrowserInteraction</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="5" 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="3" column="0">
|
||||||
|
<widget class="QLabel" name="label_links">
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<property name="textFormat">
|
||||||
|
<enum>Qt::RichText</enum>
|
||||||
|
</property>
|
||||||
|
<property name="openExternalLinks">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="textInteractionFlags">
|
||||||
|
<set>Qt::TextBrowserInteraction</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
92
sources/gui/src/aboutwindow.cpp
Normal file
92
sources/gui/src/aboutwindow.cpp
Normal file
@ -0,0 +1,92 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
* This file is part of netctl-gui *
|
||||||
|
* *
|
||||||
|
* netctl-gui is free software: you can redistribute it and/or *
|
||||||
|
* modify it under the terms of the GNU General Public License as *
|
||||||
|
* published by the Free Software Foundation, either version 3 of the *
|
||||||
|
* License, or (at your option) any later version. *
|
||||||
|
* *
|
||||||
|
* netctl-gui is distributed in the hope that it will be useful, *
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||||
|
* GNU General Public License for more details. *
|
||||||
|
* *
|
||||||
|
* You should have received a copy of the GNU General Public License *
|
||||||
|
* along with netctl-gui. If not, see http://www.gnu.org/licenses/ *
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
#include "aboutwindow.h"
|
||||||
|
#include "ui_aboutwindow.h"
|
||||||
|
|
||||||
|
#include <QDebug>
|
||||||
|
#include <QDialogButtonBox>
|
||||||
|
#include <QPushButton>
|
||||||
|
|
||||||
|
#include "version.h"
|
||||||
|
|
||||||
|
|
||||||
|
AboutWindow::AboutWindow(QWidget *parent, const bool debugCmd)
|
||||||
|
: QMainWindow(parent),
|
||||||
|
ui(new Ui::AboutWindow),
|
||||||
|
debug(debugCmd)
|
||||||
|
{
|
||||||
|
ui->setupUi(this);
|
||||||
|
|
||||||
|
createUi();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
AboutWindow::~AboutWindow()
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << "[AboutWindow]" << "[~AboutWindow]";
|
||||||
|
|
||||||
|
delete uiAbout;
|
||||||
|
delete ui;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void AboutWindow::createText()
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << "[AboutWindow]" << "[createText]";
|
||||||
|
|
||||||
|
uiAbout->label_name->setText(QString(NAME));
|
||||||
|
uiAbout->label_version->setText(QApplication::translate("AboutWindow", "Version %1\n(build date %2)")
|
||||||
|
.arg(QString(VERSION)).arg(QString(BUILD_DATE)));
|
||||||
|
uiAbout->label_description->setText(QApplication::translate("AboutWindow", "Qt-based graphical interface for netctl."));
|
||||||
|
uiAbout->label_links->setText(QApplication::translate("AboutWindow", "Links:") + QString("<br>") +
|
||||||
|
QString("<a href=\"%1\">%2</a><br>").arg(QString(HOMEPAGE)).arg(QApplication::translate("AboutWindow", "Homepage")) +
|
||||||
|
QString("<a href=\"%1\">%2</a><br>").arg(QString(REPOSITORY)).arg(QApplication::translate("AboutWindow", "Repository")) +
|
||||||
|
QString("<a href=\"%1\">%2</a><br>").arg(QString(BUGTRACKER)).arg(QApplication::translate("AboutWindow", "Bugtracker")) +
|
||||||
|
QString("<a href=\"%1\">%2</a><br>").arg(QString(TRANSLATION)).arg(QApplication::translate("AboutWindow", "Translation issue")) +\
|
||||||
|
QString("<a href=\"%1\">%2</a>").arg(QString(AUR_PACKAGES)).arg(QApplication::translate("AboutWindow", "AUR packages")));
|
||||||
|
uiAbout->label_license->setText(QString("<small>© %1 %2<br>").arg(QString(DATE)).arg(QString(AUTHOR)) +
|
||||||
|
QApplication::translate("AboutWindow", "This software is licensed under %1").arg(QString(LICENSE)) +
|
||||||
|
QString("</small>"));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void AboutWindow::createUi()
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << "[AboutWindow]" << "[createUi]";
|
||||||
|
|
||||||
|
QWidget *aboutWidget = new QWidget;
|
||||||
|
uiAbout = new Ui::About;
|
||||||
|
uiAbout->setupUi(aboutWidget);
|
||||||
|
ui->verticalLayout->addWidget(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()));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ESC press event
|
||||||
|
void AboutWindow::keyPressEvent(QKeyEvent *pressedKey)
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << "[AboutWindow]" << "[keyPressEvent]";
|
||||||
|
|
||||||
|
if (pressedKey->key() == Qt::Key_Escape)
|
||||||
|
close();
|
||||||
|
}
|
51
sources/gui/src/aboutwindow.h
Normal file
51
sources/gui/src/aboutwindow.h
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
* This file is part of netctl-gui *
|
||||||
|
* *
|
||||||
|
* netctl-gui is free software: you can redistribute it and/or *
|
||||||
|
* modify it under the terms of the GNU General Public License as *
|
||||||
|
* published by the Free Software Foundation, either version 3 of the *
|
||||||
|
* License, or (at your option) any later version. *
|
||||||
|
* *
|
||||||
|
* netctl-gui is distributed in the hope that it will be useful, *
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||||
|
* GNU General Public License for more details. *
|
||||||
|
* *
|
||||||
|
* You should have received a copy of the GNU General Public License *
|
||||||
|
* along with netctl-gui. If not, see http://www.gnu.org/licenses/ *
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
#ifndef ABOUTWINDOW_H
|
||||||
|
#define ABOUTWINDOW_H
|
||||||
|
|
||||||
|
#include <QKeyEvent>
|
||||||
|
#include <QMainWindow>
|
||||||
|
|
||||||
|
#include "ui_about.h"
|
||||||
|
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class AboutWindow;
|
||||||
|
}
|
||||||
|
|
||||||
|
class AboutWindow : public QMainWindow
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit AboutWindow(QWidget *parent = 0,
|
||||||
|
const bool debugCmd = false);
|
||||||
|
~AboutWindow();
|
||||||
|
|
||||||
|
private:
|
||||||
|
Ui::AboutWindow *ui;
|
||||||
|
Ui::About *uiAbout;
|
||||||
|
bool debug;
|
||||||
|
void createText();
|
||||||
|
void createUi();
|
||||||
|
// ESC pressed event
|
||||||
|
void keyPressEvent(QKeyEvent *pressedKey);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* ABOUTWINDOW_H */
|
22
sources/gui/src/aboutwindow.ui
Normal file
22
sources/gui/src/aboutwindow.ui
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>AboutWindow</class>
|
||||||
|
<widget class="QMainWindow" name="AboutWindow">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>380</width>
|
||||||
|
<height>307</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>About</string>
|
||||||
|
</property>
|
||||||
|
<widget class="QWidget" name="centralwidget">
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout"/>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
@ -55,14 +55,20 @@ int main(int argc, char *argv[])
|
|||||||
bool debug = false;
|
bool debug = false;
|
||||||
bool defaultSettings = false;
|
bool defaultSettings = false;
|
||||||
bool error = false;
|
bool error = false;
|
||||||
|
bool showAbout = false;
|
||||||
bool showHelp = false;
|
bool showHelp = false;
|
||||||
|
bool showInfo = false;
|
||||||
bool showNetctlAuto = false;
|
bool showNetctlAuto = false;
|
||||||
bool showSettings = false;
|
bool showSettings = false;
|
||||||
bool showVersion = false;
|
bool showVersion = false;
|
||||||
int tabNumber = 1;
|
int tabNumber = 1;
|
||||||
for (int i=1; i<argc; i++) {
|
for (int i=1; i<argc; i++) {
|
||||||
|
// about
|
||||||
|
if (QString(argv[i]) == QString("--about")) {
|
||||||
|
showAbout = true;
|
||||||
|
}
|
||||||
// debug
|
// debug
|
||||||
if ((QString(argv[i]) == QString("-d")) || (QString(argv[i]) == QString("--debug"))) {
|
else if ((QString(argv[i]) == QString("-d")) || (QString(argv[i]) == QString("--debug"))) {
|
||||||
debug = true;
|
debug = true;
|
||||||
}
|
}
|
||||||
// default settings
|
// default settings
|
||||||
@ -91,6 +97,10 @@ int main(int argc, char *argv[])
|
|||||||
else if ((QString(argv[i]) == QString("-v")) || (QString(argv[i]) == QString("--version"))) {
|
else if ((QString(argv[i]) == QString("-v")) || (QString(argv[i]) == QString("--version"))) {
|
||||||
showVersion = true;
|
showVersion = true;
|
||||||
}
|
}
|
||||||
|
// info message
|
||||||
|
else if ((QString(argv[i]) == QString("-i")) || (QString(argv[i]) == QString("--info"))) {
|
||||||
|
showInfo = true;
|
||||||
|
}
|
||||||
// help message
|
// help message
|
||||||
else if ((QString(argv[i]) == QString("-h")) || (QString(argv[i]) == QString("--help"))) {
|
else if ((QString(argv[i]) == QString("-h")) || (QString(argv[i]) == QString("--help"))) {
|
||||||
showHelp = true;
|
showHelp = true;
|
||||||
@ -102,37 +112,69 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
// messages
|
// messages
|
||||||
QString errorMessage = QApplication::translate("MainWindow", "Unknown flag\n");
|
QString errorMessage = QApplication::translate("MainWindow", "Unknown flag\n");
|
||||||
|
|
||||||
QString helpMessage = QString("");
|
QString helpMessage = QString("");
|
||||||
helpMessage += QApplication::translate("MainWindow", "Usage:\n");
|
helpMessage += QApplication::translate("MainWindow", "Usage:\n");
|
||||||
helpMessage += QApplication::translate("MainWindow", "netctl-gui [ -d | --debug ] [ --default ] [ --netctl-auto ] [ --settings ]\n");
|
helpMessage += QString("netctl-gui [ --about ] [ -d | --debug ] [ --default ] [ --netctl-auto ]\n");
|
||||||
helpMessage += QApplication::translate("MainWindow", " [ -t NUM | --tab NUM ] [ -v | --version ] [ -h | --help]\n\n");
|
helpMessage += QString(" [ --settings ] [ -t NUM | --tab NUM ] [ -v | --version ]\n");
|
||||||
|
helpMessage += QString(" [ -i | --info ] [ -h | --help]\n\n");
|
||||||
helpMessage += QApplication::translate("MainWindow", "Parametrs:\n");
|
helpMessage += QApplication::translate("MainWindow", "Parametrs:\n");
|
||||||
helpMessage += QApplication::translate("MainWindow", "%1 -d --debug - print debug information\n")
|
helpMessage += QString("%1 --about - %2\n")
|
||||||
.arg(isParametrEnable(debug));
|
.arg(isParametrEnable(showAbout))
|
||||||
helpMessage += QApplication::translate("MainWindow", "%1 --default - start with default settings\n")
|
.arg(QApplication::translate("MainWindow", "show about window"));
|
||||||
.arg(isParametrEnable(defaultSettings));
|
helpMessage += QString("%1 -d --debug - %2\n")
|
||||||
helpMessage += QApplication::translate("MainWindow", "%1 --netctl-auto - show netctl-auto window\n")
|
.arg(isParametrEnable(debug))
|
||||||
.arg(isParametrEnable(showNetctlAuto));
|
.arg(QApplication::translate("MainWindow", "print debug information"));
|
||||||
helpMessage += QApplication::translate("MainWindow", "%1 --settings - show settings window\n")
|
helpMessage += QString("%1 --default - %2\n")
|
||||||
.arg(isParametrEnable(showSettings));
|
.arg(isParametrEnable(defaultSettings))
|
||||||
helpMessage += QApplication::translate("MainWindow", " -t %1 --tab %1 - open a tab with number %1\n")
|
.arg(QApplication::translate("MainWindow", "start with default settings"));
|
||||||
.arg(QString::number(tabNumber));
|
helpMessage += QString("%1 --netctl-auto - %2\n")
|
||||||
helpMessage += QApplication::translate("MainWindow", " -v --version - show version and exit\n");
|
.arg(isParametrEnable(showNetctlAuto))
|
||||||
helpMessage += QApplication::translate("MainWindow", " -h --help - show this help and exit\n");
|
.arg(QApplication::translate("MainWindow", "show netctl-auto window"));
|
||||||
|
helpMessage += QString("%1 --settings - %2\n")
|
||||||
|
.arg(isParametrEnable(showSettings))
|
||||||
|
.arg(QApplication::translate("MainWindow", "show settings window"));
|
||||||
|
helpMessage += QString(" -t %1 --tab %1 - %2\n")
|
||||||
|
.arg(QString::number(tabNumber))
|
||||||
|
.arg(QApplication::translate("MainWindow", "open a tab with number %1").arg(QString::number(tabNumber)));
|
||||||
|
helpMessage += QString(" -v --version - %1\n")
|
||||||
|
.arg(QApplication::translate("MainWindow", "show version and exit"));
|
||||||
|
helpMessage += QString(" -i --info - %1\n")
|
||||||
|
.arg(QApplication::translate("MainWindow", "show build information and exit"));
|
||||||
|
helpMessage += QString(" -h --help - %1\n")
|
||||||
|
.arg(QApplication::translate("MainWindow", "show this help and exit"));
|
||||||
|
|
||||||
|
QString infoMessage = QString("");
|
||||||
|
infoMessage += QApplication::translate("MainWindow", "Build date: %1").
|
||||||
|
arg(QString(BUILD_DATE));
|
||||||
|
infoMessage += QString("\n%1\n").arg(QApplication::translate("MainWindow", "cmake flags:"));
|
||||||
|
infoMessage += QString("\t-DCMAKE_BUILD_TYPE=%1 \\\n").arg(QString(CMAKE_BUILD_TYPE));
|
||||||
|
infoMessage += QString("\t-DCMAKE_INSTALL_PREFIX=%1 \\\n").arg(QString(CMAKE_INSTALL_PREFIX));
|
||||||
|
infoMessage += QString("\t-DBUILD_LIBRARY=%1 \\\n").arg(QString(PROJECT_BUILD_LIBRARY));
|
||||||
|
infoMessage += QString("\t-DBUILD_GUI=%1 \\\n").arg(QString(PROJECT_BUILD_GUI));
|
||||||
|
infoMessage += QString("\t-DUSE_QT5=%1 \\\n").arg(QString(PROJECT_USE_QT5));
|
||||||
|
infoMessage += QString("\t-DBUILD_DATAENGINE=%1 \\\n").arg(QString(PROJECT_BUILD_DATAENGINE));
|
||||||
|
infoMessage += QString("\t-DBUILD_PLASMOID=%1\n").arg(QString(PROJECT_BUILD_PLASMOID));
|
||||||
|
|
||||||
QString versionMessage = QString("");
|
QString versionMessage = QString("");
|
||||||
versionMessage += QApplication::translate("MainWindow", " Netctl GUI\n");
|
versionMessage += QString("%1\n").arg(QString(NAME));
|
||||||
versionMessage += QApplication::translate("MainWindow", "Version : %1 License : GPLv3\n")
|
versionMessage += QApplication::translate("MainWindow", "Version : %1\n").arg(QString(VERSION));
|
||||||
.arg(QString(VERSION));
|
versionMessage += QApplication::translate("MainWindow", "Author : %1\n").arg(QString(AUTHOR));
|
||||||
versionMessage += QApplication::translate("MainWindow", " Evgeniy Alekseev aka arcanis\n");
|
versionMessage += QApplication::translate("MainWindow", "License : %1\n").arg(QString(LICENSE));
|
||||||
versionMessage += QApplication::translate("MainWindow", " E-mail : esalexeev@gmail.com\n");
|
|
||||||
// running
|
// running
|
||||||
if (error) {
|
if (error) {
|
||||||
cout << errorMessage.toUtf8().data();
|
cout << errorMessage.toUtf8().data() << endl;
|
||||||
cout << helpMessage.toUtf8().data();
|
cout << helpMessage.toUtf8().data();
|
||||||
return 127;
|
return 127;
|
||||||
}
|
}
|
||||||
|
if (showInfo) {
|
||||||
|
cout << versionMessage.toUtf8().data() << endl;
|
||||||
|
cout << infoMessage.toUtf8().data();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
if (showHelp) {
|
if (showHelp) {
|
||||||
cout << versionMessage.toUtf8().data();
|
cout << versionMessage.toUtf8().data() << endl;
|
||||||
cout << helpMessage.toUtf8().data();
|
cout << helpMessage.toUtf8().data();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -140,7 +182,7 @@ int main(int argc, char *argv[])
|
|||||||
cout << versionMessage.toUtf8().data();
|
cout << versionMessage.toUtf8().data();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
MainWindow w(0, debug, defaultSettings, showNetctlAuto, showSettings, tabNumber);
|
MainWindow w(0, debug, defaultSettings, showAbout, showNetctlAuto, showSettings, tabNumber);
|
||||||
w.show();
|
w.show();
|
||||||
return a.exec();
|
return a.exec();
|
||||||
}
|
}
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
#include <netctlgui/netctlprofile.h>
|
#include <netctlgui/netctlprofile.h>
|
||||||
#include <netctlgui/wpasupinteract.h>
|
#include <netctlgui/wpasupinteract.h>
|
||||||
|
|
||||||
|
#include "aboutwindow.h"
|
||||||
#include "bridgewidget.h"
|
#include "bridgewidget.h"
|
||||||
#include "errorwindow.h"
|
#include "errorwindow.h"
|
||||||
#include "ethernetwidget.h"
|
#include "ethernetwidget.h"
|
||||||
@ -47,6 +48,7 @@
|
|||||||
MainWindow::MainWindow(QWidget *parent,
|
MainWindow::MainWindow(QWidget *parent,
|
||||||
const bool debugCmd,
|
const bool debugCmd,
|
||||||
const bool defaultSettings,
|
const bool defaultSettings,
|
||||||
|
const bool showAbout,
|
||||||
const bool showNetctlAuto,
|
const bool showNetctlAuto,
|
||||||
const bool showSettings,
|
const bool showSettings,
|
||||||
const int tabNum)
|
const int tabNum)
|
||||||
@ -71,6 +73,7 @@ MainWindow::MainWindow(QWidget *parent,
|
|||||||
configuration = settingsWin->getSettings();
|
configuration = settingsWin->getSettings();
|
||||||
|
|
||||||
// gui
|
// gui
|
||||||
|
aboutWin = new AboutWindow(this, debug);
|
||||||
netctlAutoWin = new NetctlAutoWindow(this, debug, configuration);
|
netctlAutoWin = new NetctlAutoWindow(this, debug, configuration);
|
||||||
generalWid = new GeneralWidget(this, configuration);
|
generalWid = new GeneralWidget(this, configuration);
|
||||||
ui->scrollAreaWidgetContents->layout()->addWidget(generalWid);
|
ui->scrollAreaWidgetContents->layout()->addWidget(generalWid);
|
||||||
@ -104,6 +107,8 @@ MainWindow::MainWindow(QWidget *parent,
|
|||||||
updateTabs(ui->tabWidget->currentIndex());
|
updateTabs(ui->tabWidget->currentIndex());
|
||||||
ui->statusBar->showMessage(QApplication::translate("MainWindow", "Ready"));
|
ui->statusBar->showMessage(QApplication::translate("MainWindow", "Ready"));
|
||||||
|
|
||||||
|
if (showAbout)
|
||||||
|
aboutWin->show();
|
||||||
if (showNetctlAuto)
|
if (showNetctlAuto)
|
||||||
netctlAutoWin->showWindow();
|
netctlAutoWin->showWindow();
|
||||||
if (showSettings)
|
if (showSettings)
|
||||||
@ -131,6 +136,7 @@ MainWindow::~MainWindow()
|
|||||||
delete vlanWid;
|
delete vlanWid;
|
||||||
delete wirelessWid;
|
delete wirelessWid;
|
||||||
|
|
||||||
|
delete aboutWin;
|
||||||
delete netctlAutoWin;
|
delete netctlAutoWin;
|
||||||
delete settingsWin;
|
delete settingsWin;
|
||||||
delete ui;
|
delete ui;
|
||||||
@ -191,6 +197,7 @@ void MainWindow::createActions()
|
|||||||
|
|
||||||
connect(ui->tabWidget, SIGNAL(currentChanged(int)), this, SLOT(updateTabs(int)));
|
connect(ui->tabWidget, SIGNAL(currentChanged(int)), this, SLOT(updateTabs(int)));
|
||||||
connect(ui->tabWidget, SIGNAL(currentChanged(int)), this, SLOT(updateMenu(int)));
|
connect(ui->tabWidget, SIGNAL(currentChanged(int)), this, SLOT(updateMenu(int)));
|
||||||
|
connect(ui->actionAbout, SIGNAL(triggered(bool)), aboutWin, SLOT(show()));
|
||||||
connect(ui->actionNetctlAuto, SIGNAL(triggered(bool)), netctlAutoWin, SLOT(showWindow()));
|
connect(ui->actionNetctlAuto, SIGNAL(triggered(bool)), netctlAutoWin, SLOT(showWindow()));
|
||||||
ui->actionNetctlAuto->setVisible(checkExternalApps(QString("all")));
|
ui->actionNetctlAuto->setVisible(checkExternalApps(QString("all")));
|
||||||
connect(ui->actionSettings, SIGNAL(triggered(bool)), settingsWin, SLOT(showWindow()));
|
connect(ui->actionSettings, SIGNAL(triggered(bool)), settingsWin, SLOT(showWindow()));
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
#include <QTableWidgetItem>
|
#include <QTableWidgetItem>
|
||||||
|
|
||||||
|
|
||||||
|
class AboutWindow;
|
||||||
class BridgeWidget;
|
class BridgeWidget;
|
||||||
class ErrorWindow;
|
class ErrorWindow;
|
||||||
class EthernetWidget;
|
class EthernetWidget;
|
||||||
@ -54,6 +55,7 @@ public:
|
|||||||
explicit MainWindow(QWidget *parent = 0,
|
explicit MainWindow(QWidget *parent = 0,
|
||||||
const bool debugCmd = false,
|
const bool debugCmd = false,
|
||||||
const bool defaultSettings = false,
|
const bool defaultSettings = false,
|
||||||
|
const bool showAbout = false,
|
||||||
const bool showNetctlAuto = false,
|
const bool showNetctlAuto = false,
|
||||||
const bool showSettings = false,
|
const bool showSettings = false,
|
||||||
const int tabNum = 1);
|
const int tabNum = 1);
|
||||||
@ -99,7 +101,11 @@ private slots:
|
|||||||
private:
|
private:
|
||||||
// ui
|
// ui
|
||||||
Ui::MainWindow *ui;
|
Ui::MainWindow *ui;
|
||||||
|
AboutWindow *aboutWin;
|
||||||
|
ErrorWindow *errorWin;
|
||||||
NetctlAutoWindow *netctlAutoWin;
|
NetctlAutoWindow *netctlAutoWin;
|
||||||
|
PasswdWidget *passwdWid;
|
||||||
|
SettingsWindow *settingsWin;
|
||||||
BridgeWidget *bridgeWid;
|
BridgeWidget *bridgeWid;
|
||||||
EthernetWidget *ethernetWid;
|
EthernetWidget *ethernetWid;
|
||||||
GeneralWidget *generalWid;
|
GeneralWidget *generalWid;
|
||||||
@ -115,9 +121,6 @@ private:
|
|||||||
Netctl *netctlCommand;
|
Netctl *netctlCommand;
|
||||||
NetctlProfile *netctlProfile;
|
NetctlProfile *netctlProfile;
|
||||||
WpaSup *wpaCommand;
|
WpaSup *wpaCommand;
|
||||||
ErrorWindow *errorWin;
|
|
||||||
PasswdWidget *passwdWid;
|
|
||||||
SettingsWindow *settingsWin;
|
|
||||||
bool checkExternalApps(const QString apps);
|
bool checkExternalApps(const QString apps);
|
||||||
bool checkState(const QString state, const QString item);
|
bool checkState(const QString state, const QString item);
|
||||||
void createActions();
|
void createActions();
|
||||||
|
@ -6,8 +6,8 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>481</width>
|
<width>479</width>
|
||||||
<height>509</height>
|
<height>507</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
@ -206,8 +206,8 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>449</width>
|
<width>96</width>
|
||||||
<height>353</height>
|
<height>26</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
@ -367,7 +367,7 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>481</width>
|
<width>479</width>
|
||||||
<height>22</height>
|
<height>22</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
@ -398,8 +398,15 @@
|
|||||||
<addaction name="actionMainRemove"/>
|
<addaction name="actionMainRemove"/>
|
||||||
<addaction name="actionProfileRemove"/>
|
<addaction name="actionProfileRemove"/>
|
||||||
</widget>
|
</widget>
|
||||||
|
<widget class="QMenu" name="menuHelp">
|
||||||
|
<property name="title">
|
||||||
|
<string>Help</string>
|
||||||
|
</property>
|
||||||
|
<addaction name="actionAbout"/>
|
||||||
|
</widget>
|
||||||
<addaction name="menuMenu"/>
|
<addaction name="menuMenu"/>
|
||||||
<addaction name="menuActions"/>
|
<addaction name="menuActions"/>
|
||||||
|
<addaction name="menuHelp"/>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QStatusBar" name="statusBar"/>
|
<widget class="QStatusBar" name="statusBar"/>
|
||||||
<action name="actionSettings">
|
<action name="actionSettings">
|
||||||
@ -553,6 +560,14 @@
|
|||||||
<string>netctl-auto</string>
|
<string>netctl-auto</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
|
<action name="actionAbout">
|
||||||
|
<property name="icon">
|
||||||
|
<iconset theme="help-about"/>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>About</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
</widget>
|
</widget>
|
||||||
<tabstops>
|
<tabstops>
|
||||||
<tabstop>tabWidget</tabstop>
|
<tabstop>tabWidget</tabstop>
|
||||||
|
@ -24,12 +24,10 @@
|
|||||||
#include <QTextStream>
|
#include <QTextStream>
|
||||||
|
|
||||||
#include "language.h"
|
#include "language.h"
|
||||||
#include "mainwindow.h"
|
|
||||||
|
|
||||||
|
|
||||||
SettingsWindow::SettingsWindow(MainWindow *wid, const bool debugCmd, const QString configFile)
|
SettingsWindow::SettingsWindow(QWidget *parent, const bool debugCmd, const QString configFile)
|
||||||
: QMainWindow(wid),
|
: QMainWindow(parent),
|
||||||
parent(wid),
|
|
||||||
debug(debugCmd),
|
debug(debugCmd),
|
||||||
file(configFile),
|
file(configFile),
|
||||||
ui(new Ui::SettingsWindow)
|
ui(new Ui::SettingsWindow)
|
||||||
|
@ -34,7 +34,7 @@ class SettingsWindow : public QMainWindow
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit SettingsWindow(MainWindow *wid = 0,
|
explicit SettingsWindow(QWidget *parent = 0,
|
||||||
const bool debugCmd = false,
|
const bool debugCmd = false,
|
||||||
const QString configFile = QString(""));
|
const QString configFile = QString(""));
|
||||||
~SettingsWindow();
|
~SettingsWindow();
|
||||||
@ -62,7 +62,6 @@ private slots:
|
|||||||
void selectWpaSupPath();
|
void selectWpaSupPath();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
MainWindow *parent;
|
|
||||||
bool debug;
|
bool debug;
|
||||||
QString file;
|
QString file;
|
||||||
Ui::SettingsWindow *ui;
|
Ui::SettingsWindow *ui;
|
||||||
|
1
sources/plasmoid/about.ui
Symbolic link
1
sources/plasmoid/about.ui
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../gui/src/about.ui
|
@ -595,10 +595,8 @@ void Netctl::createConfigurationInterface(KConfigDialog *parent)
|
|||||||
uiAppConfig.setupUi(appWidget);
|
uiAppConfig.setupUi(appWidget);
|
||||||
QWidget *deWidget = new QWidget;
|
QWidget *deWidget = new QWidget;
|
||||||
uiDEConfig.setupUi(deWidget);
|
uiDEConfig.setupUi(deWidget);
|
||||||
|
QWidget *aboutWidget = new QWidget;
|
||||||
QString text = QString(NAME) + " - " + QString(VERSION) + "\n" + "(c) " +
|
uiAboutConfig.setupUi(aboutWidget);
|
||||||
QString(DATE) + " " + QString(AUTHOR);
|
|
||||||
uiWidConfig.label_info->setText(text);
|
|
||||||
|
|
||||||
uiWidConfig.spinBox_autoUpdate->setValue(autoUpdateInterval);
|
uiWidConfig.spinBox_autoUpdate->setValue(autoUpdateInterval);
|
||||||
uiWidConfig.lineEdit_gui->setText(paths[QString("gui")]);
|
uiWidConfig.lineEdit_gui->setText(paths[QString("gui")]);
|
||||||
@ -664,9 +662,23 @@ void Netctl::createConfigurationInterface(KConfigDialog *parent)
|
|||||||
uiDEConfig.lineEdit_extIp->setText(deSettings[QString("EXTIPCMD")]);
|
uiDEConfig.lineEdit_extIp->setText(deSettings[QString("EXTIPCMD")]);
|
||||||
setDataEngineExternalIp();
|
setDataEngineExternalIp();
|
||||||
|
|
||||||
|
uiAboutConfig.label_name->setText(QString(NAME));
|
||||||
|
uiAboutConfig.label_version->setText(i18n("Version %1\n(build date %2)", QString(VERSION), QString(BUILD_DATE)));
|
||||||
|
uiAboutConfig.label_description->setText(i18n("KDE widget which interacts with netctl."));
|
||||||
|
uiAboutConfig.label_links->setText(i18n("Links:") + QString("<br>") +
|
||||||
|
QString("<a href=\"%1\">%2</a><br>").arg(QString(HOMEPAGE)).arg(i18n("Homepage")) +
|
||||||
|
QString("<a href=\"%1\">%2</a><br>").arg(QString(REPOSITORY)).arg(i18n("Repository")) +
|
||||||
|
QString("<a href=\"%1\">%2</a><br>").arg(QString(BUGTRACKER)).arg(i18n("Bugtracker")) +
|
||||||
|
QString("<a href=\"%1\">%2</a><br>").arg(QString(TRANSLATION)).arg(i18n("Translation issue")) +
|
||||||
|
QString("<a href=\"%1\">%2</a>").arg(QString(AUR_PACKAGES)).arg(i18n("AUR packages")));
|
||||||
|
uiAboutConfig.label_license->setText(QString("<small>© %1 %2<br>").arg(QString(DATE)).arg(QString(AUTHOR)) +
|
||||||
|
i18n("This software is licensed under %1", QString(LICENSE)) +
|
||||||
|
QString("</small>"));
|
||||||
|
|
||||||
parent->addPage(configWidget, i18n("Netctl plasmoid"), Applet::icon());
|
parent->addPage(configWidget, i18n("Netctl plasmoid"), Applet::icon());
|
||||||
parent->addPage(appWidget, i18n("Appearance"), QString("preferences-desktop-theme"));
|
parent->addPage(appWidget, i18n("Appearance"), QString("preferences-desktop-theme"));
|
||||||
parent->addPage(deWidget, i18n("DataEngine"), Applet::icon());
|
parent->addPage(deWidget, i18n("DataEngine"), Applet::icon());
|
||||||
|
parent->addPage(aboutWidget, i18n("About"), QString("help-about"));
|
||||||
|
|
||||||
connect(uiWidConfig.checkBox_showBigInterface, SIGNAL(stateChanged(int)), this,
|
connect(uiWidConfig.checkBox_showBigInterface, SIGNAL(stateChanged(int)), this,
|
||||||
SLOT(setBigInterface()));
|
SLOT(setBigInterface()));
|
||||||
@ -678,7 +690,7 @@ void Netctl::createConfigurationInterface(KConfigDialog *parent)
|
|||||||
connect(uiWidConfig.pushButton_netctl, SIGNAL(clicked()), this, SLOT(selectNetctlExe()));
|
connect(uiWidConfig.pushButton_netctl, SIGNAL(clicked()), this, SLOT(selectNetctlExe()));
|
||||||
connect(uiWidConfig.pushButton_netctlAuto, SIGNAL(clicked()), this, SLOT(selectNetctlAutoExe()));
|
connect(uiWidConfig.pushButton_netctlAuto, SIGNAL(clicked()), this, SLOT(selectNetctlAutoExe()));
|
||||||
connect(uiWidConfig.pushButton_sudo, SIGNAL(clicked()), this, SLOT(selectSudoExe()));
|
connect(uiWidConfig.pushButton_sudo, SIGNAL(clicked()), this, SLOT(selectSudoExe()));
|
||||||
connect(uiWidConfig.pushButton_wifi, SIGNAL(clicked()), this, SLOT(selecWifiExe()));
|
connect(uiWidConfig.pushButton_wifi, SIGNAL(clicked()), this, SLOT(selectWifiExe()));
|
||||||
connect(uiAppConfig.pushButton_activeIcon, SIGNAL(clicked()), this, SLOT(selectActiveIcon()));
|
connect(uiAppConfig.pushButton_activeIcon, SIGNAL(clicked()), this, SLOT(selectActiveIcon()));
|
||||||
connect(uiAppConfig.pushButton_inactiveIcon, SIGNAL(clicked()), this, SLOT(selectInactiveIcon()));
|
connect(uiAppConfig.pushButton_inactiveIcon, SIGNAL(clicked()), this, SLOT(selectInactiveIcon()));
|
||||||
connect(uiDEConfig.pushButton_extIp, SIGNAL(clicked()), this, SLOT(selectDataEngineExternalIpExe()));
|
connect(uiDEConfig.pushButton_extIp, SIGNAL(clicked()), this, SLOT(selectDataEngineExternalIpExe()));
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
#include <Plasma/Label>
|
#include <Plasma/Label>
|
||||||
#include <QProcess>
|
#include <QProcess>
|
||||||
|
|
||||||
|
#include <ui_about.h>
|
||||||
#include <ui_appearance.h>
|
#include <ui_appearance.h>
|
||||||
#include <ui_dataengine.h>
|
#include <ui_dataengine.h>
|
||||||
#include <ui_widget.h>
|
#include <ui_widget.h>
|
||||||
@ -111,6 +112,7 @@ private:
|
|||||||
Ui::AppearanceWindow uiAppConfig;
|
Ui::AppearanceWindow uiAppConfig;
|
||||||
Ui::DataEngineWindow uiDEConfig;
|
Ui::DataEngineWindow uiDEConfig;
|
||||||
Ui::ConfigWindow uiWidConfig;
|
Ui::ConfigWindow uiWidConfig;
|
||||||
|
Ui::About uiAboutConfig;
|
||||||
// configuration
|
// configuration
|
||||||
int autoUpdateInterval;
|
int autoUpdateInterval;
|
||||||
QMap<QString, bool> bigInterface;
|
QMap<QString, bool> bigInterface;
|
||||||
|
@ -1,10 +1,26 @@
|
|||||||
#ifndef VERSION_H
|
#ifndef VERSION_H
|
||||||
#define VERSION_H
|
#define VERSION_H
|
||||||
|
|
||||||
#define AUTHOR "Evgeniy Alekseev"
|
|
||||||
#define BUILD_DATE "@CURRENT_DATE@"
|
|
||||||
#define DATE "2014-@CURRENT_YEAR@"
|
|
||||||
#define NAME "Netctl Graphical Interface"
|
#define NAME "Netctl Graphical Interface"
|
||||||
#define VERSION "@PROJECT_VERSION@"
|
#define VERSION "@PROJECT_VERSION@"
|
||||||
|
#define AUTHOR "Evgeniy Alekseev"
|
||||||
|
#define LICENSE "GPLv3"
|
||||||
|
|
||||||
|
#define HOMEPAGE "http://arcanis.name/projects/netctl-gui/"
|
||||||
|
#define REPOSITORY "https://github.com/arcan1s/netctl-gui"
|
||||||
|
#define BUGTRACKER "https://github.com/arcan1s/netctl-gui/issues"
|
||||||
|
#define TRANSLATION "https://github.com/arcan1s/netctl-gui/issues/3"
|
||||||
|
#define AUR_PACKAGES "https://aur.archlinux.org/pkgbase/netctl-gui/"
|
||||||
|
|
||||||
|
#define BUILD_DATE "@CURRENT_DATE@"
|
||||||
|
#define DATE "2014-@CURRENT_YEAR@"
|
||||||
|
|
||||||
|
#define CMAKE_BUILD_TYPE "@CMAKE_BUILD_TYPE@"
|
||||||
|
#define CMAKE_INSTALL_PREFIX "@CMAKE_INSTALL_PREFIX@"
|
||||||
|
#define PROJECT_BUILD_DATAENGINE "@BUILD_DATAENGINE@"
|
||||||
|
#define PROJECT_BUILD_GUI "@BUILD_GUI@"
|
||||||
|
#define PROJECT_BUILD_LIBRARY "@BUILD_LIBRARY@"
|
||||||
|
#define PROJECT_BUILD_PLASMOID "@BUILD_PLASMOID@"
|
||||||
|
#define PROJECT_USE_QT5 "@USE_QT5@"
|
||||||
|
|
||||||
#endif /* VERSION_H */
|
#endif /* VERSION_H */
|
||||||
|
Loading…
Reference in New Issue
Block a user