1 /*
2  * KMix -- KDE's full featured mini mixer
3  *
4  * Copyright (C) 2000 Stefan Schimanski <1Stein@gmx.de>
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Library General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Library General Public License for more details.
15  *
16  * You should have received a copy of the GNU Library General Public
17  * License along with this program; if not, write to the Free
18  * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
19  */
20 
21 #ifndef KMIXWINDOW_H
22 #define KMIXWINDOW_H
23 
24 // KDE
25 #include <kxmlguiwindow.h>
26 
27 // KMix
28 #include "core/ControlManager.h"
29 #include "gui/kmixprefdlg.h"
30 
31 
32 class QTabWidget;
33 
34 class KToggleAction;
35 
36 class KMixDockWidget;
37 class KMixerWidget;
38 class KMixWindow;
39 class Mixer;
40 class DialogSelectMaster;
41 
42 
43 class KMixWindow : public KXmlGuiWindow
44 {
45    Q_OBJECT
46 
47 public:
48    KMixWindow(bool invisible, bool reset);
49    virtual ~KMixWindow();
50 
51 private:
52    void saveBaseConfig();
53    void saveViewConfig();
54    void loadAndInitConfig(bool reset);
55    void loadBaseConfig();
56 
57    void initPrefDlg();
58    void initActions();
59    void initActionsLate();
60    void initActionsAfterInitMixer();
61    void initWidgets();
62 
63    void fixConfigAfterRead();
64 
65 protected:
66    bool queryClose() override;
67 
68 public slots:
69    void controlsChange(ControlManager::ChangeType changeType);
70    void quit();
71    void showSettings();
72    void showHelp();
73    void showAbout();
74    void toggleMenuBar();
75    void loadVolumes();
76    void loadVolumes(QString postfix);
77    void saveVolumes();
78    void saveVolumes(const QString &postfix);
79    void saveConfig();
80    void recreateGUI(bool saveView, bool reset);
81    void recreateGUI(bool saveConfig, const QString& mixerId, bool forceNewTab, bool reset);
82    void recreateGUIwithSavingView();
83    void newMixerShown(int tabIndex);
84    void slotSelectMaster();
85 
86 protected slots:
87     void applyPrefs(KMixPrefDlg::PrefChanges changed);
88 
89 private:
90     KMixerWidget* findKMWforTab( const QString& tabId );
91     void forkExec(const QStringList& args);
92     KToggleAction* _actionShowMenubar;
93 
94    bool m_startVisible;
95    bool m_visibilityUpdateAllowed;
96    bool m_multiDriverMode;         // Not officially supported.
97    bool m_autouseMultimediaKeys;   // Due to message freeze, not in config dialog in KDE4.4
98 
99    QTabWidget *m_wsMixers;
100 
101    KMixDockWidget *m_dockWidget;
102    DialogSelectMaster *m_dsm;
103 
104    QString m_defaultCardOnStart;
105    bool m_dontSetDefaultCardOnStart;
106    QStringList m_backendFilter;
107    unsigned int m_configVersion;
108 
109 private:
110     void showVolumeDisplay();
111     void increaseOrDecreaseVolume(bool increase);
112 
113     bool addMixerWidget(const QString& mixer_ID, QString guiprofId, int insertPosition);
114     void setInitialSize();
115     bool profileExists(QString guiProfileId);
116     bool updateDocking();
117     void removeDock();
118     void updateTabsClosable();
119 
120 private:
121     static QString getKmixctrlRcFilename(const QString &postfix);
122 
123 private slots:
124    void slotKdeAudioSetupExec();
125    void slotConfigureCurrentView();
126 
127    void plugged(const char *driverName, const QString &udi, int dev);
128    void unplugged(const QString &udi);
129 
130    void hideOrClose();
131    void slotIncreaseVolume();
132    void slotDecreaseVolume();
133    void slotMute();
134    void slotSelectMasterClose(QObject*);
135 
136    void newView();
137    void saveAndCloseView(int);
138 
loadVolumes1()139    void loadVolumes1() { loadVolumes(QString("1")); }
loadVolumes2()140    void loadVolumes2() { loadVolumes(QString("2")); }
loadVolumes3()141    void loadVolumes3() { loadVolumes(QString("3")); }
loadVolumes4()142    void loadVolumes4() { loadVolumes(QString("4")); }
143 
saveVolumes1()144    void saveVolumes1() { saveVolumes(QString("1")); }
saveVolumes2()145    void saveVolumes2() { saveVolumes(QString("2")); }
saveVolumes3()146    void saveVolumes3() { saveVolumes(QString("3")); }
saveVolumes4()147    void saveVolumes4() { saveVolumes(QString("4")); }
148 };
149 
150 #endif							// KMIXWINDOW_H
151