new style for the progressbars, display more info
[case] / src / button.cpp
index 19e78a3..0f61a21 100644 (file)
@@ -1,5 +1,5 @@
 // case - file manager for N900
-// Copyright (C) 2010 Lukas Hrazky
+// Copyright (C) 2010 Lukas Hrazky <lukkash@email.cz>
 // 
 // This program is free software: you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
 
 #include "button.h"
 
+#include <iostream>
 
-Button::Button(QWidget *parent, const int maxWidth, const int maxHeight) : QPushButton(parent) {
-    setMaximumWidth(maxWidth);
-    setMaximumHeight(maxHeight);
-}
+#include "utils.h"
 
-Button::Button(const QString &text, QWidget *parent, const int maxWidth, const int maxHeight) :
-    QPushButton(text, parent)
+
+Button::Button(const QString &name, QWidget *parent, const int maxWidth, const int maxHeight) :
+    QPushButton(parent),
+    iconIndex(0)
 {
     setMaximumWidth(maxWidth);
     setMaximumHeight(maxHeight);
+
+    loadMiddleButtonIcons(palette(), name, icons[0], icons[1]);
+
+    setIcon(icons[0]);
 }
 
-Button::Button(const QIcon &icon, const QString &text, QWidget *parent, const int maxWidth, const int maxHeight) :
-    QPushButton(icon, text, parent)
-{
-    setMaximumWidth(maxWidth);
-    setMaximumHeight(maxHeight);
+
+void Button::swapIcon() {
+    iconIndex = (iconIndex + 1) % 2;
+    setIcon(icons[iconIndex]);
 }