diff options
author | Thorbjørn Lindeijer <thorbjorn.lindeijer@nokia.com> | 2010-03-23 12:32:15 (GMT) |
---|---|---|
committer | Thorbjørn Lindeijer <thorbjorn.lindeijer@nokia.com> | 2010-03-23 12:36:10 (GMT) |
commit | c4536ce25a9fdfe6a9b447f893796c1262e06df6 (patch) | |
tree | 2c60356e017283e9137fcb559695c480f6e93ac1 /tools | |
parent | a749609f6f00978259dc7b50f020e404eff0a2b0 (diff) | |
download | Qt-c4536ce25a9fdfe6a9b447f893796c1262e06df6.zip Qt-c4536ce25a9fdfe6a9b447f893796c1262e06df6.tar.gz Qt-c4536ce25a9fdfe6a9b447f893796c1262e06df6.tar.bz2 |
Use standard theme icons in Linguist where possible
Reviewed-by: Jens Bache-Wiig <jbache@trolltech.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/linguist/linguist/mainwindow.cpp | 44 |
1 files changed, 33 insertions, 11 deletions
diff --git a/tools/linguist/linguist/mainwindow.cpp b/tools/linguist/linguist/mainwindow.cpp index 321fe8c..7d73596 100644 --- a/tools/linguist/linguist/mainwindow.cpp +++ b/tools/linguist/linguist/mainwindow.cpp @@ -1810,28 +1810,50 @@ QString MainWindow::friendlyString(const QString& str) return f.simplified(); } +static inline void setThemeIcon(QAction *action, const char *name, const char *fallback) +{ + const QIcon fallbackIcon(MainWindow::resourcePrefix() + QLatin1String(fallback)); +#ifdef Q_WS_X11 + action->setIcon(QIcon::fromTheme(QLatin1String(name), fallbackIcon)); +#else + Q_UNUSED(name) + action->setIcon(fallbackIcon); +#endif +} + void MainWindow::setupMenuBar() { + // There are no fallback icons for these +#ifdef Q_WS_X11 + m_ui.menuRecentlyOpenedFiles->setIcon(QIcon::fromTheme(QLatin1String("document-open-recent"))); + m_ui.actionCloseAll->setIcon(QIcon::fromTheme(QLatin1String("window-close"))); + m_ui.actionExit->setIcon(QIcon::fromTheme(QLatin1String("application-exit"))); + m_ui.actionSelectAll->setIcon(QIcon::fromTheme(QLatin1String("edit-select-all"))); +#endif + + // Prefer theme icons when available for these actions + setThemeIcon(m_ui.actionOpen, "document-open", "/fileopen.png"); + setThemeIcon(m_ui.actionOpenAux, "document-open", "/fileopen.png"); + setThemeIcon(m_ui.actionSave, "document-save", "/filesave.png"); + setThemeIcon(m_ui.actionSaveAll, "document-save", "/filesave.png"); + setThemeIcon(m_ui.actionPrint, "document-print", "/print.png"); + setThemeIcon(m_ui.actionRedo, "edit-redo", "/redo.png"); + setThemeIcon(m_ui.actionUndo, "edit-undo", "/undo.png"); + setThemeIcon(m_ui.actionCut, "edit-cut", "/editcut.png"); + setThemeIcon(m_ui.actionCopy, "edit-copy", "/editcopy.png"); + setThemeIcon(m_ui.actionPaste, "edit-paste", "/editpaste.png"); + setThemeIcon(m_ui.actionFind, "edit-find", "/searchfind.png"); + + // No well defined theme icons for these actions m_ui.actionAccelerators->setIcon(QIcon(resourcePrefix() + QLatin1String("/accelerator.png"))); m_ui.actionOpenPhraseBook->setIcon(QIcon(resourcePrefix() + QLatin1String("/book.png"))); m_ui.actionDoneAndNext->setIcon(QIcon(resourcePrefix() + QLatin1String("/doneandnext.png"))); - m_ui.actionCopy->setIcon(QIcon(resourcePrefix() + QLatin1String("/editcopy.png"))); - m_ui.actionCut->setIcon(QIcon(resourcePrefix() + QLatin1String("/editcut.png"))); - m_ui.actionPaste->setIcon(QIcon(resourcePrefix() + QLatin1String("/editpaste.png"))); - m_ui.actionOpen->setIcon(QIcon(resourcePrefix() + QLatin1String("/fileopen.png"))); - m_ui.actionOpenAux->setIcon(QIcon(resourcePrefix() + QLatin1String("/fileopen.png"))); - m_ui.actionSaveAll->setIcon(QIcon(resourcePrefix() + QLatin1String("/filesave.png"))); - m_ui.actionSave->setIcon(QIcon(resourcePrefix() + QLatin1String("/filesave.png"))); m_ui.actionNext->setIcon(QIcon(resourcePrefix() + QLatin1String("/next.png"))); m_ui.actionNextUnfinished->setIcon(QIcon(resourcePrefix() + QLatin1String("/nextunfinished.png"))); m_ui.actionPhraseMatches->setIcon(QIcon(resourcePrefix() + QLatin1String("/phrase.png"))); m_ui.actionEndingPunctuation->setIcon(QIcon(resourcePrefix() + QLatin1String("/punctuation.png"))); m_ui.actionPrev->setIcon(QIcon(resourcePrefix() + QLatin1String("/prev.png"))); m_ui.actionPrevUnfinished->setIcon(QIcon(resourcePrefix() + QLatin1String("/prevunfinished.png"))); - m_ui.actionPrint->setIcon(QIcon(resourcePrefix() + QLatin1String("/print.png"))); - m_ui.actionRedo->setIcon(QIcon(resourcePrefix() + QLatin1String("/redo.png"))); - m_ui.actionFind->setIcon(QIcon(resourcePrefix() + QLatin1String("/searchfind.png"))); - m_ui.actionUndo->setIcon(QIcon(resourcePrefix() + QLatin1String("/undo.png"))); m_ui.actionPlaceMarkerMatches->setIcon(QIcon(resourcePrefix() + QLatin1String("/validateplacemarkers.png"))); m_ui.actionWhatsThis->setIcon(QIcon(resourcePrefix() + QLatin1String("/whatsthis.png"))); |