Konsole
ProfileList.h
Go to the documentation of this file.00001 /* 00002 Copyright 2006-2008 by Robert Knight <robertknight@gmail.com> 00003 00004 This program is free software; you can redistribute it and/or modify 00005 it under the terms of the GNU General Public License as published by 00006 the Free Software Foundation; either version 2 of the License, or 00007 (at your option) any later version. 00008 00009 This program is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 GNU General Public License for more details. 00013 00014 You should have received a copy of the GNU General Public License 00015 along with this program; if not, write to the Free Software 00016 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 00017 02110-1301 USA. 00018 */ 00019 00020 #ifndef PROFILELIST_H 00021 #define PROFILELIST_H 00022 00023 #include <QtCore/QList> 00024 #include <QtCore/QSet> 00025 #include <QtCore/QObject> 00026 00027 #include "Profile.h" 00028 00029 class QAction; 00030 class QActionGroup; 00031 class QKeySequence; 00032 00033 namespace Konsole 00034 { 00035 00036 class Profile; 00037 00049 class ProfileList : public QObject 00050 { 00051 Q_OBJECT 00052 00053 public: 00061 ProfileList(bool addShortcuts , QObject* parent); 00062 00069 QList<QAction*> actions(); 00070 00072 void syncWidgetActions(QWidget* widget,bool sync); 00073 signals: 00079 void profileSelected(Profile::Ptr profile); 00083 void actionsChanged(const QList<QAction*>& actions); 00084 00085 private slots: 00086 void triggered(QAction* action); 00087 void favoriteChanged(Profile::Ptr profile, bool isFavorite); 00088 void profileChanged(Profile::Ptr profile); 00089 void shortcutChanged(Profile::Ptr profile, const QKeySequence& sequence); 00090 00091 private: 00092 QAction* actionForKey(Profile::Ptr profile) const; 00093 void updateAction(QAction* action , Profile::Ptr profile); 00094 void updateEmptyAction(); 00095 00096 QActionGroup* _group; 00097 bool _addShortcuts; 00098 00099 // action to show when the list is empty 00100 QAction* _emptyListAction; 00101 QSet<QWidget*> _registeredWidgets; 00102 }; 00103 00104 } 00105 00106 #endif // PROFILELIST_H