added icons for the buttons v0.1.1
authorLukas Hrazky <lukkash@email.cz>
Wed, 21 Jul 2010 21:32:13 +0000 (23:32 +0200)
committerLukas Hrazky <lukkash@email.cz>
Wed, 21 Jul 2010 21:41:10 +0000 (23:41 +0200)
Signed-off-by: Lukas Hrazky <lukkash@email.cz>

13 files changed:
debian/changelog
debian/control
debian/install
pixmaps/default/clone.xpm [new file with mode: 0644]
pixmaps/default/copy.xpm [new file with mode: 0644]
pixmaps/default/delete.xpm [new file with mode: 0644]
pixmaps/default/go_up.xpm [new file with mode: 0644]
pixmaps/default/move.xpm [new file with mode: 0644]
pixmaps/default/swap.xpm [new file with mode: 0644]
src/button.cpp
src/button.h
src/case.cpp
src/pane.cpp

index 835fe8d..722e93f 100644 (file)
@@ -1,3 +1,9 @@
+case (0.1.1) unstable; urgency=low
+
+  * Added icons for the buttons
+
+ -- Lukas Hrazky <lukkash@email.cz>  Wed, 21 Jul 2010 23:33:54 +0200
+
 case (0.1.0) unstable; urgency=low
 
   * First release
index b8d544c..17a661f 100644 (file)
@@ -132,3 +132,5 @@ XB-Maemo-Icon-26:
  pPji1Kr4JSFDziowC844FwkQBoFdT1zPCdAghMM6IZyGprM7c1zDIpzElw6n
  ITi7bcVZwOBCEA4HqXDrQk/gEoGUkXJT72ZC/h9bZg7QiEKVqwAAAABJRU5E
  rkJggg==
+XB-Maemo-Upgrade-Description:
+ - added icons for the buttons
index 5a1cba6..610f541 100644 (file)
@@ -1,3 +1,4 @@
 case usr/bin/
 case.desktop usr/share/applications/hildon/
 case.png usr/share/pixmaps/
+pixmaps/* usr/share/pixmaps/case/
diff --git a/pixmaps/default/clone.xpm b/pixmaps/default/clone.xpm
new file mode 100644 (file)
index 0000000..81cab6a
--- /dev/null
@@ -0,0 +1,54 @@
+/* XPM */
+static char * clone_xpm[] = {
+"48 48 3 1",
+"      c None",
+".     c #FFFFFF",
+"+     c #0000FF",
+"                                                ",
+"                                                ",
+"                                                ",
+"                                                ",
+"                                                ",
+"                                                ",
+"                                                ",
+"                                                ",
+"                                                ",
+"                                                ",
+"                                                ",
+"                                                ",
+"                                                ",
+"                   .......                      ",
+"               ....+++++++...                   ",
+"             ..++++++++++++++..                 ",
+"            .++++++++++++++++++..               ",
+"           .++++..........+++++++.              ",
+"          .+++..          ..++++++..        .   ",
+"         .+++.              ..++++++.      ..   ",
+"        .++..                 .++++++.    .+.   ",
+"       .++.                    .++++++.  .++.   ",
+"      .++.                      .++++++..+++.   ",
+"     .++.                        .++++++++++.   ",
+"     .+.                          .+++++++++.   ",
+"    .+.                            .++++++++.   ",
+"    .+.                             .+++++++.   ",
+"   .+.                             .++++++++.   ",
+"   ..                             .+++++++++.   ",
+"                                 .++++++++++.   ",
+"                                .+++++++++++.   ",
+"                               ..............   ",
+"                                                ",
+"                                                ",
+"                                                ",
+"                                                ",
+"                                                ",
+"                                                ",
+"                                                ",
+"                                                ",
+"                                                ",
+"                                                ",
+"                                                ",
+"                                                ",
+"                                                ",
+"                                                ",
+"                                                ",
+"                                                "};
diff --git a/pixmaps/default/copy.xpm b/pixmaps/default/copy.xpm
new file mode 100644 (file)
index 0000000..da0f8ea
--- /dev/null
@@ -0,0 +1,54 @@
+/* XPM */
+static char * copy_xpm[] = {
+"48 48 3 1",
+"      c None",
+".     c #FFFFFF",
+"+     c #0000FF",
+"                                                ",
+"                                                ",
+"                                                ",
+"                                                ",
+"                                                ",
+"                                                ",
+"                                                ",
+"                     ....                       ",
+"                     .++.                       ",
+"                     .++.                       ",
+"                     .++.                       ",
+"                 .....++.....                   ",
+"                 .++++++++++.                   ",
+"                 .++++++++++.                   ",
+"                 .....++.....                   ",
+"                     .++.                       ",
+"                     .++.                       ",
+"                     .++.                       ",
+"                     ....      ..               ",
+"                               .+.              ",
+"                               .++.             ",
+"                               .+++.            ",
+"         .......................++++.           ",
+"         .+++++++++++++++++++++++++++.          ",
+"         .++++++++++++++++++++++++++++.         ",
+"         .+++++++++++++++++++++++++++++.        ",
+"         .++++++++++++++++++++++++++++.         ",
+"         .+++++++++++++++++++++++++++.          ",
+"         .......................++++.           ",
+"                               .+++.            ",
+"                               .++.             ",
+"                               .+.              ",
+"                               ..               ",
+"                                                ",
+"                                                ",
+"                                                ",
+"  ...................      ...................  ",
+"  .+++++++++++++++++.      .+++++++++++++++++.  ",
+"  .+++++++++++++++++.      .+++++++++++++++++.  ",
+"  .+++++++++++++++++.      .+++++++++++++++++.  ",
+"  ...................      ...................  ",
+"                                                ",
+"                                                ",
+"                                                ",
+"                                                ",
+"                                                ",
+"                                                ",
+"                                                "};
diff --git a/pixmaps/default/delete.xpm b/pixmaps/default/delete.xpm
new file mode 100644 (file)
index 0000000..75a3597
--- /dev/null
@@ -0,0 +1,54 @@
+/* XPM */
+static char * delete_xpm[] = {
+"48 48 3 1",
+"      c None",
+".     c #FFFFFF",
+"+     c #0000FF",
+"                                                ",
+"                                                ",
+"                                                ",
+"                                                ",
+"                                                ",
+"                                                ",
+"                                                ",
+"                                                ",
+"                                                ",
+"                                                ",
+"                                                ",
+"                                                ",
+"                     ..          ..             ",
+"                    .++.        .++.            ",
+"                   .++++.      .++++.           ",
+"                  .++++++.    .++++++.          ",
+"                   .++++++.  .++++++.           ",
+"                    .++++++..++++++.            ",
+"                     .++++++++++++.             ",
+"                      .++++++++++.              ",
+"                       .++++++++.               ",
+"                        .++++++.                ",
+"                       .++++++++.               ",
+"                      .++++++++++.              ",
+"                     .++++++++++++.             ",
+"                    .++++++..++++++.            ",
+"                   .++++++.  .++++++.           ",
+"                  .++++++.    .++++++.          ",
+"                   .++++.      .++++.           ",
+"                    .++.        .++.            ",
+"                     ..          ..             ",
+"                                                ",
+"                                                ",
+"                                                ",
+"                                                ",
+"                                                ",
+"  . . . . . . . . . .                           ",
+"                                                ",
+"  .                 .                           ",
+"                                                ",
+"  . . . . . . . . . .                           ",
+"                                                ",
+"                                                ",
+"                                                ",
+"                                                ",
+"                                                ",
+"                                                ",
+"                                                "};
diff --git a/pixmaps/default/go_up.xpm b/pixmaps/default/go_up.xpm
new file mode 100644 (file)
index 0000000..caa7a7f
--- /dev/null
@@ -0,0 +1,54 @@
+/* XPM */
+static char * go_up_xpm[] = {
+"48 48 3 1",
+"      c None",
+".     c #FFFFFF",
+"+     c #0000FF",
+"                                                ",
+"                                                ",
+"                                                ",
+"                                                ",
+"                                                ",
+"                                                ",
+"                                                ",
+"                                                ",
+"                                                ",
+"                                                ",
+"                                                ",
+"                                                ",
+"                .                               ",
+"               .+.                              ",
+"              .+++.                             ",
+"             .+++++.                            ",
+"            .+++++++.                           ",
+"           .+++++++++.                          ",
+"          .+++++++++++.                         ",
+"         .+++++++++++++.                        ",
+"         .....+++++.....                        ",
+"             .+++++.                            ",
+"             .+++++.                            ",
+"             .+++++.                            ",
+"             .+++++.                            ",
+"             .+++++.                            ",
+"             .+++++.                            ",
+"             .+++++.                            ",
+"             .+++++.                            ",
+"             .+++++.                            ",
+"             .+++++....................         ",
+"             .++++++++++++++++++++++++.         ",
+"             .++++++++++++++++++++++++.         ",
+"             .++++++++++++++++++++++++.         ",
+"             .++++++++++++++++++++++++.         ",
+"             ..........................         ",
+"                                                ",
+"                                                ",
+"                                                ",
+"                                                ",
+"                                                ",
+"                                                ",
+"                                                ",
+"                                                ",
+"                                                ",
+"                                                ",
+"                                                ",
+"                                                "};
diff --git a/pixmaps/default/move.xpm b/pixmaps/default/move.xpm
new file mode 100644 (file)
index 0000000..7c35f70
--- /dev/null
@@ -0,0 +1,54 @@
+/* XPM */
+static char * move_xpm[] = {
+"48 48 3 1",
+"      c None",
+".     c #FFFFFF",
+"+     c #0000FF",
+"                                                ",
+"                                                ",
+"                                                ",
+"                                                ",
+"                                                ",
+"                                                ",
+"                                                ",
+"                                                ",
+"                                                ",
+"                                                ",
+"                                                ",
+"                                                ",
+"                                                ",
+"                                                ",
+"                                                ",
+"                                                ",
+"                               ..               ",
+"                               .+.              ",
+"                               .++.             ",
+"                               .+++.            ",
+"         .......................++++.           ",
+"         .+++++++++++++++++++++++++++.          ",
+"         .++++++++++++++++++++++++++++.         ",
+"         .+++++++++++++++++++++++++++++.        ",
+"         .++++++++++++++++++++++++++++.         ",
+"         .+++++++++++++++++++++++++++.          ",
+"         .......................++++.           ",
+"                               .+++.            ",
+"                               .++.             ",
+"                               .+.              ",
+"                               ..               ",
+"                                                ",
+"                                                ",
+"                                                ",
+"                                                ",
+"                                                ",
+"  . . . . . . . . . .      ...................  ",
+"                           .+++++++++++++++++.  ",
+"  .                 .      .+++++++++++++++++.  ",
+"                           .+++++++++++++++++.  ",
+"  . . . . . . . . . .      ...................  ",
+"                                                ",
+"                                                ",
+"                                                ",
+"                                                ",
+"                                                ",
+"                                                ",
+"                                                "};
diff --git a/pixmaps/default/swap.xpm b/pixmaps/default/swap.xpm
new file mode 100644 (file)
index 0000000..f41301f
--- /dev/null
@@ -0,0 +1,54 @@
+/* XPM */
+static char * swap_xpm[] = {
+"48 48 3 1",
+"      c None",
+".     c #FFFFFF",
+"+     c #0000FF",
+"                                                ",
+"                                                ",
+"                                                ",
+"                                                ",
+"                                                ",
+"                   .........                    ",
+"                ...+++++++++..                  ",
+"               .++++++++++++++..                ",
+"             ..+++++++++++++++++..              ",
+"            .+++++++......++++++++.             ",
+"           .+++++...      ..+++++++.            ",
+"          .++++..           ..++++++.     ..    ",
+"         .+++..               .++++++.   .+.    ",
+"        .+++.                  ..+++++. .++.    ",
+"       .+++.                     .+++++.+++.    ",
+"      .+++.                       .++++++++.    ",
+"     .+++.                         .+++++++.    ",
+"     .++.                           .++++++.    ",
+"    .++.                           .+++++++.    ",
+"    .+.                           .++++++++.    ",
+"    ..                           .+++++++++.    ",
+"                                 ...........    ",
+"                                                ",
+"                                                ",
+"                                                ",
+"                                                ",
+"    ...........                                 ",
+"    .+++++++++.                           ..    ",
+"    .++++++++.                           .+.    ",
+"    .+++++++.                           .++.    ",
+"    .++++++.                           .++.     ",
+"    .+++++++.                         .+++.     ",
+"    .++++++++.                       .+++.      ",
+"    .+++.+++++.                     .+++.       ",
+"    .++. .+++++..                  .+++.        ",
+"    .+.   .++++++.               ..+++.         ",
+"    ..     .++++++..           ..++++.          ",
+"            .+++++++..      ...+++++.           ",
+"             .++++++++......+++++++.            ",
+"              ..+++++++++++++++++..             ",
+"                ..++++++++++++++.               ",
+"                  ..+++++++++...                ",
+"                    .........                   ",
+"                                                ",
+"                                                ",
+"                                                ",
+"                                                ",
+"                                                "};
index 90bfd8e..d883c84 100644 (file)
 
 #include "button.h"
 
+#include <iostream>
+
+#define ICON_PATH QString("/usr/share/pixmaps/case/")
+#define ICON_SET "default"
 
-Button::Button(QWidget *parent, const int maxWidth, const int maxHeight) : QPushButton(parent) {
-    setMaximumWidth(maxWidth);
-    setMaximumHeight(maxHeight);
-}
 
-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);
+
+    QImage iconImage(ICON_PATH + ICON_SET + "/" + name + ".xpm", "XPM");
+    if (iconImage.isNull()) iconImage.load(ICON_PATH + ICON_SET + "/" + name + ".png", "PNG");
+    if (iconImage.isNull()) iconImage.load(ICON_PATH + ICON_SET + "/" + name + ".gif", "GIF");
+
+    iconImage = iconImage.convertToFormat(QImage::Format_Indexed8);
+
+    QRgb buttonText = palette().color(QPalette::ButtonText).rgb();
+    QRgb highlight = palette().color(QPalette::Highlight).rgb();
+    QVector<QRgb> colorTable = iconImage.colorTable();
+    for (QVector<QRgb>::iterator it = colorTable.begin(); it != colorTable.end(); ++it) {
+        if ((*it & 0xFFFFFF) == 0xFFFFFF) *it = (*it & 0xFF000000) | buttonText;
+        else if ((*it & 0xFFFFFF) == 0x0000FF) *it = (*it & 0xFF000000) | highlight;
+    }
+    iconImage.setColorTable(colorTable);
+
+    icons[0] = QIcon(QPixmap::fromImage(iconImage));
+    icons[1] = QIcon(QPixmap::fromImage(iconImage.mirrored(true, false)));
+
+    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]);
 }
index de4b822..2c0de27 100644 (file)
@@ -25,9 +25,14 @@ class Button : public QPushButton {
     Q_OBJECT
 
 public:
-    explicit Button(QWidget *parent = 0, int maxWidth = 70, int maxHeight = 70);
-    explicit Button(const QString &text, QWidget *parent = 0, const int maxWidth = 70, const int maxHeight = 70);
-    explicit Button(const QIcon &icon, const QString &text, QWidget *parent = 0, const int maxWidth = 70, const int maxHeight = 70);
+    explicit Button(const QString &name, QWidget *parent = 0, const int maxWidth = 70, const int maxHeight = 70);
+
+public slots:
+    void swapIcon();
+
+protected:
+    QIcon icons[2];
+    int iconIndex;
 };
 
 #endif // BUTTON_H
index 231e230..bac6bac 100644 (file)
@@ -27,11 +27,11 @@ Case::Case(QWidget *parent) :
     rightPane(new Pane(this)),
     activePane(leftPane),
     inactivePane(rightPane),
-    cloneBtn(new Button(">", 0, 60, 70)),
-    swapBtn(new Button("<>", 0, 60, 70)),
-    copyBtn(new Button("cp>", 0, 60, 70)),
-    moveBtn(new Button("mv>", 0, 60, 70)),
-    delBtn(new Button("rm", 0, 60, 70)),
+    cloneBtn(new Button("clone", 0, 60, 70)),
+    swapBtn(new Button("swap", 0, 60, 70)),
+    copyBtn(new Button("copy", 0, 60, 70)),
+    moveBtn(new Button("move", 0, 60, 70)),
+    delBtn(new Button("delete", 0, 60, 70)),
     fileOperator(new FileOperator(this))
 {
     QVBoxLayout *layout = new QVBoxLayout;
@@ -83,15 +83,11 @@ void Case::switchActivePane() {
     activePane = inactivePane;
     inactivePane = tmpPane;
 
-    if (leftPane == activePane) {
-        cloneBtn->setText(">");
-        copyBtn->setText("cp>");
-        moveBtn->setText("mv>");
-    } else {
-        cloneBtn->setText("<");
-        copyBtn->setText("<cp");
-        moveBtn->setText("<mv");
-    }
+    cloneBtn->swapIcon();
+    swapBtn->swapIcon();
+    copyBtn->swapIcon();
+    moveBtn->swapIcon();
+    delBtn->swapIcon();
 
     emit activePaneSwitched();
 }
index 34ec244..67039c0 100644 (file)
@@ -32,7 +32,7 @@ Pane::Pane(QWidget *theCase, QWidget *parent) :
     theCase(theCase),
     active(false),
     location(new AddressBar),
-    up(new Button("^", 0, 70, 60)),
+    up(new Button("go_up", 0, 70, 60)),
     fileList(new FileList)
 {
     QVBoxLayout *layout = new QVBoxLayout;