1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-31 20:16:57 +00:00

#5848: Use theme-provided icons in Qt client (patch by equeim + small additions)

This commit is contained in:
Mike Gelfand 2014-12-12 21:47:22 +00:00
parent 79848c36c0
commit faf1b2fbdf
3 changed files with 13 additions and 7 deletions

View file

@ -7,8 +7,10 @@
* $Id$
*/
#include <QApplication>
#include <QDialogButtonBox>
#include <QFont>
#include <QIcon>
#include <QLabel>
#include <QMessageBox>
#include <QPixmap>
@ -34,7 +36,7 @@ AboutDialog :: AboutDialog (QWidget * parent):
QVBoxLayout * v = new QVBoxLayout (this);
l = new QLabel;
l->setPixmap (QPixmap (QString::fromUtf8 (":/icons/transmission-48.png")));
l->setPixmap (QApplication::windowIcon ().pixmap (48));
l->setAlignment (Qt::AlignCenter);
v->addWidget (l);

View file

@ -106,11 +106,14 @@ MyApp :: MyApp (int& argc, char ** argv):
Formatter::initUnits ();
// set the default icon
QIcon icon;
QList<int> sizes;
sizes << 16 << 22 << 24 << 32 << 48 << 64 << 72 << 96 << 128 << 192 << 256;
foreach (int size, sizes)
icon.addPixmap (QPixmap (QString::fromUtf8 (":/icons/transmission-%1.png").arg (size)));
QIcon icon = QIcon::fromTheme ("transmission");
if (icon.isNull ())
{
QList<int> sizes;
sizes << 16 << 22 << 24 << 32 << 48 << 64 << 72 << 96 << 128 << 192 << 256;
foreach (int size, sizes)
icon.addPixmap (QPixmap (QString::fromUtf8 (":/icons/transmission-%1.png").arg (size)));
}
setWindowIcon (icon);
// parse the command-line arguments

View file

@ -12,6 +12,7 @@
#include <QtGui>
#include <QCheckBox>
#include <QIcon>
#include <QProxyStyle>
#include <QLabel>
#include <QFileDialog>
@ -233,7 +234,7 @@ TrMainWindow :: TrMainWindow (Session& session, Prefs& prefs, TorrentModel& mode
menu->addSeparator ();
menu->addAction (ui.action_Quit);
myTrayIcon.setContextMenu (menu);
myTrayIcon.setIcon (QApplication::windowIcon ());
myTrayIcon.setIcon (QIcon::fromTheme ("transmission-tray-icon", QApplication::windowIcon ()));
connect (&myPrefs, SIGNAL (changed (int)), this, SLOT (refreshPref (int)));
connect (ui.action_ShowMainWindow, SIGNAL (triggered (bool)), this, SLOT (toggleWindows (bool)));