Code refactoring.

Removed some cflags. Also removed Wshadow as it generates
too many false positives (Fixed in gcc 5.0).
This commit is contained in:
codestation
2015-03-14 23:57:02 -04:30
parent da6ad50759
commit 2cf825a11a
4 changed files with 23 additions and 21 deletions

View File

@@ -58,9 +58,9 @@ RESOURCES += qcmares.qrc translations.qrc
CONFIG += link_pkgconfig CONFIG += link_pkgconfig
PKGCONFIG = libvitamtp libavformat libavcodec libavutil libswscale PKGCONFIG = libvitamtp libavformat libavcodec libavutil libswscale
CXXFLAGS_WARNINGS = -Wall -Wextra -Wshadow -Wcast-align -Wctor-dtor-privacy \ CXXFLAGS_WARNINGS = -Wall -Wextra -Wcast-align \
-Wdisabled-optimization -Wformat=2 -Winit-self -Wmissing-declarations \ -Wdisabled-optimization -Wformat=2 -Winit-self \
-Wmissing-include-dirs -Woverloaded-virtual -Wredundant-decls \ -Wmissing-include-dirs -Woverloaded-virtual \
-Wstrict-overflow=5 -Wundef -Wno-unused -Wno-missing-field-initializers \ -Wstrict-overflow=5 -Wundef -Wno-unused -Wno-missing-field-initializers \
-Wno-format-nonliteral -Wno-format-nonliteral

View File

@@ -58,17 +58,19 @@ bool getDiskSpace(const QString &dir, quint64 *free, quint64 *total)
bool removeRecursively(const QString &path) bool removeRecursively(const QString &path)
{ {
QFileInfo info(path); QFileInfo file_info(path);
if(info.isDir()) { if(file_info.isDir()) {
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) #if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
return QDir(path).removeRecursively(); return QDir(path).removeRecursively();
#else #else
bool result = false; bool result = false;
QDir dir(path); QDir dir(path);
QDir::Filters filter = QDir::NoDotAndDotDot | QDir::System | QDir::Hidden | QDir::AllDirs | QDir::Files;
if(dir.exists(path)) { if(dir.exists(path)) {
Q_FOREACH(QFileInfo info, dir.entryInfoList(QDir::NoDotAndDotDot | QDir::System | QDir::Hidden | QDir::AllDirs | QDir::Files, QDir::DirsFirst)) { foreach(QFileInfo info, dir.entryInfoList(filter, QDir::DirsFirst)) {
if(info.isDir()) { if(info.isDir()) {
result = removeRecursively(info.absoluteFilePath()); result = removeRecursively(info.absoluteFilePath());
} else { } else {

View File

@@ -24,8 +24,8 @@
const int SingleApplication::timeout = 500; const int SingleApplication::timeout = 500;
const QString SingleApplication::SHARED_KEY = "QCMA_KEY"; const QString SingleApplication::SHARED_KEY = "QCMA_KEY";
SingleApplication::SingleApplication(int &argc, char **argv) : SingleApplication::SingleApplication(int &s_argc, char **s_argv) :
QApplication(argc, argv) QApplication(s_argc, s_argv)
{ {
server = new QLocalServer(this); server = new QLocalServer(this);
connect(server, SIGNAL(newConnection()), this, SLOT(receiveMessage())); connect(server, SIGNAL(newConnection()), this, SLOT(receiveMessage()));

View File

@@ -120,19 +120,19 @@ void UnityIndicator::init()
gtk_menu_shell_append(GTK_MENU_SHELL(menu), separator2); gtk_menu_shell_append(GTK_MENU_SHELL(menu), separator2);
gtk_menu_shell_append(GTK_MENU_SHELL(menu), quit); gtk_menu_shell_append(GTK_MENU_SHELL(menu), quit);
gulong handle; gulong gobject_handler;
handle = g_signal_connect(options, "activate", G_CALLBACK(optionsIndicator), this); gobject_handler = g_signal_connect(options, "activate", G_CALLBACK(optionsIndicator), this);
m_handlers.append(QPair<gpointer, gulong>(options, handle)); m_handlers.append(QPair<gpointer, gulong>(options, gobject_handler));
handle = g_signal_connect(reload, "activate", G_CALLBACK(reloadIndicator), this); gobject_handler = g_signal_connect(reload, "activate", G_CALLBACK(reloadIndicator), this);
m_handlers.append(QPair<gpointer, gulong>(reload, handle)); m_handlers.append(QPair<gpointer, gulong>(reload, gobject_handler));
handle = g_signal_connect(backup, "activate", G_CALLBACK(backupIndicator), this); gobject_handler = g_signal_connect(backup, "activate", G_CALLBACK(backupIndicator), this);
m_handlers.append(QPair<gpointer, gulong>(backup, handle)); m_handlers.append(QPair<gpointer, gulong>(backup, gobject_handler));
handle = g_signal_connect(about, "activate", G_CALLBACK(aboutIndicator), this); gobject_handler = g_signal_connect(about, "activate", G_CALLBACK(aboutIndicator), this);
m_handlers.append(QPair<gpointer, gulong>(about, handle)); m_handlers.append(QPair<gpointer, gulong>(about, gobject_handler));
handle = g_signal_connect(about_qt, "activate", G_CALLBACK(aboutQtIndicator), this); gobject_handler = g_signal_connect(about_qt, "activate", G_CALLBACK(aboutQtIndicator), this);
m_handlers.append(QPair<gpointer, gulong>(about_qt, handle)); m_handlers.append(QPair<gpointer, gulong>(about_qt, gobject_handler));
handle = g_signal_connect(quit, "activate", G_CALLBACK(quitIndicator), this); gobject_handler = g_signal_connect(quit, "activate", G_CALLBACK(quitIndicator), this);
m_handlers.append(QPair<gpointer, gulong>(quit, handle)); m_handlers.append(QPair<gpointer, gulong>(quit, gobject_handler));
gtk_widget_show(options); gtk_widget_show(options);
gtk_widget_show(reload); gtk_widget_show(reload);