Unify action settings text
This commit is contained in:
committed by
Craig Drummond
parent
b5da764dec
commit
f04894a1d7
@@ -332,12 +332,9 @@ void MainWindow::init()
|
||||
locateArtistAction = ActionCollection::get()->createAction("locateartist", tr("Artist"));
|
||||
locateAlbumAction = ActionCollection::get()->createAction("locatealbum", tr("Album"));
|
||||
locateTrackAction = ActionCollection::get()->createAction("locatetrack", tr("Track"));
|
||||
locateArtistAction->setToolTip(tr("Locate In Library / Artist"));
|
||||
locateAlbumAction->setToolTip(tr("Locate In Library / Album"));
|
||||
locateTrackAction->setToolTip(tr("Locate In Library / Track"));
|
||||
locateArtistAction->setProperty(Action::constTtForSettings, true);
|
||||
locateAlbumAction->setProperty(Action::constTtForSettings, true);
|
||||
locateTrackAction->setProperty(Action::constTtForSettings, true);
|
||||
locateArtistAction->setSettingsText(locateAction);
|
||||
locateAlbumAction->setSettingsText(locateAction);
|
||||
locateTrackAction->setSettingsText(locateAction);
|
||||
addAction(locateAction);
|
||||
|
||||
QMenu *locateMenu=new QMenu();
|
||||
@@ -349,8 +346,7 @@ void MainWindow::init()
|
||||
playNextAction = ActionCollection::get()->createAction("playnext", tr("Play next"));
|
||||
#ifdef TAGLIB_FOUND
|
||||
editPlayQueueTagsAction = ActionCollection::get()->createAction("editpqtags", Utils::strippedText(StdActions::self()->editTagsAction->text()), StdActions::self()->editTagsAction->icon());
|
||||
editPlayQueueTagsAction->setToolTip(tr("Edit Track Information (Play Queue)"));
|
||||
editPlayQueueTagsAction->setProperty(Action::constTtForSettings, true);
|
||||
editPlayQueueTagsAction->setSettingsText(tr("Edit Track Information (Play Queue)"));
|
||||
#endif
|
||||
addAction(expandAllAction = ActionCollection::get()->createAction("expandall", tr("Expand All")));
|
||||
expandAllAction->setShortcut(Qt::ControlModifier+Qt::Key_Down);
|
||||
@@ -661,6 +657,7 @@ void MainWindow::init()
|
||||
Action *action=ActionCollection::get()->createAction(QLatin1String("rating")+QString::number(i), text);
|
||||
action->setProperty(constRatingKey, i*Song::Rating_Step);
|
||||
action->setShortcut(Qt::AltModifier+Qt::Key_0+i);
|
||||
action->setSettingsText(ratingAction);
|
||||
ratingAction->menu()->addAction(action);
|
||||
connect(action, SIGNAL(triggered()), SLOT(setRating()));
|
||||
}
|
||||
|
||||
@@ -39,16 +39,9 @@
|
||||
|
||||
GLOBAL_STATIC(StdActions, instance)
|
||||
|
||||
static void setToolTip(Action *act, const QString &tt)
|
||||
{
|
||||
act->setToolTip(tt);
|
||||
act->setProperty(Action::constTtForSettings, true);
|
||||
}
|
||||
|
||||
static QMenu * priorityMenu(bool isSet, Action *parent)
|
||||
{
|
||||
QString prefix(isSet ? "set" : "addwith");
|
||||
QString ttPrefix = Utils::strippedText(parent->text()) + QLatin1String(" > ");
|
||||
Action *prioHighestAction = ActionCollection::get()->createAction(prefix+"priohighest", QObject::tr("Highest Priority (255)"));
|
||||
Action *prioHighAction = ActionCollection::get()->createAction(prefix+"priohigh", QObject::tr("High Priority (200)"));
|
||||
Action *prioMediumAction = ActionCollection::get()->createAction(prefix+"priomedium", QObject::tr("Medium Priority (125)"));
|
||||
@@ -56,19 +49,12 @@ static QMenu * priorityMenu(bool isSet, Action *parent)
|
||||
Action *prioDefaultAction = ActionCollection::get()->createAction(prefix+"priodefault", QObject::tr("Default Priority (0)"));
|
||||
Action *prioCustomAction = ActionCollection::get()->createAction(prefix+"priocustom", QObject::tr("Custom Priority..."));
|
||||
|
||||
prioHighestAction->setToolTip(ttPrefix + Utils::strippedText(prioHighestAction->text()));
|
||||
prioHighAction->setToolTip(ttPrefix + Utils::strippedText(prioHighAction->text()));
|
||||
prioMediumAction->setToolTip(ttPrefix + Utils::strippedText(prioMediumAction->text()));
|
||||
prioLowAction->setToolTip(ttPrefix + Utils::strippedText(prioLowAction->text()));
|
||||
prioDefaultAction->setToolTip(ttPrefix + Utils::strippedText(prioDefaultAction->text()));
|
||||
prioCustomAction->setToolTip(ttPrefix + Utils::strippedText(prioCustomAction->text()));
|
||||
|
||||
prioHighestAction->setProperty(Action::constTtForSettings, true);
|
||||
prioHighAction->setProperty(Action::constTtForSettings, true);
|
||||
prioMediumAction->setProperty(Action::constTtForSettings, true);
|
||||
prioLowAction->setProperty(Action::constTtForSettings, true);
|
||||
prioDefaultAction->setProperty(Action::constTtForSettings, true);
|
||||
prioCustomAction->setProperty(Action::constTtForSettings, true);
|
||||
prioHighestAction->setSettingsText(parent);
|
||||
prioHighAction->setSettingsText(parent);
|
||||
prioMediumAction->setSettingsText(parent);
|
||||
prioLowAction->setSettingsText(parent);
|
||||
prioDefaultAction->setSettingsText(parent);
|
||||
prioCustomAction->setSettingsText(parent);
|
||||
|
||||
prioHighAction->setData(200);
|
||||
prioMediumAction->setData(125);
|
||||
@@ -106,10 +92,10 @@ StdActions::StdActions()
|
||||
decreaseVolumeAction = ActionCollection::get()->createAction("decreasevolume", QObject::tr("Decrease Volume"));
|
||||
savePlayQueueAction = ActionCollection::get()->createAction("saveplayqueue", QObject::tr("Save As"), Icons::self()->savePlayQueueIcon);
|
||||
appendToPlayQueueAction = ActionCollection::get()->createAction("appendtoplayqueue", QObject::tr("Append"), Icons::self()->appendToPlayQueueIcon);
|
||||
setToolTip(appendToPlayQueueAction, QObject::tr("Append To Play Queue"));
|
||||
appendToPlayQueueAction->setSettingsText(QObject::tr("Append To Play Queue"));
|
||||
appendToPlayQueueAndPlayAction = ActionCollection::get()->createAction("appendtoplayqueueandplay", QObject::tr("Append And Play"));
|
||||
addToPlayQueueAndPlayAction = ActionCollection::get()->createAction("addtoplayqueueandplay", QObject::tr("Add And Play"));
|
||||
setToolTip(appendToPlayQueueAndPlayAction, QObject::tr("Append To Play Queue And Play"));
|
||||
appendToPlayQueueAndPlayAction->setSettingsText(QObject::tr("Append To Play Queue And Play"));
|
||||
insertAfterCurrentAction = ActionCollection::get()->createAction("insertintoplayqueue", QObject::tr("Insert After Current"));
|
||||
addRandomAlbumToPlayQueueAction = ActionCollection::get()->createAction("addrandomalbumtoplayqueue", QObject::tr("Append Random Album"));
|
||||
replacePlayQueueAction = ActionCollection::get()->createAction("replaceplayqueue", QObject::tr("Play Now (And Replace Play Queue)"), Icons::self()->replacePlayQueueIcon);
|
||||
|
||||
@@ -87,20 +87,13 @@ void Action::updateToolTip(QAction *act)
|
||||
}
|
||||
}
|
||||
|
||||
const char * Action::constTtForSettings="tt-for-settings";
|
||||
static const char * constSettingsText="tt-for-settings";
|
||||
|
||||
QString Action::settingsText(QAction *act)
|
||||
{
|
||||
if (act->property(constTtForSettings).toBool()) {
|
||||
QString tt=Utils::stripAcceleratorMarkers(act->property(constPlainToolTipProperty).toString());
|
||||
if (tt.isEmpty()) {
|
||||
tt=Utils::stripAcceleratorMarkers(act->toolTip());
|
||||
}
|
||||
if (!tt.isEmpty()) {
|
||||
return tt;
|
||||
}
|
||||
}
|
||||
return Utils::stripAcceleratorMarkers(act->text());
|
||||
return act->property(constSettingsText).isValid()
|
||||
? act->property(constSettingsText).toString()
|
||||
: Utils::stripAcceleratorMarkers(act->text());
|
||||
}
|
||||
|
||||
void Action::init() {
|
||||
@@ -121,6 +114,14 @@ void Action::setShortcutConfigurable(bool b) {
|
||||
setProperty("isShortcutConfigurable", b);
|
||||
}
|
||||
|
||||
void Action::setSettingsText(const QString &text) {
|
||||
setProperty(constSettingsText, text);
|
||||
}
|
||||
|
||||
void Action::setSettingsText(Action *parent) {
|
||||
setSettingsText(Utils::strippedText(parent->text())+QLatin1String(" / ")+Utils::strippedText(text()));
|
||||
}
|
||||
|
||||
QKeySequence Action::shortcut(ShortcutTypes type) const {
|
||||
Q_ASSERT(type);
|
||||
if(type == DefaultShortcut)
|
||||
|
||||
@@ -47,7 +47,6 @@ public:
|
||||
static void initIcon(QAction *act);
|
||||
static void updateToolTip(QAction *act);
|
||||
static QString settingsText(QAction *act);
|
||||
static const char * constTtForSettings;
|
||||
|
||||
explicit Action(QObject *parent);
|
||||
Action(const QString &text, QObject *parent, const QObject *receiver = nullptr, const char *slot = nullptr, const QKeySequence &shortcut = 0);
|
||||
@@ -60,6 +59,9 @@ public:
|
||||
bool isShortcutConfigurable() const;
|
||||
void setShortcutConfigurable(bool configurable);
|
||||
|
||||
void setSettingsText(const QString &text);
|
||||
void setSettingsText(Action *parent);
|
||||
|
||||
signals:
|
||||
void triggered(Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user