From 1314ef2e3777f2968337ba817c0f873880ff7e35 Mon Sep 17 00:00:00 2001 From: David Sansome Date: Sun, 21 Mar 2010 16:37:38 +0000 Subject: [PATCH] Remove the global shortcuts dialog from trunk --- src/CMakeLists.txt | 3 - src/mainwindow.cpp | 3 - src/mainwindow.h | 2 - src/mainwindow.ui | 10 --- src/shortcutsdialog.cpp | 169 -------------------------------------- src/shortcutsdialog.h | 66 --------------- src/shortcutsdialog.ui | 177 ---------------------------------------- 7 files changed, 430 deletions(-) delete mode 100644 src/shortcutsdialog.cpp delete mode 100644 src/shortcutsdialog.h delete mode 100644 src/shortcutsdialog.ui diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 36ac028b5..5a06b909e 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -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 ) diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index bae4dcfac..b59b8e9bb 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -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 diff --git a/src/mainwindow.h b/src/mainwindow.h index f6ecd1588..2f8c88ef5 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -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_; diff --git a/src/mainwindow.ui b/src/mainwindow.ui index 154d2f783..9550c6616 100644 --- a/src/mainwindow.ui +++ b/src/mainwindow.ui @@ -474,7 +474,6 @@ Settings - @@ -711,15 +710,6 @@ &Hide tray icon - - - - :/configure.png:/configure.png - - - Configure &Global Shortcuts... - - diff --git a/src/shortcutsdialog.cpp b/src/shortcutsdialog.cpp deleted file mode 100644 index cf1d625c3..000000000 --- a/src/shortcutsdialog.cpp +++ /dev/null @@ -1,169 +0,0 @@ -#include "shortcutsdialog.h" - -#include - -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(event); - qDebug() << ke->text(); - qDebug() << ke->key(); - return true; - } - return QWidget::event(event); -} diff --git a/src/shortcutsdialog.h b/src/shortcutsdialog.h deleted file mode 100644 index c96d6fb85..000000000 --- a/src/shortcutsdialog.h +++ /dev/null @@ -1,66 +0,0 @@ -#ifndef SHORTCUTSDIALOG_H -#define SHORTCUTSDIALOG_H - -#include -#include -#include -#include -#include - -#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 diff --git a/src/shortcutsdialog.ui b/src/shortcutsdialog.ui deleted file mode 100644 index fdc408e8d..000000000 --- a/src/shortcutsdialog.ui +++ /dev/null @@ -1,177 +0,0 @@ - - - ShortcutsDialog - - - - 0 - 0 - 485 - 371 - - - - Configure Shortcuts - - - - - 10 - 10 - 461 - 221 - - - - QAbstractItemView::NoEditTriggers - - - true - - - Qt::SolidLine - - - false - - - 116 - - - 24 - - - false - - - true - - - false - - - true - - - false - - - 24 - - - 116 - - - - Shortcut - - - - - Alternate - - - - - - true - - - - 10 - 240 - 461 - 81 - - - - Shortcut for Selected Action - - - - true - - - - 10 - 30 - 91 - 21 - - - - &None - - - true - - - - - - 190 - 30 - 93 - 22 - - - - De&fault - - - - - - 360 - 30 - 81 - 22 - - - - &Custom - - - - - - 10 - 60 - 431 - 16 - - - - - - - - - - - 15 - 330 - 451 - 32 - - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok|QDialogButtonBox::Reset - - - false - - - - - table - radio_none - radio_default - radio_custom - - - -