1 /****************************************************************************************
2  * Copyright (c) 2010 Rick W. Chen <stuffcorpse@archlinux.us>                           *
3  *                                                                                      *
4  * This program is free software; you can redistribute it and/or modify it under        *
5  * the terms of the GNU General Public License as published by the Free Software        *
6  * Foundation; either version 2 of the License, or (at your option) any later           *
7  * version.                                                                             *
8  *                                                                                      *
9  * This program is distributed in the hope that it will be useful, but WITHOUT ANY      *
10  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A      *
11  * PARTICULAR PURPOSE. See the GNU General Public License for more details.             *
12  *                                                                                      *
13  * You should have received a copy of the GNU General Public License along with         *
14  * this program.  If not, see <http://www.gnu.org/licenses/>.                           *
15  ****************************************************************************************/
16 
17 #ifndef AMAROK_SCRIPTSCONFIG_H
18 #define AMAROK_SCRIPTSCONFIG_H
19 
20 #include "configdialog/ConfigDialogBase.h"
21 
22 #include <QStringList>
23 
24 
25 class KArchiveDirectory;
26 class KArchiveFile;
27 class ScriptSelector;
28 class QPushButton;
29 class QVBoxLayout;
30 
31 /**
32   * A widget that allows configuration of scripts
33   */
34 class ScriptsConfig : public ConfigDialogBase
35 {
36     Q_OBJECT
37 
38 public:
39     explicit ScriptsConfig( Amarok2ConfigDialog *parent );
40     ~ScriptsConfig() override;
41 
42     void updateSettings() override;
43     bool hasChanged() override;
44     bool isDefault() override;
45 
46 public Q_SLOTS:
47     void slotConfigChanged( bool changed );
48 
49 private Q_SLOTS:
50     void slotManageScripts();
51     void installLocalScript();
52     void slotReloadScriptSelector();
53     void slotUpdateScripts();
54     void slotUninstallScript();
55     void restoreScrollBar();
56 
57 private:
58     const KArchiveFile *findSpecFile( const KArchiveDirectory *dir ) const;
59 
60     bool m_configChanged;
61     ScriptSelector *m_selector;
62     QTimer *m_timer;
63     QVBoxLayout *m_verticalLayout;
64     QPushButton *m_uninstallButton;
65     QObject *m_parent;
66     ScriptSelector *m_oldSelector;
67 };
68 
69 #endif // AMAROK_SCRIPTSCONFIG_H
70