From 1e0e72fceb542e4eb984b50f747c38314f055b8f Mon Sep 17 00:00:00 2001 From: Pascal Viandier Date: Thu, 1 Oct 2015 19:38:38 +0200 Subject: Fix remaining issues and build warnings Cleanup code Signed-off-by: Pascal Viandier --- src/item.cpp | 155 ++++++++++++++++++++++++----------------------------------- 1 file changed, 62 insertions(+), 93 deletions(-) (limited to 'src/item.cpp') diff --git a/src/item.cpp b/src/item.cpp index 2687da0..ad43c7e 100644 --- a/src/item.cpp +++ b/src/item.cpp @@ -24,134 +24,111 @@ #include "item.h" -Item::Item(const TQString& iconName, const TQString& cmd, const TQString& name, int minSize, int maxSize) { +Item::Item(const TQString& iconName, const TQString& cmd, const TQString& name, int minSize, int maxSize) +{ iLoader = TDEGlobal::iconLoader(); command = cmd; this->name = name; - mCount=0; - mIndex=0; - mMIndex=0; - mClass=""; + mCount = 0; + mIndex = 0; + mMIndex = 0; + mClass = ""; this->minSize = minSize; this->maxSize = maxSize; this->iconName = iconName; TQImage icon(iLoader->loadIcon(iconName, TDEIcon::NoGroup, 64).convertToImage()); - if (minSize <= maxSize) - { + if (minSize <= maxSize) { int count = maxSize - minSize + 1; - - icons.setAutoDelete(TRUE); + icons.setAutoDelete(true); - for(int i=0; i 0) - { - while (in.readLine(line, MAX_LEN) != -1) - { - if(line.startsWith("Exec=")) - { + mCount = 0; + mIndex = 0; + mMIndex = 0; + mClass = ""; + if (in.readLine(line, MAX_LEN) != -1) { + if (line.contains("[Desktop Entry]", false) > 0) { + while (in.readLine(line, MAX_LEN) != -1) { + if (line.startsWith("Exec=")) { command = line.mid(5).stripWhiteSpace(); } - else if(line.startsWith("Icon=")) - { + else if(line.startsWith("Icon=")) { iconName = line.mid(5).stripWhiteSpace(); } - else if(line.startsWith("Name=")) - { + else if(line.startsWith("Name=")) { name = line.mid(5).stripWhiteSpace(); } } } } - in.close(); - iLoader = TDEGlobal::iconLoader(); this->minSize = minSize; this->maxSize = maxSize; this->filename = fileName; - mCount=0; - mIndex=0; - mMIndex=0; - mClass=""; + mCount = 0; + mIndex = 0; + mMIndex = 0; + mClass = ""; TQImage icon(iLoader->loadIcon(iconName, TDEIcon::NoGroup, 64).convertToImage()); - if (minSize <= maxSize) - { + if (minSize <= maxSize) { int count = maxSize - minSize + 1; - - icons.setAutoDelete(TRUE); - - for(int i=0; iname = name; - mCount=0; - mIndex=0; - mMIndex=0; - mClass=""; + mCount = 0; + mIndex = 0; + mMIndex = 0; + mClass = ""; this->minSize = minSize; this->maxSize = maxSize; command = ""; - wIcon=wi; + wIcon = wi; TQImage icon(iconBig.convertToImage()); - if(minSize <= maxSize) - { + if(minSize <= maxSize) { int count = maxSize - minSize + 1; - - icons.setAutoDelete(TRUE); - - for(int i=0; i= minSize) && (size <= maxSize)) - { + if ((size >= minSize) && (size <= maxSize)) { int d = size - minSize; - return(icons.at(d / SIZE_INC)); - - //return(new TQPixmap (icons.at(maxSize-minSize)->convertToImage().scale(size,size))); + return icons.at(d / SIZE_INC); } - else - { - return(0); + else { + return 0; } } TQString Item::getCommand() { - return(command); + return command; } TQString Item::getName() { - return(name); + return name; } TQCString Item::getClass() { - return(mClass); + return mClass; } int Item::getCount() { - return(mCount); + return mCount; } int Item::getIndex() { - return(mIndex); + return mIndex; } int Item::getMIndex() { - return(mMIndex); + return mMIndex; } TQString Item::getFilename() { - return(filename); + return filename; } WId Item::getId() { - return(id); + return id; } void Item::setId(WId newId) { - info = KWin::windowInfo(newId, 0, NET::WM2AllowedActions); - id=newId; + id = newId; } void Item::setIcon(const TQPixmap& iconBig) @@ -226,13 +198,10 @@ void Item::setIcon(const TQPixmap& iconBig) TQImage icon(iconBig.convertToImage()); int count = maxSize - minSize + 1; - - icons.setAutoDelete(TRUE); + icons.setAutoDelete(true); - for (int i = 0; i < count; i++) - { - if (i % SIZE_INC == 0) - { + for (int i = 0; i < count; i++) { + if (i % SIZE_INC == 0) { icons.append(new TQPixmap(icon.smoothScale(minSize + i, minSize + i))); } } @@ -265,10 +234,10 @@ void Item::setMIndex(int newIndex) bool Item::isAnimed() { - return(this->animed); + return this->animed; } void Item::anim(bool param) { - this->animed=param; + this->animed = param; } -- cgit v1.2.3