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() {
pkgdesc="Helper daemon for netctl-gui. A part of netctl-gui"
depends=('libnetctlgui')
depends=("libnetctlgui=${pkgver}")
provides=('netctlgui-helper-qt4')
conflicts=('netctlgui-helper-qt4')
backup=('etc/netctl-gui.conf'
@ -85,7 +85,7 @@ package_netctlgui-helper() {
package_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'
'netctlgui-helper: DBus helper daemon')
provides=('netctl-gui-qt4')

View File

@ -73,7 +73,7 @@ package_libnetctlgui-qt4() {
package_netctlgui-helper-qt4() {
pkgdesc="Helper daemon for netctl-gui. A part of netctl-gui"
depends=('libnetctlgui-qt4')
depends=("libnetctlgui-qt4=${pkgver}")
provides=('netctlgui-helper')
conflicts=('netctlgui-helper')
backup=('etc/netctl-gui.conf'
@ -87,7 +87,7 @@ package_netctlgui-helper-qt4() {
package_netctl-gui-qt4() {
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'
'netctlgui-helper-qt4: DBus helper daemon')
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_DEBUG "-g -O0")
set (CMAKE_CXX_FLAGS_RELEASE "-O2 -DNDEBUG")
# avoid newer gcc warnings
add_definitions (-D_DEFAULT_SOURCE)
else ()
message (STATUS "Unknown compiler")
endif ()

View File

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

View File

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

View File

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