File: c2bEditor.h

package info (click to toggle)
cb2bib 1.9.2-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 3,368 kB
  • sloc: cpp: 24,179; sh: 481; makefile: 16
file content (114 lines) | stat: -rw-r--r-- 2,732 bytes parent folder | download
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
/***************************************************************************
 *   Copyright (C) 2004-2015 by Pere Constans
 *   constans@molspaces.com
 *   cb2Bib version 1.9.2. Licensed under the GNU GPL version 3.
 *   See the LICENSE file that comes with this distribution.
 ***************************************************************************/
#ifndef C2BEDITOR_H
#define C2BEDITOR_H

#include "ui_c2bEditor.h"

#include <QMainWindow>
#include <QPointer>


class QDockWidget;
class QLabel;
class QStackedWidget;
class QSyntaxHighlighter;
class bibSearcher;
class c2bBibParser;
class c2bReferenceList;
class c2bSettings;
class c2bTextBrowser;
class c2bTextEdit;
class findDialog;


class c2bEditor : public QMainWindow
{

    Q_OBJECT

public:
    c2bEditor(const QString& file, const QString& mode, QWidget* main, QWidget* parentw = 0);
    c2bEditor(const QString& file, bibSearcher* searcher, QWidget* main, QWidget* parentw = 0);

    ~c2bEditor();

    inline QString editorFilename() const
    {
        return _editor_fn;
    }
    bool closeEditor();


signals:
    void editFileRenamed(const QString& old_name, const QString& new_name);
    void execute();
    void openBookmarks();
    void openFile(const QString& fn);
    void restartEngine();
    void restartQuery();


protected:
    virtual void closeEvent(QCloseEvent* qevent);


protected slots:
    bool fileSave();
    bool fileSaveAs();
    void cursorPositionChanged();
    void exportEntries();
    void fileOpen();
    void helpCb2Bib();
    void helpEditor();
    void isModified(int position, int charsRemoved, int charsAdded);
    void journalsToAbbreviated();
    void journalsToFull();
    void load();
    void overwriteModeChanged();
    void pasteCurrentBibTeX();
    void postProcess();
    void reload(const QString& fn);
    void saveAndExecute();
    void setViewMode(bool edit_mode);
    void showMessage(const QString& ms);
    void updateMetadata();
    void viewCb2Bib();


private:
    QDockWidget* _dockWidgetP;
    QLabel* _lineLabelP;
    QLabel* _overwriteLabelP;
    QPointer<bibSearcher> _searcherP;
    QStackedWidget* _stackedWidgetP;
    QString _edit_reference_at_position;
    QString _editor_fn;
    QString _editor_mode;
    QSyntaxHighlighter* _shP;
    QWidget* _c2b_mainP;
    Ui::c2bEditor ui;
    bool _is_modified_by_user;
    c2bBibParser* _bpP;
    c2bReferenceList* _referencesP;
    c2bSettings* _settingsP;
    c2bTextBrowser* _browserP;
    c2bTextEdit* _editorP;
    findDialog* _textFinderP;
    void createReferenceList();
    void importActions();
    void initEditor();
    void setEditorMode();

    QMenu* createPopupMenu()  // to avoid default context menu
    {
        return 0;
    }

};

#endif