"Fossies" - the Fresh Open Source Software Archive

Member "highlight-3.57-x64/src/gui-qt/mainwindow.h" (12 May 2020, 6055 Bytes) of package /windows/www/highlight-3.57-x64.zip:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. See also the last Fossies "Diffs" side-by-side code changes report for "mainwindow.h": 3.56_vs_3.57.

    1 /***************************************************************************
    2                                mainwindow.h
    3                              -------------------
    4     begin                : Mo 16.03.2009
    5     copyright            : (C) 2009-2020 by Andre Simon
    6     email                : a.simon@mailbox.org
    7  ***************************************************************************/
    8 
    9 /*
   10 This file is part of Highlight.
   11 
   12 Highlight is free software: you can redistribute it and/or modify
   13 it under the terms of the GNU General Public License as published by
   14 the Free Software Foundation, either version 3 of the License, or
   15 (at your option) any later version.
   16 
   17 Highlight is distributed in the hope that it will be useful,
   18 but WITHOUT ANY WARRANTY; without even the implied warranty of
   19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
   20 GNU General Public License for more details.
   21 
   22 You should have received a copy of the GNU General Public License
   23 along with Highlight.  If not, see <http://www.gnu.org/licenses/>.
   24 */
   25 
   26 #ifndef MAINWINDOW_H
   27 #define MAINWINDOW_H
   28 
   29 #include <QtGlobal>
   30 
   31 #if (QT_VERSION < QT_VERSION_CHECK(5,0,0))
   32 #include <QtGui/QMainWindow>
   33 #include <QtGui/QMessageBox>
   34 #include <QtGui/QFileDialog>
   35 #include <QtGui/QListWidget>
   36 #include <QLineEdit>
   37 #include <QScrollBar>
   38 #include <QDropEvent>
   39 #else
   40 #include <QtWidgets/QMainWindow>
   41 #include <QtWidgets/QMessageBox>
   42 #include <QtWidgets/QFileDialog>
   43 #include <QtWidgets/QListWidget>
   44 #include <QtWidgets/QLineEdit>
   45 #include <QtWidgets/QScrollBar>
   46 #include <QDropEvent>
   47 #endif
   48 #include <QSettings>
   49 #include <QDir>
   50 #include <QClipboard>
   51 #include <QMimeData>
   52 #include <QElapsedTimer>
   53 #include <QShortcut>
   54 #include <QString>
   55 #include <QList>
   56 #include <QTextStream>
   57 #include <QFileSystemWatcher>
   58 #include <QDesktopServices>
   59 #include <QStyleFactory>
   60 
   61 #include "version.h"
   62 #include "codegenerator.h"
   63 #include "htmlgenerator.h"
   64 
   65 #include <map>
   66 #include "enums.h"
   67 
   68 typedef multimap<string, string> MMap;
   69 typedef map<string, string> SMap;
   70 
   71 namespace Ui
   72 {
   73     class MainWindowClass;
   74 }
   75 
   76 class MainWindow : public QMainWindow
   77 {
   78     Q_OBJECT
   79 
   80 public:
   81     MainWindow(QWidget *parent = 0);
   82     ~MainWindow();
   83 
   84     void addToView(const QStringList& list, QListWidget* listWidget, const QString &iconName=":/file.png", bool checkable=false, bool baseName = false);
   85 private:
   86     Ui::MainWindowClass *ui;
   87     MMap assocByExtension, assocByFilename;
   88     SMap assocByShebang, rememberedAssoc, encodingHints;
   89     QString fileOpenFilter;
   90     QString savedClipboardContent;
   91     QString twoPassOutFile;
   92 
   93     QShortcut *copyShortcut;
   94     QShortcut *pasteShortcut;
   95     QFileSystemWatcher scriptWatcher;
   96     QStringList themesClassic;
   97     QStringList themesBase16;
   98     QList< QList<QString> > themesList;
   99 
  100     int oldThemeIndex;
  101 
  102     bool getDataFromCP, runFirstTime;
  103 
  104     void readSettings();
  105     void writeSettings();
  106     highlight::OutputType getOutputType();
  107     highlight::WrapMode getWrappingStyle();
  108     QString getOutFileSuffix();
  109     QString getUserScriptPath(QString type);
  110 
  111     QString getDistThemePath();
  112     QString getDistLangPath(const string & suffix);
  113     QString getDistPluginPath();
  114     QString getDistFileConfigPath();
  115     QString getDistFileFilterPath();
  116 
  117     QString getWindowsShortPath(const QString & path);
  118 
  119     void applyCtrlValues(highlight::CodeGenerator* generator, bool previewMode);
  120     void applyEncoding(highlight::CodeGenerator* generator, QString &langDefPath);
  121 
  122     void selectSingleFile(QLineEdit*, const QString&, const QString&);
  123     bool loadFileTypeConfig();
  124     bool shortNamesDisabled();
  125     void highlight2Clipboard(bool getDataFromCP);
  126 
  127     string analyzeFile(const string& file);
  128     string getFileType(const string& suffix, const string &inputFile);
  129     string getFileSuffix(const string& fileName);
  130     string getFileBaseName(const string& fileName);
  131     void readLuaList(const string& paramName, const string& langName, Diluculum::LuaValue &luaVal, MMap* extMap);
  132     void fillThemeCombo(int);
  133     void showHelpFile(const QString& file);
  134 
  135     void dragEnterEvent(QDragEnterEvent *event);
  136     void dragMoveEvent(QDragMoveEvent *event);
  137     void dragLeaveEvent(QDragLeaveEvent *event);
  138     void dropEvent(QDropEvent *event);
  139 
  140 public slots:
  141     //This is a slot like the ones we used in our last tutorial
  142     // The difference here that it gets automatically connect
  143     // If you use on_objectname_signalname it's like connect(pushButton,SIGNAL(clicked()),this,SLOT(on_pushButton_clicked()))
  144 
  145     void on_pbClearSelection_clicked();
  146     void on_pbOutputDest_clicked();
  147     void on_pbStartConversion_clicked();
  148     void on_pbCopyFile2CP_clicked();
  149 
  150 private slots:
  151 
  152     void on_actionVisit_website_triggered();
  153     void on_pbClearAllPlugins_clicked();
  154     void on_pbClearAll_clicked();
  155     void on_pbClearSelPlugin_clicked();
  156     void on_pbSelectPlugin_clicked();
  157     void on_pbSelectScript_clicked();
  158     void on_pbClearAllScripts_clicked();
  159     void on_pbClearSelScript_clicked();
  160 
  161     void on_pbCopyToCP_clicked();
  162     void on_pbPasteFromCB_clicked();
  163     void on_actionAbout_translations_triggered();
  164     void on_pbTEXChooseStyleIncFile_clicked();
  165     void on_pbLATEXChooseStyleIncFile_clicked();
  166     void on_pbHTMLChooseStyleIncFile_clicked();
  167     void on_pbSVGChooseStyleIncFile_clicked();
  168     void on_pbCopyAndPaste_clicked();
  169 
  170     void on_action_License_triggered();
  171     void on_action_Changelog_triggered();
  172     void on_action_Plug_Ins_triggered();
  173 
  174     void on_action_Manual_triggered();
  175     void on_action_About_Highlight_triggered();
  176     void on_action_Exit_triggered();
  177 
  178     void plausibility();
  179     void updatePreview();
  180     void openFiles();
  181 
  182     void on_actionDock_floating_panels_toggled(bool arg1);
  183     void on_pbPluginReadFilePath_clicked();
  184 
  185     void on_pbBrowseOutDir_clicked();
  186     void on_lvUserScripts_itemClicked(QListWidgetItem *item);
  187     void on_lvPluginScripts_itemClicked(QListWidgetItem *item);
  188 
  189     void on_browserPreview_selectionChanged();
  190     void on_comboThemeFilter_currentIndexChanged(int index);
  191 };
  192 
  193 #endif // MAINWINDOW_H