1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180
|
/*
* Copyright 2010 Mihai Niculescu <q.quark@gmail.com>
*
* This file is part of EqualX Project (https://launchpad.net/equalx/)
*
* EqualX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* EqualX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <QProcess>
#include <QTimer>
#include <QTime>
#include "defines.h"
#include "Symbol.h"
#include "LibraryData.h"
class QAction;
class QActionGroup;
class QButtonGroup;
class QCloseEvent;
class QMenu;
class QModelIndex;
class QMovie;
class QPushButton;
class QToolButton;
class QSignalMapper;
class QProcess;
class QStandardItemModel;
class QPlainTextEdit;
class DialogPreferencesBookmark;
class DialogPreferences;
class DialogReplace;
class DialogAbout;
class EquationView;
class LatexEditor;
class WidgetFind;
class SearchLineEdit;
class LibraryManager;
namespace EqualX {
class RenderEngine;
class FileInfo;
}
namespace Ui
{
class MainWindowClass;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
MainWindow(QWidget *parent = 0);
~MainWindow();
void setWindowModified(bool mod=true);
public slots:
void updateEquation(); // updates tex, png, and scene
void onFindTextChanged(const QString &exp);
void showFindDialog();
void showReplaceDialog();
void showLatexOutputWindow() const;
void insertSymbol(LatexSymbol *symbol);
void copyEquationToClipboard();
void pasteEquationFromClipboard();
void onActivatedHistoryRow(const LibraryModelData &row);
void onActivatedBookmark(int bookmarkId);
void onBookmarkAdd();
void showBookmarks();
void showHistory();
private slots:
void equationChanged();
void newEquation();
void onAbout();
void onDeleteSelection(); // delete selected text from editor
void onPreferences(); // show preferences dialog
void open();
bool saveAs();
void loadEquation(const QString &fileName);
void preferencesAccepted();
void renderStarted();
void renderFinished(int exitCode, QProcess::ExitStatus exitStatus);
void renderError(QProcess::ProcessError);
void writeSettings(); //read all settings from preferencesDialog and write them to the Settings File
void readSettings(); // read all settings from the Settings File and update preferencesDialog
protected:
void showEquation();
void clearCurrentHighlight();
void setActions();
void setSymbolsPanel();
void setMathPanelTabsActions();
void setSignals();
void setCustomStyleSheets();
bool saveEquation(const QString &fileName);
void closeEvent(QCloseEvent *);
/*
Adds ToolButtons with Actions conforming the file found by file name at eqImage
to the widget
*/
void addButtonToMathTabs(const QString &eqImage, QWidget *widget);
void addButtonToMathTabs(const QStringList &list, QWidget *widget);
void updateUIFromSettings(); // update Main Window UI according to settings
QString strippedName(const QString &fullFileName);
private:
void checkRequirements(); // check if the requirements are fulfilled
/* MainWindow widgets */
Ui::MainWindowClass *ui;
EqualX::FileInfo *mEquationData;
EquationView *mEquationView;
LatexEditor *mLatexEditor;
WidgetFind *mFindWidget;
QButtonGroup* renderModeButtonGroup;
QMovie* mAnimationProgress;
QTimer mAutoUpdateTimer;
SearchLineEdit* mSearchLineEdit;
QPlainTextEdit* mLatexOutput;
LibraryManager* mLibrary;
QActionGroup* mExportActionsGroup;
EqualX::RenderEngine* mRenderer;
QStandardItemModel* mSymbolsModel; // the symbols model used for completion in editor and searcher
// Dialogs
DialogReplace *mDialogReplace;
DialogPreferences *mDialogPreferences;
DialogAbout *mDialogAbout;
DialogPreferencesBookmark *mDialogBookmark;
Bookmark mCurrentBookmark; // holds the loaded bookmark from library (and which is currently displayed)
// data
QString curSaveDir; // current file
// flags
bool highlightAll;
};
#endif // MAINWINDOW_H
|