Implementation of global shortcuts dialog, no settings saved yet; Start of fix for issue #6
This commit is contained in:
parent
e365baf7d1
commit
bbe0f81c2b
@ -13,6 +13,7 @@
|
|||||||
#include "edittagdialog.h"
|
#include "edittagdialog.h"
|
||||||
#include "multiloadingindicator.h"
|
#include "multiloadingindicator.h"
|
||||||
#include "settingsdialog.h"
|
#include "settingsdialog.h"
|
||||||
|
#include "shortcutsdialog.h"
|
||||||
#include "libraryconfigdialog.h"
|
#include "libraryconfigdialog.h"
|
||||||
#include "about.h"
|
#include "about.h"
|
||||||
#include "addstreamdialog.h"
|
#include "addstreamdialog.h"
|
||||||
@ -52,6 +53,7 @@ MainWindow::MainWindow(QWidget *parent)
|
|||||||
library_(new Library(player_->GetEngine(), this)),
|
library_(new Library(player_->GetEngine(), this)),
|
||||||
settings_dialog_(new SettingsDialog(this)),
|
settings_dialog_(new SettingsDialog(this)),
|
||||||
add_stream_dialog_(new AddStreamDialog(this)),
|
add_stream_dialog_(new AddStreamDialog(this)),
|
||||||
|
shortcuts_dialog_(new ShortcutsDialog(this)),
|
||||||
playlist_menu_(new QMenu(this)),
|
playlist_menu_(new QMenu(this)),
|
||||||
library_sort_model_(new QSortFilterProxyModel(this)),
|
library_sort_model_(new QSortFilterProxyModel(this)),
|
||||||
track_position_timer_(new QTimer(this))
|
track_position_timer_(new QTimer(this))
|
||||||
@ -111,6 +113,7 @@ MainWindow::MainWindow(QWidget *parent)
|
|||||||
connect(ui_.action_add_media, SIGNAL(triggered()), SLOT(AddMedia()));
|
connect(ui_.action_add_media, SIGNAL(triggered()), SLOT(AddMedia()));
|
||||||
connect(ui_.action_add_stream, SIGNAL(triggered()), SLOT(AddStream()));
|
connect(ui_.action_add_stream, SIGNAL(triggered()), SLOT(AddStream()));
|
||||||
connect(ui_.action_hide_tray_icon, SIGNAL(triggered()), SLOT(HideShowTrayIcon()));
|
connect(ui_.action_hide_tray_icon, SIGNAL(triggered()), SLOT(HideShowTrayIcon()));
|
||||||
|
connect(ui_.action_global_shortcuts, SIGNAL(triggered()), shortcuts_dialog_, SLOT(show()));
|
||||||
|
|
||||||
// Give actions to buttons
|
// Give actions to buttons
|
||||||
ui_.forward_button->setDefaultAction(ui_.action_next_track);
|
ui_.forward_button->setDefaultAction(ui_.action_next_track);
|
||||||
|
@ -21,6 +21,7 @@ class MultiLoadingIndicator;
|
|||||||
class SettingsDialog;
|
class SettingsDialog;
|
||||||
class About;
|
class About;
|
||||||
class AddStreamDialog;
|
class AddStreamDialog;
|
||||||
|
class ShortcutsDialog;
|
||||||
|
|
||||||
class QSortFilterProxyModel;
|
class QSortFilterProxyModel;
|
||||||
class SystemTrayIcon;
|
class SystemTrayIcon;
|
||||||
@ -102,6 +103,7 @@ class MainWindow : public QMainWindow {
|
|||||||
|
|
||||||
SettingsDialog* settings_dialog_;
|
SettingsDialog* settings_dialog_;
|
||||||
AddStreamDialog* add_stream_dialog_;
|
AddStreamDialog* add_stream_dialog_;
|
||||||
|
ShortcutsDialog* shortcuts_dialog_;
|
||||||
|
|
||||||
QMenu* playlist_menu_;
|
QMenu* playlist_menu_;
|
||||||
QAction* playlist_play_pause_;
|
QAction* playlist_play_pause_;
|
||||||
|
@ -467,6 +467,7 @@
|
|||||||
<property name="title">
|
<property name="title">
|
||||||
<string>Settings</string>
|
<string>Settings</string>
|
||||||
</property>
|
</property>
|
||||||
|
<addaction name="action_global_shortcuts"/>
|
||||||
<addaction name="action_configure"/>
|
<addaction name="action_configure"/>
|
||||||
<addaction name="separator"/>
|
<addaction name="separator"/>
|
||||||
<addaction name="action_hide_tray_icon"/>
|
<addaction name="action_hide_tray_icon"/>
|
||||||
@ -696,6 +697,15 @@
|
|||||||
<string>&Hide tray icon</string>
|
<string>&Hide tray icon</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</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>
|
||||||
</widget>
|
</widget>
|
||||||
<layoutdefault spacing="6" margin="11"/>
|
<layoutdefault spacing="6" margin="11"/>
|
||||||
<customwidgets>
|
<customwidgets>
|
||||||
|
36
src/shortcutsdialog.cpp
Normal file
36
src/shortcutsdialog.cpp
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
#include "shortcutsdialog.h"
|
||||||
|
|
||||||
|
const char* ShortcutsDialog::kSettingsGroup = "Shortcuts";
|
||||||
|
ShortcutsDialog::ShortcutsDialog(QWidget* parent)
|
||||||
|
: QDialog(parent) {
|
||||||
|
ui_.setupUi(this);
|
||||||
|
ui_.shortcut_options->setEnabled(false);
|
||||||
|
|
||||||
|
// Load settings
|
||||||
|
// Check if settings exist first, if not create them
|
||||||
|
// TODO: How do we store the button values? Numbers, strings, especially when it comes to combinations?
|
||||||
|
|
||||||
|
connect(ui_.button_defaults, SIGNAL(clicked()), SLOT(DefaultShortcuts()));
|
||||||
|
connect(ui_.button_save, SIGNAL(clicked()), SLOT(SaveShortcuts()));
|
||||||
|
connect(ui_.button_cancel, SIGNAL(clicked()), SLOT(CancelEvent()));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reset shortcuts to defaults (none for now).
|
||||||
|
*/
|
||||||
|
void ShortcutsDialog::DefaultShortcuts() {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Save the shortcuts and close the window
|
||||||
|
*/
|
||||||
|
void ShortcutsDialog::SaveShortcuts() {
|
||||||
|
close();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reset settings to original values taken from settings file and then close the window.
|
||||||
|
*/
|
||||||
|
void ShortcutsDialog::CancelEvent() {
|
||||||
|
close();
|
||||||
|
}
|
26
src/shortcutsdialog.h
Normal file
26
src/shortcutsdialog.h
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
#ifndef SHORTCUTSDIALOG_H
|
||||||
|
#define SHORTCUTSDIALOG_H
|
||||||
|
|
||||||
|
#include <QDialog>
|
||||||
|
#include <QSettings>
|
||||||
|
|
||||||
|
#include "ui_shortcutsdialog.h"
|
||||||
|
|
||||||
|
class ShortcutsDialog : public QDialog {
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
ShortcutsDialog(QWidget* parent = 0);
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void DefaultShortcuts();
|
||||||
|
void SaveShortcuts();
|
||||||
|
void CancelEvent();
|
||||||
|
|
||||||
|
private:
|
||||||
|
Ui::ShortcutsDialog ui_;
|
||||||
|
QSettings settings_;
|
||||||
|
static const char* kSettingsGroup;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // SHORTCUTSDIALOG_H
|
323
src/shortcutsdialog.ui
Normal file
323
src/shortcutsdialog.ui
Normal file
@ -0,0 +1,323 @@
|
|||||||
|
<?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>361</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Configure Shortcuts</string>
|
||||||
|
</property>
|
||||||
|
<widget class="QTableWidget" name="tableWidget">
|
||||||
|
<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>
|
||||||
|
<row>
|
||||||
|
<property name="text">
|
||||||
|
<string>Play</string>
|
||||||
|
</property>
|
||||||
|
</row>
|
||||||
|
<row>
|
||||||
|
<property name="text">
|
||||||
|
<string>Pause</string>
|
||||||
|
</property>
|
||||||
|
</row>
|
||||||
|
<row>
|
||||||
|
<property name="text">
|
||||||
|
<string>Play/Pause</string>
|
||||||
|
</property>
|
||||||
|
</row>
|
||||||
|
<row>
|
||||||
|
<property name="text">
|
||||||
|
<string>Stop</string>
|
||||||
|
</property>
|
||||||
|
</row>
|
||||||
|
<row>
|
||||||
|
<property name="text">
|
||||||
|
<string>Stop Playing After Current Track</string>
|
||||||
|
</property>
|
||||||
|
</row>
|
||||||
|
<row>
|
||||||
|
<property name="text">
|
||||||
|
<string>Next Track</string>
|
||||||
|
</property>
|
||||||
|
</row>
|
||||||
|
<row>
|
||||||
|
<property name="text">
|
||||||
|
<string>Previous Track</string>
|
||||||
|
</property>
|
||||||
|
</row>
|
||||||
|
<row>
|
||||||
|
<property name="text">
|
||||||
|
<string>Increase Volume</string>
|
||||||
|
</property>
|
||||||
|
</row>
|
||||||
|
<row>
|
||||||
|
<property name="text">
|
||||||
|
<string>Decrease Volume</string>
|
||||||
|
</property>
|
||||||
|
</row>
|
||||||
|
<row>
|
||||||
|
<property name="text">
|
||||||
|
<string>Mute Volume</string>
|
||||||
|
</property>
|
||||||
|
</row>
|
||||||
|
<row>
|
||||||
|
<property name="text">
|
||||||
|
<string>Seek Forwards</string>
|
||||||
|
</property>
|
||||||
|
</row>
|
||||||
|
<row>
|
||||||
|
<property name="text">
|
||||||
|
<string>Seek Backwards</string>
|
||||||
|
</property>
|
||||||
|
</row>
|
||||||
|
<column>
|
||||||
|
<property name="text">
|
||||||
|
<string>Shortcut</string>
|
||||||
|
</property>
|
||||||
|
</column>
|
||||||
|
<column>
|
||||||
|
<property name="text">
|
||||||
|
<string>Alternate</string>
|
||||||
|
</property>
|
||||||
|
</column>
|
||||||
|
</widget>
|
||||||
|
<widget class="QPushButton" name="button_defaults">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>10</x>
|
||||||
|
<y>330</y>
|
||||||
|
<width>80</width>
|
||||||
|
<height>26</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>&Defaults</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QPushButton" name="button_save">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>300</x>
|
||||||
|
<y>330</y>
|
||||||
|
<width>80</width>
|
||||||
|
<height>26</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>&OK</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QPushButton" name="button_cancel">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>390</x>
|
||||||
|
<y>330</y>
|
||||||
|
<width>80</width>
|
||||||
|
<height>26</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>&Cancel</string>
|
||||||
|
</property>
|
||||||
|
</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>22</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>&None</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QRadioButton" name="radio_default">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>110</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>220</x>
|
||||||
|
<y>30</y>
|
||||||
|
<width>111</width>
|
||||||
|
<height>22</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>&Custom</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QPushButton" name="button_custom">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>340</x>
|
||||||
|
<y>30</y>
|
||||||
|
<width>101</width>
|
||||||
|
<height>26</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Non&e</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>Default key:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
<tabstops>
|
||||||
|
<tabstop>tableWidget</tabstop>
|
||||||
|
<tabstop>radio_none</tabstop>
|
||||||
|
<tabstop>radio_default</tabstop>
|
||||||
|
<tabstop>radio_custom</tabstop>
|
||||||
|
<tabstop>button_custom</tabstop>
|
||||||
|
<tabstop>button_save</tabstop>
|
||||||
|
<tabstop>button_cancel</tabstop>
|
||||||
|
<tabstop>button_defaults</tabstop>
|
||||||
|
</tabstops>
|
||||||
|
<resources/>
|
||||||
|
<connections>
|
||||||
|
<connection>
|
||||||
|
<sender>radio_custom</sender>
|
||||||
|
<signal>clicked(bool)</signal>
|
||||||
|
<receiver>button_custom</receiver>
|
||||||
|
<slot>setEnabled(bool)</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>299</x>
|
||||||
|
<y>273</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>378</x>
|
||||||
|
<y>286</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>radio_default</sender>
|
||||||
|
<signal>clicked(bool)</signal>
|
||||||
|
<receiver>button_custom</receiver>
|
||||||
|
<slot>setDisabled(bool)</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>175</x>
|
||||||
|
<y>281</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>418</x>
|
||||||
|
<y>276</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>radio_none</sender>
|
||||||
|
<signal>clicked(bool)</signal>
|
||||||
|
<receiver>button_custom</receiver>
|
||||||
|
<slot>setDisabled(bool)</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>79</x>
|
||||||
|
<y>276</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>431</x>
|
||||||
|
<y>290</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
</connections>
|
||||||
|
</ui>
|
@ -55,7 +55,8 @@ SOURCES += main.cpp \
|
|||||||
albumcoverfetcher.cpp \
|
albumcoverfetcher.cpp \
|
||||||
addstreamdialog.cpp \
|
addstreamdialog.cpp \
|
||||||
savedradio.cpp \
|
savedradio.cpp \
|
||||||
stylesheetloader.cpp
|
stylesheetloader.cpp \
|
||||||
|
shortcutsdialog.cpp
|
||||||
HEADERS += mainwindow.h \
|
HEADERS += mainwindow.h \
|
||||||
player.h \
|
player.h \
|
||||||
library.h \
|
library.h \
|
||||||
@ -111,7 +112,8 @@ HEADERS += mainwindow.h \
|
|||||||
albumcoverfetcher.h \
|
albumcoverfetcher.h \
|
||||||
addstreamdialog.h \
|
addstreamdialog.h \
|
||||||
savedradio.h \
|
savedradio.h \
|
||||||
stylesheetloader.h
|
stylesheetloader.h \
|
||||||
|
shortcutsdialog.h
|
||||||
FORMS += mainwindow.ui \
|
FORMS += mainwindow.ui \
|
||||||
libraryconfig.ui \
|
libraryconfig.ui \
|
||||||
fileview.ui \
|
fileview.ui \
|
||||||
@ -124,7 +126,8 @@ FORMS += mainwindow.ui \
|
|||||||
libraryconfigdialog.ui \
|
libraryconfigdialog.ui \
|
||||||
lastfmconfigdialog.ui \
|
lastfmconfigdialog.ui \
|
||||||
about.ui \
|
about.ui \
|
||||||
addstreamdialog.ui
|
addstreamdialog.ui \
|
||||||
|
shortcutsdialog.ui
|
||||||
RESOURCES += ../data/data.qrc \
|
RESOURCES += ../data/data.qrc \
|
||||||
translations.qrc
|
translations.qrc
|
||||||
OTHER_FILES += ../data/schema.sql \
|
OTHER_FILES += ../data/schema.sql \
|
||||||
|
Loading…
x
Reference in New Issue
Block a user