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

@ -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)