Remove the global shortcuts dialog from trunk
This commit is contained in:
parent
0b2bb418f3
commit
1314ef2e37
@ -50,7 +50,6 @@ set(CLEMENTINE-SOURCES
|
||||
addstreamdialog.cpp
|
||||
savedradio.cpp
|
||||
stylesheetloader.cpp
|
||||
shortcutsdialog.cpp
|
||||
albumcovermanager.cpp
|
||||
albumcoverloader.cpp
|
||||
m3uparser.cpp
|
||||
@ -99,7 +98,6 @@ set(CLEMENTINE-MOC-HEADERS
|
||||
albumcoverfetcher.h
|
||||
addstreamdialog.h
|
||||
savedradio.h
|
||||
shortcutsdialog.h
|
||||
albumcovermanager.h
|
||||
albumcoverloader.h
|
||||
m3uparser.h
|
||||
@ -126,7 +124,6 @@ set(CLEMENTINE-UI
|
||||
lastfmconfigdialog.ui
|
||||
about.ui
|
||||
addstreamdialog.ui
|
||||
shortcutsdialog.ui
|
||||
albumcovermanager.ui
|
||||
playlistsequence.ui
|
||||
)
|
||||
|
@ -13,7 +13,6 @@
|
||||
#include "edittagdialog.h"
|
||||
#include "multiloadingindicator.h"
|
||||
#include "settingsdialog.h"
|
||||
#include "shortcutsdialog.h"
|
||||
#include "libraryconfigdialog.h"
|
||||
#include "about.h"
|
||||
#include "addstreamdialog.h"
|
||||
@ -61,7 +60,6 @@ MainWindow::MainWindow(QNetworkAccessManager* network, QWidget *parent)
|
||||
library_(new Library(player_->GetEngine(), this)),
|
||||
settings_dialog_(new SettingsDialog(this)),
|
||||
add_stream_dialog_(new AddStreamDialog(this)),
|
||||
shortcuts_dialog_(new ShortcutsDialog(this)),
|
||||
cover_manager_(new AlbumCoverManager(network, this)),
|
||||
playlist_menu_(new QMenu(this)),
|
||||
library_sort_model_(new QSortFilterProxyModel(this)),
|
||||
@ -122,7 +120,6 @@ MainWindow::MainWindow(QNetworkAccessManager* network, QWidget *parent)
|
||||
connect(ui_.action_add_media, SIGNAL(triggered()), SLOT(AddMedia()));
|
||||
connect(ui_.action_add_stream, SIGNAL(triggered()), SLOT(AddStream()));
|
||||
connect(ui_.action_hide_tray_icon, SIGNAL(triggered()), SLOT(HideShowTrayIcon()));
|
||||
connect(ui_.action_global_shortcuts, SIGNAL(triggered()), shortcuts_dialog_, SLOT(show()));
|
||||
connect(ui_.action_cover_manager, SIGNAL(triggered()), cover_manager_, SLOT(show()));
|
||||
|
||||
// Give actions to buttons
|
||||
|
@ -21,7 +21,6 @@ class MultiLoadingIndicator;
|
||||
class SettingsDialog;
|
||||
class About;
|
||||
class AddStreamDialog;
|
||||
class ShortcutsDialog;
|
||||
class AlbumCoverManager;
|
||||
class PlaylistSequence;
|
||||
|
||||
@ -109,7 +108,6 @@ class MainWindow : public QMainWindow {
|
||||
|
||||
SettingsDialog* settings_dialog_;
|
||||
AddStreamDialog* add_stream_dialog_;
|
||||
ShortcutsDialog* shortcuts_dialog_;
|
||||
AlbumCoverManager* cover_manager_;
|
||||
|
||||
QMenu* playlist_menu_;
|
||||
|
@ -474,7 +474,6 @@
|
||||
<property name="title">
|
||||
<string>Settings</string>
|
||||
</property>
|
||||
<addaction name="action_global_shortcuts"/>
|
||||
<addaction name="action_configure"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="action_hide_tray_icon"/>
|
||||
@ -711,15 +710,6 @@
|
||||
<string>&Hide tray icon</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="action_global_shortcuts">
|
||||
<property name="icon">
|
||||
<iconset resource="../data/data.qrc">
|
||||
<normaloff>:/configure.png</normaloff>:/configure.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Configure &Global Shortcuts...</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="action_cover_manager">
|
||||
<property name="icon">
|
||||
<iconset resource="../data/data.qrc">
|
||||
|
@ -1,169 +0,0 @@
|
||||
#include "shortcutsdialog.h"
|
||||
|
||||
#include <QtDebug>
|
||||
|
||||
const char* ShortcutsDialog::kSettingsGroup = "Shortcuts";
|
||||
ShortcutsDialog::ShortcutsDialog(QWidget* parent)
|
||||
: QDialog(parent) {
|
||||
ui_.setupUi(this);
|
||||
ui_.shortcut_options->setEnabled(false);
|
||||
|
||||
// Load settings
|
||||
|
||||
int i = 0;
|
||||
QStringList rowLabels;
|
||||
QString str;
|
||||
|
||||
keys_ << "play" << "pause" << "play_pause" << "stop" << "stop_after";
|
||||
keys_ << "next_track" << "prev_track" << "inc_volume" << "dec_volume";
|
||||
keys_ << "mute" << "seek_forwards" << "seek_backwards";
|
||||
|
||||
settings_.beginGroup(kSettingsGroup);
|
||||
foreach(str, keys_) {
|
||||
if (settings_.contains(str)) {
|
||||
if (QString::compare(str, "play_pause") == 0) {
|
||||
rowLabels << SD_ROW_PLAY_PAUSE;
|
||||
}
|
||||
else if (QString::compare(str, "stop_after") == 0) {
|
||||
rowLabels << SD_ROW_STOP_AFTER;
|
||||
}
|
||||
else if (QString::compare(str, "next_track") == 0) {
|
||||
rowLabels << SD_ROW_NEXT_TRACK;
|
||||
}
|
||||
else if (QString::compare(str, "prev_track") == 0) {
|
||||
rowLabels << SD_ROW_PREV_TRACK;
|
||||
}
|
||||
else if (QString::compare(str, "inc_volume") == 0) {
|
||||
rowLabels << SD_ROW_INC_VOLUME;
|
||||
}
|
||||
else if (QString::compare(str, "dec_volume") == 0) {
|
||||
rowLabels << SD_ROW_DEC_VOLUME;
|
||||
}
|
||||
else if (QString::compare(str, "seek_forwards") == 0) {
|
||||
rowLabels << SD_ROW_SEEK_FORWARDS;
|
||||
}
|
||||
else if (QString::compare(str, "seek_backwards") == 0) {
|
||||
rowLabels << SD_ROW_SEEK_BACKWARDS;
|
||||
}
|
||||
else {
|
||||
// Uppercase first letter
|
||||
str[0] = str[0].toUpper();
|
||||
rowLabels << str;
|
||||
}
|
||||
}
|
||||
else {
|
||||
settings_.setValue(str, "");
|
||||
}
|
||||
}
|
||||
|
||||
ui_.table->setRowCount(rowLabels.length());
|
||||
ui_.table->setVerticalHeaderLabels(rowLabels);
|
||||
|
||||
|
||||
|
||||
// TODO: QKeySequence::toString() to load/save values
|
||||
|
||||
//connect(ui_.button_box->button(QDialogButtonBox::Reset), SIGNAL(clicked()), SLOT(ResetShortcuts()));
|
||||
connect(ui_.button_box, SIGNAL(accepted()), SLOT(SaveShortcuts()));
|
||||
connect(ui_.button_box, SIGNAL(rejected()), SLOT(CancelEvent()));
|
||||
connect(ui_.table, SIGNAL(cellClicked(int, int)), SLOT(CellClickedEvent()));
|
||||
connect(ui_.radio_default, SIGNAL(clicked()), SLOT(DefaultRadioClickedEvent()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset shortcuts to defaults (none for now).
|
||||
*/
|
||||
void ShortcutsDialog::ResetShortcuts() {
|
||||
int ret = QMessageBox::warning(this, tr("Warning"),
|
||||
tr("You are about to reset to global shortcuts default values. Are you sure you want to continue?"),
|
||||
QMessageBox::Yes,
|
||||
QMessageBox::No);
|
||||
if (ret != QMessageBox::No) {
|
||||
}
|
||||
}
|
||||
|
||||
void ShortcutsDialog::SaveShortcuts() {
|
||||
accept();
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset back to original values found in settings file and close
|
||||
*/
|
||||
void ShortcutsDialog::CancelEvent() {
|
||||
close();
|
||||
}
|
||||
|
||||
void ShortcutsDialog::DefaultText(QString str) {
|
||||
if (QString::compare(str, SD_ROW_PLAY) == 0) {
|
||||
currentDefault_ = tr(SD_DEFAULT_PLAY);
|
||||
ui_.label->setText(tr("Default: %1").arg(SD_DEFAULT_PLAY));
|
||||
}
|
||||
else if (QString::compare(str, SD_ROW_PLAY_PAUSE) == 0) {
|
||||
currentDefault_ = tr(SD_DEFAULT_PLAY_PAUSE);
|
||||
ui_.label->setText(tr("Default: %1").arg(SD_DEFAULT_PLAY_PAUSE));
|
||||
}
|
||||
else if (QString::compare(str, SD_ROW_STOP) == 0) {
|
||||
currentDefault_ = tr(SD_DEFAULT_STOP);
|
||||
ui_.label->setText(tr("Default: %1").arg(SD_DEFAULT_STOP));
|
||||
}
|
||||
else if (QString::compare(str, SD_ROW_STOP_AFTER) == 0) {
|
||||
currentDefault_ = tr(SD_DEFAULT_STOP_AFTER);
|
||||
ui_.label->setText(tr("Default: %1").arg(SD_DEFAULT_STOP_AFTER));
|
||||
}
|
||||
else if (QString::compare(str, SD_ROW_NEXT_TRACK) == 0) {
|
||||
currentDefault_ = tr(SD_DEFAULT_NEXT_TRACK);
|
||||
ui_.label->setText(tr("Default: %1").arg(SD_DEFAULT_NEXT_TRACK));
|
||||
}
|
||||
else if (QString::compare(str, SD_ROW_PREV_TRACK) == 0) {
|
||||
currentDefault_ = tr(SD_DEFAULT_PREV_TRACK);
|
||||
ui_.label->setText(tr("Default: %1").arg(SD_DEFAULT_PREV_TRACK));
|
||||
}
|
||||
else if (QString::compare(str, SD_ROW_INC_VOLUME) == 0) {
|
||||
currentDefault_ = tr(SD_DEFAULT_INC_VOLUME);
|
||||
ui_.label->setText(tr("Default: %1").arg(SD_DEFAULT_INC_VOLUME));
|
||||
}
|
||||
else if (QString::compare(str, SD_ROW_DEC_VOLUME) == 0) {
|
||||
currentDefault_ = tr(SD_DEFAULT_DEC_VOLUME);
|
||||
ui_.label->setText(tr("Default: %1").arg(SD_DEFAULT_DEC_VOLUME));
|
||||
}
|
||||
else if (QString::compare(str, SD_ROW_MUTE) == 0) {
|
||||
currentDefault_ = tr(SD_DEFAULT_MUTE_VOLUME);
|
||||
ui_.label->setText(tr("Default: %1").arg(SD_DEFAULT_MUTE_VOLUME));
|
||||
}
|
||||
else if (QString::compare(str, SD_ROW_SEEK_FORWARDS) == 0) {
|
||||
currentDefault_ = tr(SD_DEFAULT_SEEK_FORWARDS);
|
||||
ui_.label->setText(tr("Default: %1").arg(SD_DEFAULT_SEEK_FORWARDS));
|
||||
}
|
||||
else if (QString::compare(str, SD_ROW_SEEK_BACKWARDS) == 0) {
|
||||
currentDefault_ = tr(SD_DEFAULT_SEEK_BACKWARDS);
|
||||
ui_.label->setText(tr("Default: %1").arg(SD_DEFAULT_SEEK_BACKWARDS));
|
||||
}
|
||||
else {
|
||||
currentDefault_ = tr("");
|
||||
ui_.label->setText(tr("Default: None"));
|
||||
}
|
||||
}
|
||||
|
||||
void ShortcutsDialog::CellClickedEvent() {
|
||||
ui_.shortcut_options->setEnabled(true);
|
||||
DefaultText(ui_.table->verticalHeaderItem(ui_.table->currentRow())->text());
|
||||
|
||||
currentKey_ = keys_.at(ui_.table->currentRow());
|
||||
|
||||
//TODO: Read setting and set correct radio button
|
||||
// Disable ALL hotkey functionality built-in to Qt for this widget
|
||||
}
|
||||
|
||||
void ShortcutsDialog::DefaultRadioClickedEvent() {
|
||||
settings_.setValue(currentKey_, currentDefault_);
|
||||
}
|
||||
|
||||
bool ShortcutsDialog::event(QEvent* event) {
|
||||
if (event->type() == QEvent::ShortcutOverride) {
|
||||
QKeyEvent *ke = static_cast<QKeyEvent *>(event);
|
||||
qDebug() << ke->text();
|
||||
qDebug() << ke->key();
|
||||
return true;
|
||||
}
|
||||
return QWidget::event(event);
|
||||
}
|
@ -1,66 +0,0 @@
|
||||
#ifndef SHORTCUTSDIALOG_H
|
||||
#define SHORTCUTSDIALOG_H
|
||||
|
||||
#include <QDialogButtonBox>
|
||||
#include <QDialog>
|
||||
#include <QKeyEvent>
|
||||
#include <QMessageBox>
|
||||
#include <QSettings>
|
||||
|
||||
#include "ui_shortcutsdialog.h"
|
||||
|
||||
// Proper row names
|
||||
#define SD_ROW_PLAY "Play"
|
||||
#define SD_ROW_PAUSE "Pause"
|
||||
#define SD_ROW_PLAY_PAUSE "Play/Pause"
|
||||
#define SD_ROW_STOP "Stop"
|
||||
#define SD_ROW_STOP_AFTER "Stop Playing After Current Track"
|
||||
#define SD_ROW_NEXT_TRACK "Next Track"
|
||||
#define SD_ROW_PREV_TRACK "Previous Track"
|
||||
#define SD_ROW_INC_VOLUME "Increase Volume"
|
||||
#define SD_ROW_DEC_VOLUME "Decrease Volume"
|
||||
#define SD_ROW_MUTE "Mute"
|
||||
#define SD_ROW_SEEK_FORWARDS "Seek Forwards"
|
||||
#define SD_ROW_SEEK_BACKWARDS "Seek Backwards"
|
||||
|
||||
// Defaults from Amarok 1.4
|
||||
// Meta = Windows key or Apple key
|
||||
#define SD_DEFAULT_PLAY "Meta+X"
|
||||
#define SD_DEFAULT_PLAY_PAUSE "Meta+C"
|
||||
#define SD_DEFAULT_STOP "Meta+V"
|
||||
#define SD_DEFAULT_STOP_AFTER "Meta+Ctrl+V"
|
||||
#define SD_DEFAULT_NEXT_TRACK "Meta+B"
|
||||
#define SD_DEFAULT_PREV_TRACK "Meta+Z"
|
||||
#define SD_DEFAULT_INC_VOLUME "Meta+KP_Add"
|
||||
#define SD_DEFAULT_DEC_VOLUME "Meta+KP_Subtract"
|
||||
#define SD_DEFAULT_MUTE_VOLUME "Meta+M"
|
||||
#define SD_DEFAULT_SEEK_FORWARDS "Meta+Shift+KP_Add"
|
||||
#define SD_DEFAULT_SEEK_BACKWARDS "Meta+Shift+KP_Subtract"
|
||||
|
||||
class ShortcutsDialog : public QDialog {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ShortcutsDialog(QWidget* parent = 0);
|
||||
|
||||
private slots:
|
||||
void ResetShortcuts();
|
||||
void SaveShortcuts();
|
||||
void CancelEvent();
|
||||
/*void GetShortcut(QKeyEvent* event);*/
|
||||
void CellClickedEvent();
|
||||
void DefaultText(QString str);
|
||||
void DefaultRadioClickedEvent();
|
||||
bool event(QEvent* event);
|
||||
|
||||
private:
|
||||
Ui::ShortcutsDialog ui_;
|
||||
QSettings settings_;
|
||||
static const char* kSettingsGroup;
|
||||
QTableWidgetItem *item; // current cell
|
||||
QString currentDefault_;
|
||||
QString currentKey_;
|
||||
QStringList keys_;
|
||||
};
|
||||
|
||||
#endif // SHORTCUTSDIALOG_H
|
@ -1,177 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>ShortcutsDialog</class>
|
||||
<widget class="QDialog" name="ShortcutsDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>485</width>
|
||||
<height>371</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Configure Shortcuts</string>
|
||||
</property>
|
||||
<widget class="QTableWidget" name="table">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>10</y>
|
||||
<width>461</width>
|
||||
<height>221</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="editTriggers">
|
||||
<set>QAbstractItemView::NoEditTriggers</set>
|
||||
</property>
|
||||
<property name="showDropIndicator" stdset="0">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="gridStyle">
|
||||
<enum>Qt::SolidLine</enum>
|
||||
</property>
|
||||
<attribute name="horizontalHeaderCascadingSectionResizes">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
<attribute name="horizontalHeaderDefaultSectionSize">
|
||||
<number>116</number>
|
||||
</attribute>
|
||||
<attribute name="horizontalHeaderMinimumSectionSize">
|
||||
<number>24</number>
|
||||
</attribute>
|
||||
<attribute name="horizontalHeaderShowSortIndicator" stdset="0">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
<attribute name="horizontalHeaderStretchLastSection">
|
||||
<bool>true</bool>
|
||||
</attribute>
|
||||
<attribute name="horizontalHeaderShowSortIndicator" stdset="0">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
<attribute name="horizontalHeaderStretchLastSection">
|
||||
<bool>true</bool>
|
||||
</attribute>
|
||||
<attribute name="horizontalHeaderCascadingSectionResizes">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
<attribute name="horizontalHeaderMinimumSectionSize">
|
||||
<number>24</number>
|
||||
</attribute>
|
||||
<attribute name="horizontalHeaderDefaultSectionSize">
|
||||
<number>116</number>
|
||||
</attribute>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Shortcut</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Alternate</string>
|
||||
</property>
|
||||
</column>
|
||||
</widget>
|
||||
<widget class="QGroupBox" name="shortcut_options">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>240</y>
|
||||
<width>461</width>
|
||||
<height>81</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Shortcut for Selected Action</string>
|
||||
</property>
|
||||
<widget class="QRadioButton" name="radio_none">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>30</y>
|
||||
<width>91</width>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&None</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QRadioButton" name="radio_default">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>190</x>
|
||||
<y>30</y>
|
||||
<width>93</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>De&fault</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QRadioButton" name="radio_custom">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>360</x>
|
||||
<y>30</y>
|
||||
<width>81</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Custom</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>60</y>
|
||||
<width>431</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QDialogButtonBox" name="button_box">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>15</x>
|
||||
<y>330</y>
|
||||
<width>451</width>
|
||||
<height>32</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok|QDialogButtonBox::Reset</set>
|
||||
</property>
|
||||
<property name="centerButtons">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>table</tabstop>
|
||||
<tabstop>radio_none</tabstop>
|
||||
<tabstop>radio_default</tabstop>
|
||||
<tabstop>radio_custom</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
Loading…
x
Reference in New Issue
Block a user