• Skip to content
  • Skip to link menu
KDE 4.0 API Reference
  • KDE API Reference
  • API Reference
  • Sitemap
  • Contact Us
 

Konsole

Profile.h

Go to the documentation of this file.
00001 /*
00002     This source file is part of Konsole, a terminal emulator.
00003 
00004     Copyright (C) 2006-7 by Robert Knight <robertknight@gmail.com>
00005 
00006     This program is free software; you can redistribute it and/or modify
00007     it under the terms of the GNU General Public License as published by
00008     the Free Software Foundation; either version 2 of the License, or
00009     (at your option) any later version.
00010 
00011     This program is distributed in the hope that it will be useful,
00012     but WITHOUT ANY WARRANTY; without even the implied warranty of
00013     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014     GNU General Public License for more details.
00015 
00016     You should have received a copy of the GNU General Public License
00017     along with this program; if not, write to the Free Software
00018     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
00019     02110-1301  USA.
00020 */
00021 
00022 #ifndef PROFILE_H
00023 #define PROFILE_H
00024 
00025 // Qt
00026 #include <QtCore/QHash>
00027 #include <QtCore/QObject>
00028 #include <QtCore/QPointer>
00029 #include <QtCore/QStringList>
00030 #include <QtCore/QVariant>
00031 
00032 #include <QtGui/QFont>
00033 
00034 class KConfigGroup;
00035 
00036 namespace Konsole
00037 {
00038 
00061 class Profile : public QObject 
00062 {
00063 Q_OBJECT
00064 
00065 public:
00073     enum Property
00074     {
00076         Path,   
00077 
00079         Name,   
00081         Title, 
00085         Icon, 
00090         Command,   
00095         Arguments,
00101         Environment,
00103         Directory,
00104 
00106         LocalTabTitleFormat,   
00108         RemoteTabTitleFormat,   
00109 
00111         ShowMenuBar,    
00113         TabBarMode,    
00114 
00116         Font,           
00121         ColorScheme,   
00122 
00126         KeyBindings, 
00127 
00131         HistoryMode,
00136         HistorySize,
00141         ScrollBarPosition,  
00142 
00144         BlinkingTextEnabled,       
00148         FlowControlEnabled,
00152         AllowProgramsToResizeWindow,
00156         BlinkingCursorEnabled,
00157 
00162         UseCustomCursorColor,
00164         CursorShape,           
00167         CustomCursorColor,        
00168 
00172         WordCharacters,
00173 
00175         TabBarPosition,
00176 
00178         DefaultEncoding,
00179 
00181         AntiAliasFonts
00182     };
00183 
00187     enum TabBarModeEnum
00188     {
00190         AlwaysHideTabBar   = 0,
00192         ShowTabBarAsNeeded = 1,
00194         AlwaysShowTabBar   = 2
00195     };
00196 
00200     enum TabBarPositionEnum
00201     {
00203         TabBarBottom = 0,
00205         TabBarTop    = 1
00206     };
00207 
00212     enum HistoryModeEnum
00213     {
00215         DisableHistory   = 0,
00218         FixedSizeHistory = 1,
00223         UnlimitedHistory = 2
00224     };
00225 
00229     enum ScrollBarPositionEnum
00230     {
00232         ScrollBarLeft   = 0,
00234         ScrollBarRight  = 1,
00236         ScrollBarHidden = 2
00237     };
00238 
00240     enum CursorShapeEnum
00241     {
00243         BlockCursor     = 0,
00245         IBeamCursor     = 1,
00247         UnderlineCursor = 2
00248     };
00249 
00253     Profile(Profile* parent = 0);
00254     virtual ~Profile() {}
00255 
00261     void setParent(Profile* parent);
00262 
00264     const Profile* parent() const;
00265 
00273     virtual QVariant property(Property property) const;
00275     virtual void setProperty(Property property,const QVariant& value);
00277     virtual bool isPropertySet(Property property) const;
00278 
00280     virtual QHash<Property,QVariant> setProperties() const;
00281 
00283     bool isEmpty() const;
00284 
00293     bool isHidden() const;
00294 
00296     void setHidden(bool hidden);
00297 
00298     //
00299     // Convenience methods for property() and setProperty() go here
00300     //
00301 
00303     QString path() const { return property(Profile::Path).value<QString>(); }
00304 
00306     QString name() const { return property(Profile::Name).value<QString>(); }
00307     
00309     QString defaultWorkingDirectory() const 
00310             { return property(Profile::Directory).value<QString>(); }
00311 
00313     QString icon() const { return property(Profile::Icon).value<QString>(); }
00314 
00316     QString command() const { return property(Profile::Command).value<QString>(); }
00317 
00319     QStringList arguments() const { return property(Profile::Arguments).value<QStringList>(); }
00320 
00322     QFont font() const { return property(Profile::Font).value<QFont>(); }
00323 
00325     QString colorScheme() const { return property(Profile::ColorScheme).value<QString>(); }
00326 
00328     QStringList environment() const { return property(Profile::Environment).value<QStringList>(); }
00329 
00334     QString terminal() const { return "xterm"; }
00335 
00340     static bool isNameRegistered(const QString& name);
00341 
00348     static Property lookupByName(const QString& name);
00354     static QList<QString> namesForProperty(Property property);
00355 
00360     static QString primaryNameForProperty(Property property);
00361 
00367     static void registerName(Property property , const QString& name); 
00368 
00369 private:
00370     // fills the table with default names for profile properties
00371     // the first time it is called.
00372     // subsequent calls return immediately
00373     static void fillTableWithDefaultNames();
00374 
00375     QHash<Property,QVariant> _propertyValues;
00376     QPointer<Profile> _parent;
00377 
00378     bool _hidden;
00379 
00380     static QHash<QString,Property> _propertyByName;
00381     static QHash<Property,QString> _nameByProperty;
00382     struct PropertyNamePair
00383     {
00384         Property property;
00385         const char* name;
00386     };
00387     static const PropertyNamePair DefaultPropertyNames[];
00388 };
00389 
00395 class FallbackProfile : public Profile
00396 {
00397 public:
00398     FallbackProfile();
00399 };
00400 
00402 class ProfileReader
00403 {
00404 public:
00405     virtual ~ProfileReader() {}
00407     virtual QStringList findProfiles() { return QStringList(); }
00418     virtual bool readProfile(const QString& path , Profile* profile , QString& parentProfile) = 0;
00419 };
00421 class KDE3ProfileReader : public ProfileReader
00422 {
00423 public:
00424     virtual QStringList findProfiles();
00425     virtual bool readProfile(const QString& path , Profile* profile, QString& parentProfile);
00426 };
00428 class KDE4ProfileReader : public ProfileReader
00429 {
00430 public:
00431     virtual QStringList findProfiles();
00432     virtual bool readProfile(const QString& path , Profile* profile, QString& parentProfile);
00433 private:
00434     template <typename T>
00435     void readStandardElement(const KConfigGroup& group , 
00436                              Profile* info , 
00437                              Profile::Property property);
00438 };
00440 class ProfileWriter
00441 {
00442 public:
00443     virtual ~ProfileWriter() {}
00449     virtual QString getPath(const Profile* profile) = 0;
00454     virtual bool writeProfile(const QString& path , const Profile* profile) = 0;
00455 };
00457 class KDE4ProfileWriter : public ProfileWriter
00458 {
00459 public:
00460     virtual QString getPath(const Profile* profile);
00461     virtual bool writeProfile(const QString& path , const Profile* profile);
00462 
00463 private:
00464     void writeStandardElement(KConfigGroup& group,
00465                               const Profile* profile,
00466                               Profile::Property property);
00467 };
00468 
00486 class ProfileCommandParser
00487 {
00488 public:
00494     QHash<Profile::Property,QVariant> parse(const QString& input);
00495 
00496 };
00497 
00498 }
00499 
00500 #endif // PROFILE_H

Konsole

Skip menu "Konsole"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

API Reference

Skip menu "API Reference"
  • Konsole
  • Libraries
  •   libkonq
Generated for API Reference by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal