From 77649eee774e6f71da886d5c72a616a0b46e08fa Mon Sep 17 00:00:00 2001 From: Pascal Viandier Date: Thu, 1 Oct 2015 18:01:36 +0200 Subject: Fix FTBFS with newer GCC Signed-off-by: Pascal Viandier --- src/apppropprg.h | 6 +++++- src/item.cpp | 12 ++++++------ src/item.h | 12 ++++++------ src/kooldock.cpp | 25 +++++++++++++++++-------- src/kooldock.h | 20 ++++++++++++++------ src/main.cpp | 2 +- src/xosd.cpp | 9 +++++---- src/xosd.h | 8 ++++---- 8 files changed, 58 insertions(+), 36 deletions(-) diff --git a/src/apppropprg.h b/src/apppropprg.h index cc8124f..a1ab103 100644 --- a/src/apppropprg.h +++ b/src/apppropprg.h @@ -27,7 +27,11 @@ Q_OBJECT appPropPrg(QWidget *parent = 0, const char *name = 0); ~appPropPrg(); - void addFile(QString filename, QString iconname, QString execname, QString name, bool notify); + void addFile(const QString& filename, + const QString& iconname, + const QString& execname, + const QString& name, + bool notify); public slots: void accept(); diff --git a/src/item.cpp b/src/item.cpp index 1de9cf7..809dd99 100644 --- a/src/item.cpp +++ b/src/item.cpp @@ -24,7 +24,7 @@ #include "item.h" -Item::Item(QString iconName, QString cmd, QString name, int minSize, int maxSize) { +Item::Item(const QString& iconName, const QString& cmd, const QString& name, int minSize, int maxSize) { iLoader = KGlobal::iconLoader(); command = cmd; this->name = name; @@ -57,7 +57,7 @@ Item::Item(QString iconName, QString cmd, QString name, int minSize, int maxSize } -Item::Item(QString fileName, int minSize, int maxSize) +Item::Item(const QString& fileName, int minSize, int maxSize) { QString line; QFile in(fileName); @@ -118,7 +118,7 @@ Item::Item(QString fileName, int minSize, int maxSize) animed = FALSE; } -Item::Item(QPixmap iconBig, WId id, QString name, int minSize, int maxSize, bool wi) +Item::Item(const QPixmap& iconBig, WId id, const QString& name, int minSize, int maxSize, bool wi) { setId(id); this->name = name; @@ -220,7 +220,7 @@ void Item::setId(WId newId) id=newId; } -void Item::setIcon(QPixmap iconBig) +void Item::setIcon(const QPixmap& iconBig) { icons.clear(); QImage icon(iconBig.convertToImage()); @@ -238,12 +238,12 @@ void Item::setIcon(QPixmap iconBig) } } -void Item::setName(QString newName) +void Item::setName(const QString& newName) { name = newName; } -void Item::setClass(QCString newClass) +void Item::setClass(const QCString& newClass) { mClass = newClass; } diff --git a/src/item.h b/src/item.h index 27b22b9..2fcfd3a 100644 --- a/src/item.h +++ b/src/item.h @@ -35,12 +35,12 @@ const int SIZE_INC = 1; class Item { public: - Item(QString iconName, QString cmd, QString name, int minSize, int maxSize); - Item(QString fileName, int minSize, int maxSize); - Item(QPixmap iconBig, WId id, QString name, int minSize, int maxSize, bool wi =FALSE); + Item(const QString& iconName, const QString& cmd, const QString& name, int minSize, int maxSize); + Item(const QString& fileName, int minSize, int maxSize); + Item(const QPixmap& iconBig, WId id, const QString& name, int minSize, int maxSize, bool wi =FALSE); ~Item(); - void setIcon(QPixmap iconBig); + void setIcon(const QPixmap& iconBig); QPixmap* getIcon(int size); QString getCommand(); @@ -54,8 +54,8 @@ class Item void setId(WId newId); QString getFilename(); - void setName(QString newName); - void setClass(QCString newClass); + void setName(const QString& newName); + void setClass(const QCString& newClass); void setCount(int newCount); void setIndex(int newIndex); void setMIndex(int newIndex); diff --git a/src/kooldock.cpp b/src/kooldock.cpp index 58a0831..fb9cc9c 100644 --- a/src/kooldock.cpp +++ b/src/kooldock.cpp @@ -17,6 +17,7 @@ #include #include +#include #include #include @@ -967,7 +968,7 @@ void KoolDock::mPress(int mx, int my, ButtonState srcButton) if ((fMinimizedOnly==0 || winfo.isMinimized()) && (fCurrent==0 || winfo.isOnDesktop(KWin::currentDesktop()))) { KPopupMenu *tmpMenu = new KPopupMenu; - createMenu(item->getId(), tmpMenu, &winfo); + createMenu(tmpMenu, &winfo); connect(tmpMenu, SIGNAL(aboutToShow()), SLOT(menuShow())); popups.append (tmpMenu); appMenu->setItemParameter(appMenu->insertItem(*item->getIcon(iwBig2), item->getName(), tmpMenu), item->getId()); @@ -984,7 +985,7 @@ void KoolDock::mPress(int mx, int my, ButtonState srcButton) else { iGroup=false; - createMenu(cId, appMenu, &winfo); + createMenu(appMenu, &winfo); } appMenu->insertSeparator(); appMenu->insertItem(SmallIcon("forward"), "KoolDock", popup); @@ -1406,7 +1407,7 @@ void KoolDock::edit() } -void KoolDock::run(QString command) +void KoolDock::run(const QString& command) { QString exec; @@ -2878,7 +2879,15 @@ void KoolDock::removeItem() } -void KoolDock::addFile(QString filename, QString iconname, QString execname, QString name, bool notify, bool terminal, bool tclose, bool cuser, QString puser) +void KoolDock::addFile(const QString& filename, + const QString& iconname, + const QString& execname, + const QString& name, + bool notify, + bool terminal, + bool tclose, + bool cuser, + QString puser) { QString progPath = locateLocal("data", "kooldock"); QString menuPath = progPath + QString("/menu/"); @@ -2942,7 +2951,7 @@ void KoolDock::addFile(QString filename, QString iconname, QString execname, QSt } -bool KoolDock::ignored(QString appname) +bool KoolDock::ignored(const QString& appname) { if(ignoreList.count()>0) { @@ -3054,12 +3063,12 @@ void KoolDock::chkRestart() } -void KoolDock::setMainPath(QString path) +void KoolDock::setMainPath(const QString& path) { mainPath = path; } -void KoolDock::setArgs(QString params) +void KoolDock::setArgs(const QString& params) { args = params; if (args=="-options" || args=="-o") editPref(); @@ -3658,7 +3667,7 @@ void KoolDock::aboutToHide() menuCount--; } -void KoolDock::createMenu(WId id, KPopupMenu* tmpMenu, KWin::WindowInfo * info) +void KoolDock::createMenu(KPopupMenu* tmpMenu, KWin::WindowInfo * info) { QString appTitle; int menustate; diff --git a/src/kooldock.h b/src/kooldock.h index af196bd..a129a6f 100644 --- a/src/kooldock.h +++ b/src/kooldock.h @@ -69,8 +69,8 @@ class KoolDock : public QWidget ~KoolDock(); //static bool writeIgnoreList(QString text); - void setMainPath(QString path); - void setArgs(QString param); + void setMainPath(const QString& path); + void setArgs(const QString& param); clip *clipw; private: @@ -251,7 +251,7 @@ class KoolDock : public QWidget int animValue; int animState; - void run(QString cmd); + void run(const QString& cmd); int func(int x); int func2(int x); void doUpdateGeometry(); @@ -267,7 +267,7 @@ class KoolDock : public QWidget void addWindows(); int itemFromPoint(int x); int xFromIndex(int i); - void createMenu(WId id, KPopupMenu* tmpMenu, KWin::WindowInfo* info); + void createMenu(KPopupMenu* tmpMenu, KWin::WindowInfo* info); void updTaskList(); void addToTaskList(WId id); void rmFromTaskList(WId id); @@ -329,8 +329,16 @@ class KoolDock : public QWidget void toggleKeptBelowOthers(); void toggleFullScreen(); - static void addFile(QString filename, QString iconname, QString execname, QString name, bool notify, bool terminal, bool tclose, bool, QString); - bool ignored(QString appname); + static void addFile(const QString& filename, + const QString& iconname, + const QString& execname, + const QString& name, + bool notify = true, + bool terminal = false, + bool tclose = false, + bool cuser = false, + QString = "na"); + bool ignored(const QString& appname); #ifdef _ENABLE_DEBUG static void debug(QString message); diff --git a/src/main.cpp b/src/main.cpp index 411fad6..95f901a 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -38,7 +38,7 @@ extern "C" { char cmd[1024]; fprintf(stderr, "kooldock: crashHandler called\n"); - snprintf(cmd, 1025, "%s &", argv0.ascii()); + snprintf(cmd, 1023, "%s &", argv0.ascii()); system(cmd); // try to restart according to argv[0] } } diff --git a/src/xosd.cpp b/src/xosd.cpp index 656be2d..45d0799 100644 --- a/src/xosd.cpp +++ b/src/xosd.cpp @@ -13,6 +13,7 @@ #include #include +#include xosd::xosd(QWidget *parent, const char *name) : QWidget(parent, name, WStyle_Customize | WRepaintNoErase | WStyle_NoBorder | WDestructiveClose | WResizeNoErase | WMouseNoMask | WStyle_StaysOnTop | WX11BypassWM) { @@ -27,12 +28,12 @@ xosd::~xosd() { } -void xosd::setColor(QString color) +void xosd::setColor(const QString& color) { fontColor=color; } -void xosd::setShadowColor(QString color) +void xosd::setShadowColor(const QString& color) { shadowColor=color; } @@ -68,7 +69,7 @@ void xosd::setShadowOffset(int off) shadowOffset=off; } -void xosd::setText(QString t) +void xosd::setText(const QString& t) { //setMask(QRegion(0,0,0,0)); // NOTICE: it appears that with WX11BypassWM, resize() doesn't flick the widget anymore :) @@ -84,7 +85,7 @@ void xosd::setText(QString t) update(); } -void xosd::setFont(QString font) +void xosd::setFont(const QString& font) { f.setFamily(font); } diff --git a/src/xosd.h b/src/xosd.h index b40d8ab..843a1be 100644 --- a/src/xosd.h +++ b/src/xosd.h @@ -21,13 +21,13 @@ Q_OBJECT xosd(QWidget* parent=0, const char *name=0); virtual ~xosd(); - void setText(QString t); - void setFont(QString font); + void setText(const QString& t); + void setFont(const QString& font); void setItalic(); void setBold(); void setSize(int size); - void setColor(QString color); - void setShadowColor(QString color); + void setColor(const QString& color); + void setShadowColor(const QString& color); void setShadowOffset(int off); void move2(int x, int y); void setOrientation(int orientation, int w, int mh); -- cgit v1.2.1