00001 /*************************************************************************** 00002 * Copyright (C) 2008-2010 by Ilya Kotov * 00003 * forkotov02@hotmail.ru * 00004 * * 00005 * This program is free software; you can redistribute it and/or modify * 00006 * it under the terms of the GNU General Public License as published by * 00007 * the Free Software Foundation; either version 2 of the License, or * 00008 * (at your option) any later version. * 00009 * * 00010 * This program is distributed in the hope that it will be useful, * 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00013 * GNU General Public License for more details. * 00014 * * 00015 * You should have received a copy of the GNU General Public License * 00016 * along with this program; if not, write to the * 00017 * Free Software Foundation, Inc., * 00018 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * 00019 ***************************************************************************/ 00020 #ifndef GENERALHANDLER_H 00021 #define GENERALHANDLER_H 00022 00023 #include <QObject> 00024 #include <QMap> 00025 #include <QList> 00026 #include <QPointer> 00027 #include <QStringList> 00028 00029 class QAction; 00030 class QMenu; 00031 class QWidget; 00032 class General; 00033 class Control; 00034 class GeneralFactory; 00035 class CommandLineManager; 00036 00040 class GeneralHandler : public QObject 00041 { 00042 Q_OBJECT 00043 public: 00048 GeneralHandler(QObject *parent = 0); 00052 ~GeneralHandler(); 00056 enum MenuType 00057 { 00058 TOOLS_MENU = 0, 00059 PLAYLIST_MENU 00060 }; 00066 void setEnabled(GeneralFactory* factory, bool enable); 00072 void showSettings(GeneralFactory* factory, QWidget* parentWidget); 00076 bool visibilityControl(); 00082 void executeCommand(const QString &opt_str, const QStringList &args = QStringList()); 00089 void addAction(QAction *action, MenuType type = TOOLS_MENU); 00093 void removeAction(QAction *action); 00097 QList<QAction *> actions(MenuType type = TOOLS_MENU); 00104 QMenu *createMenu(MenuType type, const QString &title = QString(), QWidget *parent = 0); 00108 static GeneralHandler* instance(); 00109 00110 signals: 00115 void exitCalled(); 00120 void toggleVisibilityCalled(); 00121 00122 private slots: 00123 void removeAction(QObject *action); 00124 00125 private: 00126 QMap <GeneralFactory*, General*> m_generals; 00127 CommandLineManager *m_commandLineManager; 00128 QList <QAction*> m_toolsActions; 00129 QList <QAction*> m_playlistActions; 00130 QPointer<QMenu> m_toolsMenu; 00131 QPointer<QMenu> m_playlistMenu; 00132 static GeneralHandler* m_instance; 00133 }; 00134 00135 #endif
1.5.9