File indexing completed on 2022-09-27 14:35:05

0001 /*
0002  * KMix -- KDE's full featured mini mixer
0003  *
0004  * Copyright (C) 2000 Stefan Schimanski <1Stein@gmx.de>
0005  *
0006  * This program is free software; you can redistribute it and/or
0007  * modify it under the terms of the GNU Library General Public
0008  * License as published by the Free Software Foundation; either
0009  * version 2 of the License, or (at your option) any later version.
0010  *
0011  * This program is distributed in the hope that it will be useful,
0012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0014  * Library General Public License for more details.
0015  *
0016  * You should have received a copy of the GNU Library General Public
0017  * License along with this program; if not, write to the Free
0018  * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
0019  */
0020 
0021 #ifndef KMIXWINDOW_H
0022 #define KMIXWINDOW_H
0023 
0024 // KDE
0025 #include <kxmlguiwindow.h>
0026 
0027 // KMix
0028 #include "core/ControlManager.h"
0029 #include "gui/kmixprefdlg.h"
0030 
0031 
0032 class QTabWidget;
0033 
0034 class KToggleAction;
0035 
0036 class KMixDockWidget;
0037 class KMixerWidget;
0038 class KMixWindow;
0039 class Mixer;
0040 class DialogSelectMaster;
0041 
0042 
0043 class KMixWindow : public KXmlGuiWindow
0044 {
0045    Q_OBJECT
0046 
0047 public:
0048    KMixWindow(bool invisible, bool reset);
0049    virtual ~KMixWindow();
0050 
0051 private:
0052    void saveBaseConfig();
0053    void saveViewConfig();
0054    void loadAndInitConfig(bool reset);
0055    void loadBaseConfig();
0056 
0057    void initPrefDlg();
0058    void initActions();
0059    void initActionsLate();
0060    void initActionsAfterInitMixer();
0061    void initWidgets();
0062 
0063    void fixConfigAfterRead();
0064 
0065 protected:
0066    bool queryClose() override;
0067 
0068 public Q_SLOTS:
0069    void controlsChange(ControlManager::ChangeType changeType);
0070    void quit();
0071    void showSettings();
0072    void showHelp();
0073    void showAbout();
0074    void toggleMenuBar();
0075    void loadVolumes();
0076    void loadVolumes(QString postfix);
0077    void saveVolumes();
0078    void saveVolumes(const QString &postfix);
0079    void saveConfig();
0080    void recreateGUI(bool saveView, bool reset);
0081    void recreateGUI(bool saveConfig, const QString& mixerId, bool forceNewTab, bool reset);
0082    void recreateGUIwithSavingView();
0083    void newMixerShown(int tabIndex);
0084    void slotSelectMaster();
0085 
0086 protected Q_SLOTS:
0087     void applyPrefs(KMixPrefDlg::PrefChanges changed);
0088 
0089 private:
0090     KMixerWidget* findKMWforTab( const QString& tabId );
0091     void forkExec(const QStringList& args);
0092     KToggleAction* _actionShowMenubar;
0093 
0094    bool m_startVisible;
0095    bool m_visibilityUpdateAllowed;
0096    bool m_multiDriverMode;         // Not officially supported.
0097    bool m_autouseMultimediaKeys;   // Due to message freeze, not in config dialog in KDE4.4
0098 
0099    QTabWidget *m_wsMixers;
0100 
0101    KMixDockWidget *m_dockWidget;
0102    DialogSelectMaster *m_dsm;
0103 
0104    QString m_defaultCardOnStart;
0105    bool m_dontSetDefaultCardOnStart;
0106    QStringList m_backendFilter;
0107    unsigned int m_configVersion;
0108 
0109 private:
0110     void showVolumeDisplay();
0111     void increaseOrDecreaseVolume(bool increase);
0112 
0113     bool addMixerWidget(const QString& mixer_ID, QString guiprofId, int insertPosition);
0114     void setInitialSize();
0115     bool profileExists(QString guiProfileId);
0116     bool updateDocking();
0117     void removeDock();
0118     void updateTabsClosable();
0119 
0120 private:
0121     static QString getKmixctrlRcFilename(const QString &postfix);
0122 
0123 private Q_SLOTS:
0124    void slotKdeAudioSetupExec();
0125    void slotConfigureCurrentView();
0126 
0127    void plugged(const char *driverName, const QString &udi, int dev);
0128    void unplugged(const QString &udi);
0129 
0130    void hideOrClose();
0131    void slotIncreaseVolume();
0132    void slotDecreaseVolume();
0133    void slotMute();
0134    void slotSelectMasterClose(QObject*);
0135 
0136    void newView();
0137    void saveAndCloseView(int);
0138 
0139    void loadVolumes1() { loadVolumes(QString("1")); }
0140    void loadVolumes2() { loadVolumes(QString("2")); }
0141    void loadVolumes3() { loadVolumes(QString("3")); }
0142    void loadVolumes4() { loadVolumes(QString("4")); }
0143 
0144    void saveVolumes1() { saveVolumes(QString("1")); }
0145    void saveVolumes2() { saveVolumes(QString("2")); }
0146    void saveVolumes3() { saveVolumes(QString("3")); }
0147    void saveVolumes4() { saveVolumes(QString("4")); }
0148 };
0149 
0150 #endif                          // KMIXWINDOW_H