1 //=============================================================================
2 //  MusE Score
3 //  Linux Music Score Editor
4 //
5 //  Copyright (C) 2002-2016 Werner Schweer and others
6 //
7 //  This program is free software; you can redistribute it and/or modify
8 //  it under the terms of the GNU General Public License version 2.
9 //
10 //  This program is distributed in the hope that it will be useful,
11 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
12 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 //  GNU General Public License for more details.
14 //
15 //  You should have received a copy of the GNU General Public License
16 //  along with this program; if not, write to the Free Software
17 //  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 //=============================================================================
19 
20 #ifndef __PREFSDIALOG_H__
21 #define __PREFSDIALOG_H__
22 
23 #include "ui_prefsdialog.h"
24 #include "preferences.h"
25 #include "abstractdialog.h"
26 #include "preferenceslistwidget.h"
27 
28 namespace Ms {
29 
30 class Shortcut;
31 
32 //---------------------------------------------------------
33 //   PreferenceDialog
34 //---------------------------------------------------------
35 
36 class PreferenceDialog : public AbstractDialog, private Ui::PrefsDialogBase {
37       Q_OBJECT
38 
39       QMap<QString, Shortcut*> localShortcuts;
40       bool shortcutsChanged;
41       QButtonGroup* recordButtons;
42       std::vector<PreferenceItem*> normalWidgets;
43       std::vector<PreferenceItem*> uiRelatedWidgets;
44       std::vector<PreferenceItem*> audioRelatedWidgets;
45       std::vector<PreferenceItem*> modifiedWidgets;
46       std::vector<PreferenceItem*> modifiedUiWidgets;
47       std::vector<PreferenceItem*> modifiedAudioWidgets;
48       PreferencesListWidget* advancedWidget;
49 
50       virtual void hideEvent(QHideEvent*);
51       void apply();
52       void updateSCListView();
53       void setUseMidiOutput(bool);
54       void updateValues(bool useDefaultValues = false, bool setup = false);
55       void checkApplyActivation();
56 
57       void applySetActive(bool active);
58       void updateShortestNote();
59       void applyShortestNote();
60       void languageUpdate();
61       void languageApply();
62       void updateCharsetListGP();
63       void updateCharsetListOve();
64       void updateUseLocalAvsOmr();
65       void applyPageVertical();
66 
67    private slots:
68       void buttonBoxClicked(QAbstractButton*);
69       void updateBgView(bool);
70       void updateFgView(bool);
71       void selectFgWallpaper();
72       void selectBgWallpaper();
73       void selectDefaultStyle();
74       void selectPartStyle();
75       void selectInstrumentList1();
76       void selectInstrumentList2();
77       void selectScoreOrderList1();
78       void selectScoreOrderList2();
79       void selectStartWith();
80       void resetShortcutClicked();
81       void saveShortcutListClicked();
82       void loadShortcutListClicked();
83       void clearShortcutClicked();
84       void defineShortcutClicked();
85       void portaudioApiActivated(int idx);
86       void resetAllValues();
87       void styleFileButtonClicked();
88       void recordButtonClicked(int);
89       void midiRemoteControlClearClicked();
90       void exclusiveAudioDriver(bool on);
91       void nonExclusiveJackDriver(bool on);
92       void selectScoresDirectory();
93       void selectStylesDirectory();
94       void selectTemplatesDirectory();
95       void selectPluginsDirectory();
96       void selectImagesDirectory();
97       void selectExtensionsDirectory();
98       void zoomDefaultTypeChanged(int);
99       void printShortcutsClicked();
100       void filterShortcutsTextChanged(const QString &);
101       void filterAdvancedPreferences(const QString&);
102       void resetAdvancedPreferenceToDefault();
103       void restartAudioEngine();
104       void widgetModified();
105       void uiWidgetModified();
106       void audioWidgetModified();
107       void applyActivate();
108 
109       void changeSoundfontPaths();
110       void updateTranslationClicked();
111 
112    signals:
113       void preferencesChanged(bool fromWorkspace, bool changeUI);
114       void mixerPreferencesChanged(bool showMidiControls);
115 
116    protected:
117       virtual void retranslate();
118 
119    public:
120       PreferenceDialog(QWidget* parent);
121       ~PreferenceDialog();
122       void start();
123       void updateRemote();
124       };
125 
126 //---------------------------------------------------------
127 //   ShortcutItem
128 //---------------------------------------------------------
129 
130 class ShortcutItem : public QTreeWidgetItem {
131 
132       bool operator<(const QTreeWidgetItem&) const;
133 
134    public:
ShortcutItem()135       ShortcutItem() : QTreeWidgetItem() {}
136       };
137 
138 } // namespace Ms
139 #endif
140 
141