[KLF Application][KLF Tools][KLF Backend][KLF Home]
KLatexFormula Project

src/klfsettings.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   file 
00003  *   This file is part of the KLatexFormula Project.
00004  *   Copyright (C) 2007 by Philippe Faist
00005  *   philippe.faist@bluewin.ch
00006  *                                                                         *
00007  *   This program is free software; you can redistribute it and/or modify  *
00008  *   it under the terms of the GNU General Public License as published by  *
00009  *   the Free Software Foundation; either version 2 of the License, or     *
00010  *   (at your option) any later version.                                   *
00011  *                                                                         *
00012  *   This program is distributed in the hope that it will be useful,       *
00013  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00014  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00015  *   GNU General Public License for more details.                          *
00016  *                                                                         *
00017  *   You should have received a copy of the GNU General Public License     *
00018  *   along with this program; if not, write to the                         *
00019  *   Free Software Foundation, Inc.,                                       *
00020  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
00021  ***************************************************************************/
00022 /* $Id: klfsettings.h 564 2010-11-21 21:30:46Z philippe $ */
00023 
00024 #ifndef KLFSETTINGS_H
00025 #define KLFSETTINGS_H
00026 
00027 #include <QDialog>
00028 #include <QTextCharFormat>
00029 #include <QCheckBox>
00030 #include <QPushButton>
00031 
00032 #include <klfbackend.h>
00033 
00034 class QTreeWidgetItem;
00035 class KLFColorChooser;
00036 class KLFPathChooser;
00037 class KLFLatexSyntaxHighlighter;
00038 class KLFMainWin;
00039 
00040 namespace Ui { class KLFSettings; }
00041 
00046 class KLF_EXPORT KLFSettings : public QDialog
00047 {
00048   Q_OBJECT
00049 
00050 public:
00051   enum SettingsControl {
00052     AppLanguage = 1,
00053     AppFonts,
00054     Preview,
00055     TooltipPreview,
00056     SyntaxHighlighting,
00057     ExecutablePaths,
00058     ExpandEPSBBox,
00059     ExportProfiles,
00060     LibrarySettings,
00061     ManageAddOns,
00062     ManagePlugins,
00063     PluginsConfig
00064   };
00065 
00066   KLFSettings(KLFMainWin* parent = 0);
00067   ~KLFSettings();
00068 
00069   bool eventFilter(QObject *object, QEvent *event);
00070 
00071 public slots:
00072 
00073   void reset();
00074   void show();
00075 
00077   void showControl(int controlNum);
00080   void showControl(const QString& controlName);
00081 
00082   void apply();
00083 
00084   void help();
00085 
00086   void setDefaultPaths();
00087   void importAddOn();
00088   void importAddOn(const QString& fileName, bool uiSuggestRestart = true);
00089   void removeAddOn();
00090   void removePlugin();
00092   void removePlugin(const QString& fname);
00093 
00094   void retranslateUi(bool alsoBaseUi = true);
00095 
00096 protected:
00097 
00098 protected slots:
00099 
00100   void populateLocaleCombo();
00101   void populateExportProfilesCombos();
00102 
00103   void initPluginControls();
00104   void resetPluginControls();
00105   void refreshPluginSelected();
00106   void refreshAddOnList();
00107   void refreshAddOnSelected();
00108 
00109   virtual void accept();
00110 
00111   void slotChangeFontPresetSender();
00112   void slotChangeFontSender();
00113   void slotChangeFont(QPushButton *btn, const QFont& f);
00114 
00115 private:
00116   Ui::KLFSettings *u;
00117 
00118   KLFMainWin *_mainwin;
00119 
00120   bool pUserSetDefaultAppFont;
00121 
00122   QMap<QString,QPushButton*> pFontButtons;
00123   QMap<QString,QAction*> pFontBasePresetActions;
00124   QList<QAction*> pFontSetActions;
00125 
00126   struct TextFormatEnsemble {
00127     TextFormatEnsemble(QTextCharFormat *format,
00128                        KLFColorChooser *foreground, KLFColorChooser *background,
00129                        QCheckBox *chkBold, QCheckBox *chkItalic)
00130       : fmt(format), fg(foreground), bg(background), chkB(chkBold), chkI(chkItalic) { }
00131     QTextCharFormat *fmt;
00132     KLFColorChooser *fg;
00133     KLFColorChooser *bg;
00134     QCheckBox *chkB;
00135     QCheckBox *chkI;
00136   };
00137   QList<TextFormatEnsemble> _textformats;
00138 
00139   bool _pluginstuffloaded;
00140   QMap<QString,QWidget*> mPluginConfigWidgets;
00141   QMap<QString,QTreeWidgetItem*> mPluginListItems;
00142 
00143   bool setDefaultFor(const QString& progname, const QString& guessprog, bool required,
00144                      KLFPathChooser *destination);
00145 };
00146 
00147 #endif
00148 

Generated by doxygen 1.7.3