summaryrefslogtreecommitdiffstats
path: root/src/item.cpp
diff options
context:
space:
mode:
authorPascal Viandier <midi-pascal@videotron.ca>2015-10-01 19:38:38 +0200
committerSlávek Banko <slavek.banko@axis.cz>2015-10-01 19:38:38 +0200
commit1e0e72fceb542e4eb984b50f747c38314f055b8f (patch)
tree40d35ec3682c465348f8d8d73509aeda4729a8bb /src/item.cpp
parentc9e33e7d3fcd5b21a00e13dcbb5742a6c8da6106 (diff)
downloadkooldock-1e0e72fceb542e4eb984b50f747c38314f055b8f.tar.gz
kooldock-1e0e72fceb542e4eb984b50f747c38314f055b8f.zip
Fix remaining issues and build warnings
Cleanup code Signed-off-by: Pascal Viandier <midi-pascal@videotron.ca>
Diffstat (limited to 'src/item.cpp')
-rw-r--r--src/item.cpp155
1 files changed, 62 insertions, 93 deletions
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<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)));
}
}
}
id = 0;
- animed = FALSE;
+ animed = false;
}
-
Item::Item(const TQString& fileName, int minSize, int maxSize)
{
TQString line;
TQFile in(fileName);
in.open(IO_ReadOnly);
- 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="))
- {
+ 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; i<count; i++)
- {
- if (i % SIZE_INC == 0)
- {
+ icons.setAutoDelete(true);
+ for (int i = 0; i < count; i++) {
+ if (i % SIZE_INC == 0) {
icons.append(new TQPixmap(icon.smoothScale(minSize + i, minSize + i)));
}
}
}
id = 0;
- animed = FALSE;
+ animed = false;
}
Item::Item(const TQPixmap& iconBig, WId id, const TQString& name, int minSize, int maxSize, bool wi)
{
setId(id);
this->name = 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<count; i++)
- {
- if (i % SIZE_INC == 0)
- {
- if (wi)
- {icons.append(new TQPixmap(icon));}
- else
- {
+ icons.setAutoDelete(true);
+ for (int i = 0; i < count; i++) {
+ if (i % SIZE_INC == 0) {
+ if (wi) {
+ icons.append(new TQPixmap(icon));
+ }
+ else {
icons.append(new TQPixmap(icon.scale(minSize + i, minSize + i)));
}
-//moothS
}
}
}
- animed = FALSE;
+ animed = false;
}
Item::~Item()
@@ -160,64 +137,59 @@ Item::~Item()
TQPixmap* Item::getIcon(int size)
{
- if ((size >= 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;
}