Przeglądaj źródła

Use icons depending on the backend

Klaas Freitag 14 lat temu
rodzic
commit
71873df369

+ 13 - 0
mirall.qrc

@@ -0,0 +1,13 @@
+<RCC>
+    <qresource prefix="/new/mirall">
+        <file>resources/ownCloud-32.png</file>
+        <file>resources/ownCloud-48.png</file>
+        <file>resources/ownCloud-64.png</file>
+        <file>resources/ownCloud-128.png</file>
+        <file>resources/folder-grey-32.png</file>
+        <file>resources/folder-remote-32.png</file>
+        <file>resources/folder-grey-22.png</file>
+        <file>resources/folder-remote-22.png</file>
+        <file>resources/ownCloud-22.png</file>
+    </qresource>
+</RCC>

BIN
resources/folder-green.png


BIN
resources/folder-grey-22.png


BIN
resources/folder-grey-32.png


BIN
resources/folder-grey.png


BIN
resources/folder-remote-22.png


BIN
resources/folder-remote-32.png


BIN
resources/folder-remote.png


BIN
resources/ownCloud-128.png


BIN
resources/ownCloud-22.png


BIN
resources/ownCloud-24.png


BIN
resources/ownCloud-32.png


BIN
resources/ownCloud-48.png


BIN
resources/ownCloud-64.png


+ 15 - 1
src/mirall/folder.cpp

@@ -203,7 +203,7 @@ void Folder::slotSyncFinished(const SyncResult &result)
   _lastSyncResult = result;
 
   _watcher->setEventsEnabled(true);
-  _openAction->setIcon(QIcon::fromTheme(FOLDER_ICON));
+  _openAction->setIcon(icon(22));
   // reenable the poll timer
   qDebug() << "* " << alias() << "Poll timer enabled";
   _pollTimer->start();
@@ -212,6 +212,20 @@ void Folder::slotSyncFinished(const SyncResult &result)
 void Folder::setBackend( const QString& b )
 {
   _backend = b;
+  if( _openAction ) {
+    _openAction->setIcon( icon(22) );
+  }
+}
+
+QIcon Folder::icon( int size ) const
+{
+  QString name;
+
+  if( _backend == "sitecopy") name = QString( "ownCloud-%1.png" ).arg(size);
+  if( _backend == "unison" ) name = QString( "folder-%1.png" ).arg(size);
+  if( _backend == "csync" ) name = QString("folder-remote-%1.png").arg(size);
+
+  return QIcon( QString( ":/new/mirall/resources/%1").arg(name) );
 }
 
 QString Folder::backend() const

+ 2 - 0
src/mirall/folder.h

@@ -25,6 +25,7 @@
 
 class QAction;
 class QTimer;
+class QIcon;
 
 namespace Mirall {
 
@@ -124,6 +125,7 @@ public:
      */
      QString backend() const;
 
+     QIcon icon( int size ) const;
 protected:
     /**
      * The minimum amounts of seconds to wait before