Chris@1583: /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ Chris@1583: Chris@1583: /* Chris@1583: Sonic Visualiser Chris@1583: An audio file viewer and annotation editor. Chris@1583: Centre for Digital Music, Queen Mary, University of London. Chris@1583: Chris@1583: This program is free software; you can redistribute it and/or Chris@1583: modify it under the terms of the GNU General Public License as Chris@1583: published by the Free Software Foundation; either version 2 of the Chris@1583: License, or (at your option) any later version. See the file Chris@1583: COPYING included with this distribution for more information. Chris@1583: */ Chris@1583: Chris@1583: #ifndef SV_MENU_TITLE_H Chris@1583: #define SV_MENU_TITLE_H Chris@1583: Chris@1583: #include "view/ViewManager.h" Chris@1583: Chris@1583: #include Chris@1583: #include Chris@1583: #include Chris@1583: #include Chris@1587: #include Chris@1583: Chris@1583: class MenuTitle Chris@1583: { Chris@1583: public: Chris@1583: static void addTitle(QMenu *m, QString text) { Chris@1583: Chris@1583: #ifdef Q_OS_LINUX Chris@1583: static int leftIndent = Chris@1590: (ViewManager::scalePixelSize(8) + Chris@1590: qApp->style()->pixelMetric(QStyle::PM_SmallIconSize)); Chris@1583: #else Chris@1583: #ifdef Q_OS_WIN Chris@1583: static int leftIndent = Chris@1583: (9 + qApp->style()->pixelMetric(QStyle::PM_SmallIconSize)); Chris@1583: #else Chris@1583: static int leftIndent = 16; Chris@1583: #endif Chris@1583: #endif Chris@1583: Chris@1583: QWidgetAction *wa = new QWidgetAction(m); Chris@1583: QLabel *title = new QLabel; Chris@1583: title->setText(QObject::tr("%1") Chris@1583: .arg(XmlExportable::encodeEntities(text))); Chris@1583: title->setMargin(ViewManager::scalePixelSize(3)); Chris@1583: title->setIndent(leftIndent); Chris@1583: wa->setDefaultWidget(title); Chris@1583: m->addAction(wa); Chris@1583: m->addSeparator(); Chris@1583: } Chris@1583: }; Chris@1583: Chris@1583: #endif