update files

add _DEFAULT_SOURCE to avoid warnings
fix cppcheck messages
This commit is contained in:
arcan1s 2015-01-14 00:59:42 +03:00
parent d23429891e
commit 9033c51bb4
6 changed files with 26 additions and 22 deletions

View File

@ -71,7 +71,7 @@ package_libnetctlgui() {
package_netctlgui-helper() { package_netctlgui-helper() {
pkgdesc="Helper daemon for netctl-gui. A part of netctl-gui" pkgdesc="Helper daemon for netctl-gui. A part of netctl-gui"
depends=('libnetctlgui') depends=("libnetctlgui=${pkgver}")
provides=('netctlgui-helper-qt4') provides=('netctlgui-helper-qt4')
conflicts=('netctlgui-helper-qt4') conflicts=('netctlgui-helper-qt4')
backup=('etc/netctl-gui.conf' backup=('etc/netctl-gui.conf'
@ -85,7 +85,7 @@ package_netctlgui-helper() {
package_netctl-gui() { package_netctl-gui() {
pkgdesc="Qt5 graphical front-end for netctl. A part of netctl-gui" pkgdesc="Qt5 graphical front-end for netctl. A part of netctl-gui"
depends=('libnetctlgui' 'xdg-utils') depends=("libnetctlgui=${pkgver}" 'xdg-utils')
optdepends=('plasma-netctl-gui: KF5 widget' optdepends=('plasma-netctl-gui: KF5 widget'
'netctlgui-helper: DBus helper daemon') 'netctlgui-helper: DBus helper daemon')
provides=('netctl-gui-qt4') provides=('netctl-gui-qt4')

View File

@ -73,7 +73,7 @@ package_libnetctlgui-qt4() {
package_netctlgui-helper-qt4() { package_netctlgui-helper-qt4() {
pkgdesc="Helper daemon for netctl-gui. A part of netctl-gui" pkgdesc="Helper daemon for netctl-gui. A part of netctl-gui"
depends=('libnetctlgui-qt4') depends=("libnetctlgui-qt4=${pkgver}")
provides=('netctlgui-helper') provides=('netctlgui-helper')
conflicts=('netctlgui-helper') conflicts=('netctlgui-helper')
backup=('etc/netctl-gui.conf' backup=('etc/netctl-gui.conf'
@ -87,7 +87,7 @@ package_netctlgui-helper-qt4() {
package_netctl-gui-qt4() { package_netctl-gui-qt4() {
pkgdesc="Qt4 graphical front-end for netctl. A part of netctl-gui" pkgdesc="Qt4 graphical front-end for netctl. A part of netctl-gui"
depends=('libnetctlgui-qt4') depends=("libnetctlgui-qt4=${pkgver}")
optdepends=('kdeplasma-applets-netctl-gui: KDE widget' optdepends=('kdeplasma-applets-netctl-gui: KDE widget'
'netctlgui-helper-qt4: DBus helper daemon') 'netctlgui-helper-qt4: DBus helper daemon')
provides=('netctl-gui') provides=('netctl-gui')

View File

@ -55,6 +55,8 @@ if (CMAKE_COMPILER_IS_GNUCXX)
set (CMAKE_CXX_FLAGS "-Wall -std=c++11") set (CMAKE_CXX_FLAGS "-Wall -std=c++11")
set (CMAKE_CXX_FLAGS_DEBUG "-g -O0") set (CMAKE_CXX_FLAGS_DEBUG "-g -O0")
set (CMAKE_CXX_FLAGS_RELEASE "-O2 -DNDEBUG") set (CMAKE_CXX_FLAGS_RELEASE "-O2 -DNDEBUG")
# avoid newer gcc warnings
add_definitions (-D_DEFAULT_SOURCE)
else () else ()
message (STATUS "Unknown compiler") message (STATUS "Unknown compiler")
endif () endif ()

View File

@ -114,7 +114,7 @@ void SettingsWindow::closeWindow()
saveSettings(); saveSettings();
close(); close();
((MainWindow *)parent())->updateConfiguration(); dynamic_cast<MainWindow *>(parent())->updateConfiguration();
} }
@ -467,7 +467,7 @@ void SettingsWindow::startHelper()
{ {
if (debug) qDebug() << PDEBUG; if (debug) qDebug() << PDEBUG;
((MainWindow *)parent())->startHelper(); dynamic_cast<MainWindow *>(parent())->startHelper();
updateHelper(); updateHelper();
} }
@ -476,12 +476,12 @@ void SettingsWindow::updateHelper()
{ {
if (debug) qDebug() << PDEBUG; if (debug) qDebug() << PDEBUG;
if (((MainWindow *)parent())->isHelperServiceActive()) { if (dynamic_cast<MainWindow *>(parent())->isHelperServiceActive()) {
ui->label_status->setText(QApplication::translate("SettingsWindow", "Active (systemd)")); ui->label_status->setText(QApplication::translate("SettingsWindow", "Active (systemd)"));
ui->pushButton_status->setText(QApplication::translate("SettingsWindow", "Stop")); ui->pushButton_status->setText(QApplication::translate("SettingsWindow", "Stop"));
ui->pushButton_status->setIcon(QIcon::fromTheme("process-stop")); ui->pushButton_status->setIcon(QIcon::fromTheme("process-stop"));
ui->pushButton_status->setDisabled(true); ui->pushButton_status->setDisabled(true);
} else if (((MainWindow *)parent())->isHelperActive()) { } else if (dynamic_cast<MainWindow *>(parent())->isHelperActive()) {
ui->label_status->setText(QApplication::translate("SettingsWindow", "Active")); ui->label_status->setText(QApplication::translate("SettingsWindow", "Active"));
ui->pushButton_status->setText(QApplication::translate("SettingsWindow", "Stop")); ui->pushButton_status->setText(QApplication::translate("SettingsWindow", "Stop"));
ui->pushButton_status->setIcon(QIcon::fromTheme("process-stop")); ui->pushButton_status->setIcon(QIcon::fromTheme("process-stop"));

View File

@ -30,7 +30,7 @@ TrayIcon::TrayIcon(QObject *parent, const bool debugCmd)
: QSystemTrayIcon(parent), : QSystemTrayIcon(parent),
debug(debugCmd) debug(debugCmd)
{ {
mainWindow = (MainWindow *)parent; mainWindow = dynamic_cast<MainWindow *>(parent);
init(); init();
} }

View File

@ -98,22 +98,22 @@ protected:
private: private:
// ui // ui
QWidget *graphicsWidget; QWidget *graphicsWidget = nullptr;
QHBoxLayout *layout; QHBoxLayout *layout = nullptr;
IconLabel *iconLabel; IconLabel *iconLabel = nullptr;
QLabel *textLabel; QLabel *textLabel = nullptr;
// information // information
bool status; bool status = false;
QMap<QString, QString> info; QMap<QString, QString> info;
QStringList profileList; QStringList profileList;
// context menu // context menu
void createActions(); void createActions();
QList<QAction*> menuActions; QList<QAction*> menuActions;
QMenu *startProfileMenu; QMenu *startProfileMenu = nullptr;
QMenu *switchToProfileMenu; QMenu *switchToProfileMenu = nullptr;
QMap<QString, QAction*> contextMenu; QMap<QString, QAction*> contextMenu;
// data engine // data engine
Plasma::DataEngine *netctlEngine; Plasma::DataEngine *netctlEngine = nullptr;
void connectToEngine(); void connectToEngine();
void disconnectFromEngine(); void disconnectFromEngine();
QList<QVariant> sendDBusRequest(const QString cmd, const QList<QVariant> args = QList<QVariant>()); QList<QVariant> sendDBusRequest(const QString cmd, const QList<QVariant> args = QList<QVariant>());
@ -123,13 +123,15 @@ private:
Ui::ConfigWindow uiWidConfig; Ui::ConfigWindow uiWidConfig;
Ui::About uiAboutConfig; Ui::About uiAboutConfig;
// configuration // configuration
int autoUpdateInterval; int autoUpdateInterval = 1000;
bool bigInterface; bool bigInterface = true;
bool debug; bool debug = false;
QString textPattern; QString textPattern = QString();
QStringList formatLine; QStringList formatLine;
QMap<QString, QString> paths; QMap<QString, QString> paths;
bool useHelper, useSudo, useWifi; bool useHelper = true;
bool useSudo = false;
bool useWifi = false;
}; };
K_EXPORT_PLASMA_APPLET(netctl, Netctl) K_EXPORT_PLASMA_APPLET(netctl, Netctl)