From a0586cda995888258426e7d7bb3c8d5df9802bc4 Mon Sep 17 00:00:00 2001
From: Pieter van der Kloet <pvdkloet@gmail.com>
Date: Tue, 10 May 2011 18:00:15 +0200
Subject: [PATCH] Complete support for fallback icons on Windows using the
 Tango theme

---
 apps/launcher/maindialog.cpp                  |  44 +++++++++---------
 apps/launcher/resources.qrc                   |  12 ++---
 .../resources/icons/tango/document-new.png    | Bin 0 -> 477 bytes
 .../resources/icons/tango/edit-copy.png       | Bin 0 -> 498 bytes
 .../resources/icons/tango/edit-delete.png     | Bin 0 -> 680 bytes
 .../resources/icons/tango/index.theme         |   8 ++++
 .../resources/icons/tango/video-display.png   | Bin 0 -> 2547 bytes
 7 files changed, 37 insertions(+), 27 deletions(-)
 create mode 100644 apps/launcher/resources/icons/tango/document-new.png
 create mode 100644 apps/launcher/resources/icons/tango/edit-copy.png
 create mode 100644 apps/launcher/resources/icons/tango/edit-delete.png
 create mode 100644 apps/launcher/resources/icons/tango/index.theme
 create mode 100644 apps/launcher/resources/icons/tango/video-display.png

diff --git a/apps/launcher/maindialog.cpp b/apps/launcher/maindialog.cpp
index a2ab3aeb6..b5e7a491a 100644
--- a/apps/launcher/maindialog.cpp
+++ b/apps/launcher/maindialog.cpp
@@ -41,16 +41,11 @@ MainDialog::MainDialog()
     buttonBox->setStandardButtons(QDialogButtonBox::Close);
     buttonBox->addButton(playButton, QDialogButtonBox::AcceptRole);
 
-    //QSpacerItem *vSpacer1 = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding);
-
     QVBoxLayout *dialogLayout = new QVBoxLayout(this);
     dialogLayout->addWidget(mIconWidget);
-    //dialogLayout->addItem(vSpacer1);
     dialogLayout->addWidget(groupBox);
-
     dialogLayout->addWidget(buttonBox);
-    //mainLayout->addStretch(1);
-    //mainLayout->addSpacing(12);
+
 
     setWindowTitle(tr("OpenMW Launcher"));
     setWindowIcon(QIcon(":/images/openmw-icon.png"));
@@ -66,23 +61,30 @@ MainDialog::MainDialog()
 
 void MainDialog::createIcons()
 {
-    QListWidgetItem *configButton = new QListWidgetItem(mIconWidget);
-    configButton->setIcon(QIcon(":/images/openmw-icon.png"));
-    configButton->setText(tr("Play"));
-    configButton->setTextAlignment(Qt::AlignCenter);
-    configButton->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
+    if (!QIcon::hasThemeIcon("document-new")) {
+        QIcon::setThemeName("tango");
+    }
 
-    QListWidgetItem *updateButton = new QListWidgetItem(mIconWidget);
-    updateButton->setIcon(QIcon::fromTheme("video-display"));
-    updateButton->setText(tr("Graphics"));
-    updateButton->setTextAlignment(Qt::AlignHCenter | Qt::AlignBottom | Qt::AlignAbsolute);
-    updateButton->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
+    // We create a fallback icon because the default fallback doesn't work
+    QIcon graphicsIcon = QIcon(":/icons/tango/video-display.png");
 
-    QListWidgetItem *queryButton = new QListWidgetItem(mIconWidget);
-    queryButton->setIcon(QIcon(":/images/openmw-plugin-icon.png"));
-    queryButton->setText(tr("Data Files"));
-    queryButton->setTextAlignment(Qt::AlignHCenter | Qt::AlignBottom);
-    queryButton->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
+    QListWidgetItem *playButton = new QListWidgetItem(mIconWidget);
+    playButton->setIcon(QIcon(":/images/openmw-icon.png"));
+    playButton->setText(tr("Play"));
+    playButton->setTextAlignment(Qt::AlignCenter);
+    playButton->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
+
+    QListWidgetItem *graphicsButton = new QListWidgetItem(mIconWidget);
+    graphicsButton->setIcon(QIcon::fromTheme("video-display", graphicsIcon));
+    graphicsButton->setText(tr("Graphics"));
+    graphicsButton->setTextAlignment(Qt::AlignHCenter | Qt::AlignBottom | Qt::AlignAbsolute);
+    graphicsButton->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
+
+    QListWidgetItem *dataFilesButton = new QListWidgetItem(mIconWidget);
+    dataFilesButton->setIcon(QIcon(":/images/openmw-plugin-icon.png"));
+    dataFilesButton->setText(tr("Data Files"));
+    dataFilesButton->setTextAlignment(Qt::AlignHCenter | Qt::AlignBottom);
+    dataFilesButton->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
 
     connect(mIconWidget,
             SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)),
diff --git a/apps/launcher/resources.qrc b/apps/launcher/resources.qrc
index 07e6896dd..7fbf62da2 100644
--- a/apps/launcher/resources.qrc
+++ b/apps/launcher/resources.qrc
@@ -7,11 +7,11 @@
     <file alias="openmw-header.png">resources/images/openmw-header.png</file>
     <file alias="playpage-background.png">resources/images/playpage-background.png</file>
 </qresource>
-<qresource prefix="/icons">
-
-    <file alias="48x48/video-display.png">resources/icons/video-display.png</file>
-    <file alias="16x16/document-new.png">resources/icons/document-new.png</file>
-    <file alias="16x16/edit-copy.png">resources/icons/edit-copy.png</file>
-    <file alias="16x16/edit-delete.png">resources/icons/edit-delete.png</file>
+<qresource prefix="icons/tango">
+    <file alias="index.theme">resources/icons/tango/index.theme</file>
+    <file alias="video-display.png">resources/icons/tango/video-display.png</file>
+    <file alias="16x16/document-new.png">resources/icons/tango/document-new.png</file>
+    <file alias="16x16/edit-copy.png">resources/icons/tango/edit-copy.png</file>
+    <file alias="16x16/edit-delete.png">resources/icons/tango/edit-delete.png</file>
 </qresource>
 </RCC>
diff --git a/apps/launcher/resources/icons/tango/document-new.png b/apps/launcher/resources/icons/tango/document-new.png
new file mode 100644
index 0000000000000000000000000000000000000000..4c3efdd6fa334616f87698708e73b2a5111c3278
GIT binary patch
literal 477
zcmV<30V4j1P)<h;3K|Lk000e1NJLTq000mG000mO1^@s6AM^iV00006VoOIv0Q>;y
z08cd6u?+wK010qNS#tmY3ljhU3ljkVnw%H_000McNliru)dCU@CLGhY87Tk&0cuG^
zK~y-)t&mSkTTu|je{=7RRwR8Tg3!ua7TnbCTxO{o^9{0bS-(ZzvfXzh1jK^hz)d&Z
zDuq%?vQkP(T7(e)MPi%YcgKY$#u$@SdNwl*bLN~gQZARbYqeUD5tyC*%iLU>XVGu+
z%b(xnqHiDJ&%R{C8KqK5$Km{VQ!h{7Xy?43mnSQoi^k%vwzBKmGBd8L(rh*fApjsE
zJ@t&)W7>Wp<Gvzh3F}NI*!F72w_8)rS9=Er$=zz?2y5zyd4;$FU@<C2(_f3=Ub_CQ
zgXHU8Z#oN1fjAHgf&dq8G+78bPtfPsP({;eK+v?J-kW;HrWN<l=evgjukqn0;IUc(
z6z^Z?=~?U3%>4I*kr6}$<tZIqLv?{P{Q*2-Yv<5xY;3;;aHGh#HH+6gB0>~JG#W`y
z)G#6Xf76e95r#Q<h<wMvu%*G-upKk0-LVmJxg3vyi{to1k|f1{A;oe0p8tg_%srW4
Td#n`600000NkvXXu0mjf6Ohl}

literal 0
HcmV?d00001

diff --git a/apps/launcher/resources/icons/tango/edit-copy.png b/apps/launcher/resources/icons/tango/edit-copy.png
new file mode 100644
index 0000000000000000000000000000000000000000..8dd48c494924874a088590a749193994d075c22f
GIT binary patch
literal 498
zcmV<O0S*3%P)<h;3K|Lk000e1NJLTq000mG000mO1^@s6AM^iV00006VoOIv00000
z008+zyMF)x010qNS#tmY3ljhU3ljkVnw%H_000McNliru)e0IE2rq*aG@Aeb0e?wE
zK~y-)m6J<L0#O)--y<_)+JOBE&j{TX{f`J*wuqp07w|&1utkw}+eAb}8?iP8{sb|z
zHi2a@qrae<Fa<Zw?X+ohMn|!4^_|0cAKv%lJLKpjGq3CVEJi57&%JG~#qXSVoM9N#
z@#xkldZZ8bCIPqscGGG#!5Hfk5kdd}q0odUlye?xwHjWlm4(K4V`h+x{mgF4?s=ZS
zbpa$vLa|hs`bVTi7eG;zPK;KoIaF*%aseo%D3%JHvn<P=;z%UYKLf@XWLb6%()n;u
zxd4<>l*+}S4tk-SEw(HMMH$UOFgT8OyWIuox(>z|!eNT?Q)#FJN+p=4fyzsz3(&M5
z1Oj8QEH>2c<<$iq9`D@|1fH*+ou9fEhcV03wkV2NSzd)@nNYt}<gT;eHrAtg0C~r9
zY#WB*>lHgoRaN9}vH<Yx^BR(->G1pg5Cj3DD1s1zdc6*S;N$b%7N-)i<Q(Z0A0DT(
orfDvDeXPGK04OA4$sGXr1wvV-0~Lt(*Z=?k07*qoM6N<$f^2=vg8%>k

literal 0
HcmV?d00001

diff --git a/apps/launcher/resources/icons/tango/edit-delete.png b/apps/launcher/resources/icons/tango/edit-delete.png
new file mode 100644
index 0000000000000000000000000000000000000000..ea03150a1c15ec650240042fb695e7be84bc3e28
GIT binary patch
literal 680
zcmV;Z0$2TsP)<h;3K|Lk000e1NJLTq000mG000mO1^@s6AM^iV00006VoOIv0F3~S
z0E;2?qkaGY010qNS#tmY3ljhU3ljkVnw%H_000McNliru)&>&~9SKOY%f<iz01tFU
zSad^gZEa<4bO32&AZ%}EZ-&Nqxc~qH8c9S!R5;6}kiSn8aTvy*`=xg+w58Y9S}GKx
z473hzZcr$L?3y@fYJY$cO-<Yy>0nX^lS0%q#YP1;Cv`C~wifvVWH7q5i>VkBIIeP6
z?s|6)au-91QGBQO`{sE*@B4fS?A7A^!aG@(#_<=$akkoxxl9xQXmcpb()eup8Wcsb
zgoa^snGM6hljX9thz?EX=K<sZ9g-wL5QHwH`DPdfBuN4QLeqHzK#m5G%VsX1zPbca
z6wz!p4>SV+MNuFK0-`7)n@QnL;d#!A@UhW?AP8tQ8h?ynYKO=6BACOv97OzXrAtf@
z2O)x1X8|H-V>nD%fY=%S{{Wx9i2r094LW{B44uo@Kw#`p>kX`0Uo?09s&V;JTzyn7
zDU*{^%-Y&}CK{d4s?`b^i%n^@T9ulJ#`L$9H{{~N1F9<m%d)E4QMY-oM{Biy5JREi
zUR^ij!NDO~({#z<aQJD4+2lBz?e`-{v*CGuha}0@Hk%D2r$!*{?kEETCv=y~DZBgJ
zZ2*Xb!$-Ydui6DDEZi#r&?4c}7kwVzv5jwEeE?*h_mCt>)O#I0o&NqHSeDc6cDqz8
zK1}bwAaOHui(g)OtONMGwY4emZr<;5I_X`d&8)9~I0*nN&z?HdsoA#LQO@rNluJuR
z`2EL^Bopb;WFp<CC<<P_deK8sbl^%nNu-i9L?95Dxjmo#&a&Kw3HS-*%)<z!_bg=q
O0000<MNUMnLSTYqog~2k

literal 0
HcmV?d00001

diff --git a/apps/launcher/resources/icons/tango/index.theme b/apps/launcher/resources/icons/tango/index.theme
new file mode 100644
index 000000000..1f54489eb
--- /dev/null
+++ b/apps/launcher/resources/icons/tango/index.theme
@@ -0,0 +1,8 @@
+[Icon Theme]
+Name=Tango
+Comment=Tango Theme
+Inherits=default
+Directories=16x16
+
+[16x16]
+Size=16
\ No newline at end of file
diff --git a/apps/launcher/resources/icons/tango/video-display.png b/apps/launcher/resources/icons/tango/video-display.png
new file mode 100644
index 0000000000000000000000000000000000000000..1331436846337b542434b9b28faaad2243ff32ed
GIT binary patch
literal 2547
zcmV<P2@Lj$P)<h;3K|Lk000e1NJLTq001xm001xu1^@s6R|5Hm00001b5ch_0Itp)
z=>Px#24YJ`L;wH)0002_L%V+f000SaNLh0L01ejw01ejxLMWSf00007bV*G`2ipY*
z6c86{M}6r4010zRL_t(&-tAdSY#mn_{?21wvG27VJ9XXS#IftdsS~<st4gVmQiPC@
zN*63xbkj8(R0&o{h!rXlYDEz{)Exp<2q96Z3Y)6!f>tC=TS}x-NJDMsI<c>>@16UY
z$N7I2b00Hv$M@bQuz`+rG-uBFXU_lqk8jTW1AKmbe*AwQqG<5N7hfz3DPCsc$C%l^
zlLr$Kn7QBb*Xc0;{V`+Akc<%AB*M?0d+xa(<k!(fiyLFUeg47COOHJIh%JR2sVIX}
z7n~Z;2o+v%=8`ca)g20>(0l3UFMa3PXP^DU3opFz&R77JWu0GHIc2vyO*C6g_<mfh
zd{1Fc0ZH{;N5OXFNSR6c$7dICc4I^C?!Ivbz<2;cidoCDVaVWDzx)udzVbe%rqsaQ
zqkyC)r4mq5=AD!ETKfKO|K?7B?|uKv*xZ}}7%;}bbsYtuJW&XNc}8muCWBiQ9}h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