[191] | 1 | /**********************************************************************
|
---|
| 2 | ** Copyright (C) 2000-2007 Trolltech ASA. All rights reserved.
|
---|
| 3 | **
|
---|
| 4 | ** This file is part of the Qt Assistant.
|
---|
| 5 | **
|
---|
| 6 | ** This file may be distributed and/or modified under the terms of the
|
---|
| 7 | ** GNU General Public License version 2 as published by the Free Software
|
---|
| 8 | ** Foundation and appearing in the file LICENSE.GPL included in the
|
---|
| 9 | ** packaging of this file.
|
---|
| 10 | **
|
---|
| 11 | ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
|
---|
| 12 | ** licenses may use this file in accordance with the Qt Commercial License
|
---|
| 13 | ** Agreement provided with the Software.
|
---|
| 14 | **
|
---|
| 15 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
---|
| 16 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
---|
| 17 | **
|
---|
| 18 | ** See http://www.trolltech.com/gpl/ for GPL licensing information.
|
---|
| 19 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
|
---|
| 20 | ** information about Qt Commercial License Agreements.
|
---|
| 21 | **
|
---|
| 22 | ** Contact info@trolltech.com if any conditions of this licensing are
|
---|
| 23 | ** not clear to you.
|
---|
| 24 | **
|
---|
| 25 | **********************************************************************/
|
---|
| 26 |
|
---|
| 27 | #ifndef CONFIG_H
|
---|
| 28 | #define CONFIG_H
|
---|
| 29 |
|
---|
| 30 | #include "profile.h"
|
---|
| 31 |
|
---|
| 32 | #include <qstring.h>
|
---|
| 33 | #include <qstringlist.h>
|
---|
| 34 | #include <qpixmap.h>
|
---|
| 35 | #include <qmap.h>
|
---|
| 36 |
|
---|
| 37 | class Profile;
|
---|
| 38 |
|
---|
| 39 | class Config
|
---|
| 40 | {
|
---|
| 41 | public:
|
---|
| 42 |
|
---|
| 43 | Config();
|
---|
| 44 |
|
---|
| 45 | void load();
|
---|
| 46 | void save();
|
---|
| 47 | Profile *profile() const { return profil; }
|
---|
| 48 | QString profileName() const { return profil->props["name"]; }
|
---|
| 49 | bool validProfileName() const;
|
---|
| 50 | void hideSideBar( bool b );
|
---|
| 51 | bool sideBarHidden() const;
|
---|
| 52 | QStringList mimePaths();
|
---|
| 53 |
|
---|
| 54 | // From profile, read only
|
---|
| 55 | QStringList docFiles() const;
|
---|
| 56 | QStringList docTitles() const;
|
---|
| 57 | QString indexPage( const QString &title ) const;
|
---|
| 58 | QString docImageDir( const QString &title ) const;
|
---|
| 59 | QPixmap docIcon( const QString &title ) const;
|
---|
| 60 |
|
---|
| 61 | QStringList profiles() const;
|
---|
| 62 | QString title() const;
|
---|
| 63 | QString aboutApplicationMenuText() const;
|
---|
| 64 | QString aboutURL() const;
|
---|
| 65 | QPixmap applicationIcon() const;
|
---|
| 66 |
|
---|
| 67 | // From QSettings, read / write
|
---|
| 68 | QString webBrowser() const { return webBrows; }
|
---|
| 69 | void setWebBrowser( const QString &cmd ) { webBrows = cmd; }
|
---|
| 70 |
|
---|
| 71 | QString homePage() const;
|
---|
| 72 | void setHomePage( const QString &hom ) { home = hom; }
|
---|
| 73 |
|
---|
| 74 | QString pdfReader() const { return pdfApp; }
|
---|
| 75 | void setPdfReader( const QString &cmd ) { pdfApp = cmd; }
|
---|
| 76 |
|
---|
| 77 | int fontSize() const { return fontSiz; }
|
---|
| 78 | void setFontSize( int size ) { fontSiz = size; }
|
---|
| 79 |
|
---|
| 80 | QString fontFamily() const { return fontFam; }
|
---|
| 81 | void setFontFamily( const QString &fam ) { fontFam = fam; }
|
---|
| 82 |
|
---|
| 83 | QString fontFixedFamily() const { return fontFix; }
|
---|
| 84 | void setFontFixedFamily( const QString &fn ) { fontFix = fn; }
|
---|
| 85 |
|
---|
| 86 | QString linkColor() const { return linkCol; }
|
---|
| 87 | void setLinkColor( const QString &col ) { linkCol = col; }
|
---|
| 88 |
|
---|
| 89 | QStringList source() const;
|
---|
| 90 | void setSource( const QStringList &s ) { src = s; }
|
---|
| 91 |
|
---|
| 92 | int sideBarPage() const { return sideBar; }
|
---|
| 93 | void setSideBarPage( int sbp ) { sideBar = sbp; }
|
---|
| 94 |
|
---|
| 95 | QRect geometry() const { return geom; }
|
---|
| 96 | void setGeometry( const QRect &geo ) { geom = geo; }
|
---|
| 97 |
|
---|
| 98 | bool isMaximized() const { return maximized; }
|
---|
| 99 | void setMaximized( bool max ) { maximized = max; }
|
---|
| 100 |
|
---|
| 101 | bool isLinkUnderline() const { return linkUnder; }
|
---|
| 102 | void setLinkUnderline( bool ul ) { linkUnder = ul; }
|
---|
| 103 |
|
---|
| 104 | QString mainWindowLayout() const { return mainWinLayout; }
|
---|
| 105 | void setMainWindowLayout( const QString &layout ) { mainWinLayout = layout; }
|
---|
| 106 |
|
---|
| 107 | QString assistantDocPath() const;
|
---|
| 108 |
|
---|
| 109 | bool docRebuild() const { return rebuildDocs; }
|
---|
| 110 | void setDocRebuild( bool rb ) { rebuildDocs = rb; }
|
---|
| 111 |
|
---|
| 112 | void saveProfile( Profile *profile );
|
---|
| 113 | void loadDefaultProfile();
|
---|
| 114 |
|
---|
| 115 | static Config *configuration();
|
---|
| 116 | static Config *loadConfig(const QString &profileFileName);
|
---|
| 117 |
|
---|
| 118 | private:
|
---|
| 119 | Config( const Config &c );
|
---|
| 120 | Config& operator=( const Config &c );
|
---|
| 121 |
|
---|
| 122 | void saveSettings();
|
---|
| 123 |
|
---|
| 124 | private:
|
---|
| 125 | Profile *profil;
|
---|
| 126 |
|
---|
| 127 | QStringList profileNames;
|
---|
| 128 | QString webBrows;
|
---|
| 129 | QString home;
|
---|
| 130 | QString pdfApp;
|
---|
| 131 | QString fontFam;
|
---|
| 132 | QString fontFix;
|
---|
| 133 | QString linkCol;
|
---|
| 134 | QStringList src;
|
---|
| 135 | QString mainWinLayout;
|
---|
| 136 | QRect geom;
|
---|
| 137 | int sideBar;
|
---|
| 138 | int fontSiz;
|
---|
| 139 | bool maximized;
|
---|
| 140 | bool linkUnder;
|
---|
| 141 | bool hideSidebar;
|
---|
| 142 | bool rebuildDocs;
|
---|
| 143 | };
|
---|
| 144 |
|
---|
| 145 | #endif
|
---|