mainwindow.h 4.13 KB
Newer Older
jhammen's avatar
jhammen committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/*
 * This file is part of Bipscript-IDE.
 *
 * Bipscript-IDE 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.
 *
 * Bipscript-IDE 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 Bipscript-IDE.  If not, see <http://www.gnu.org/licenses/>.
 */
#ifndef MAINWINDOW_H
#define MAINWINDOW_H

20
#include "audioengine.h"
jhammen's avatar
jhammen committed
21
#include "editorwidget.h"
22
#include "foldertreeitem.h"
jhammen's avatar
jhammen committed
23
24
#include "outputwidget.h"
#include "position.h"
25
#include "projectlist.h"
jhammen's avatar
jhammen committed
26
#include "searchwidget.h"
jhammen's avatar
jhammen committed
27
28

#include <QFileInfo>
29
#include <QLabel>
jhammen's avatar
jhammen committed
30
31
32
33
34
35
36
#include <QMainWindow>
#include <QMessageBox>

namespace Ui {
class MainWindow;
}

37
class MainWindow : public QMainWindow {
jhammen's avatar
jhammen committed
38
    Q_OBJECT
39
  public:
jhammen's avatar
jhammen committed
40
41
42
    explicit MainWindow(QWidget *parent = 0);
    ~MainWindow();
    void closeEvent(QCloseEvent *event);
43
  private slots:
jhammen's avatar
jhammen committed
44
45
46
47
48
49
    void changeProject();
    void closeOutputTab(int index);
    void closeEditorTab(int index);
    void codeError(const QString &, int);
    void engineDisconnect();
    void folderTreeClicked(QTreeWidgetItem *item, int col);
50
    void handleLink(const QUrl &);
jhammen's avatar
jhammen committed
51
    void handleLink(EditorLocation &);
jhammen's avatar
jhammen committed
52
    void markDirty(bool unsaved);
jhammen's avatar
jhammen committed
53
    void searchCurrent(const QString &);
jhammen's avatar
jhammen committed
54
    void searchNext(const QString &);
jhammen's avatar
jhammen committed
55
    void searchProject(const QString &);
jhammen's avatar
jhammen committed
56
    void replaceNext(const QString &term, const QString &replace);
jhammen's avatar
jhammen committed
57
    void clearSearch();
jhammen's avatar
jhammen committed
58
59
    void showTime(Position pos);
    void tabChanged(int index);
60
    void closeOtherEditors();
jhammen's avatar
jhammen committed
61
62
63
64
65
66
67
68
69
70
    void on_actionAbout_triggered();
    void on_actionAPIDocumentation_triggered();
    void on_actionCloseFile_triggered();
    void on_actionComment_triggered();
    void on_actionCopy_triggered();
    void on_actionCut_triggered();
    void on_actionDeleteFile_triggered();
    void on_actionExamples_triggered();
    void on_actionExit_triggered();
    void on_actionFastForward_triggered();
jhammen's avatar
jhammen committed
71
72
    void on_actionFind_in_Project_triggered();
    void on_actionFocusFind_triggered();
jhammen's avatar
jhammen committed
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
    void on_actionJackConnect_toggled(bool);
    void on_actionNewFile_triggered();
    void on_actionOpenFile_triggered();
    void on_actionOpenProject_triggered();
    void on_actionPaste_triggered();
    void on_actionProjectOptions_triggered();
    void on_actionRedo_triggered();
    void on_actionRenameFile_triggered();
    void on_actionRestart_triggered();
    void on_actionRewind_triggered();
    void on_actionRun_triggered();
    void on_actionSaveFile_triggered();
    void on_actionStartStopTransport_toggled(bool);
    void on_actionTransportLock_toggled(bool);
    void on_actionUndo_triggered();
    void on_actionWebsite_triggered();
89
    void on_tabWidget_customContextMenuRequested(const QPoint &pos);
90
91

  private:
92
    ProjectList &projectList;
jhammen's avatar
jhammen committed
93
94
95
96
97
98
    QString *selectedFolder;
    AudioEngine &audioEngine;
    AudioTimerService *atimer;
    uint transportPosition;
    AudioConfiguration audioConfig;
    Ui::MainWindow *ui;
jhammen's avatar
jhammen committed
99
    SearchWidget *searchWidget;
jhammen's avatar
jhammen committed
100
101
102
103
    QLabel timeWidget;
    QLabel bbtWidget;
    QLabel engineWidget;
    // private methods
104
105
    bool createOrOpenEditor(NamedFile &);
    bool createOrOpenEditor(const QString &);
jhammen's avatar
jhammen committed
106
107
108
109
110
111
112
113
114
115
    EditorWidget *currentEditor();
    void enableFileActions(EditorWidget *editor);
    void enableTransportControls(bool enabled);
    EditorWidget *findEditor(const QString &path);
    QTreeWidgetItem *findTreeItem(const QString &path);
    bool killAllScripts();
    bool killOrDetach(OutputWidget *output, const QString &name);
    void loadProject();
    bool saveAllTabs();
    bool saveOrAbandon(EditorWidget *editor);
jhammen's avatar
jhammen committed
116
117
    QList<EditorLink> searchFile(const QString &term, const QString &path);
    void searchFolder(const QString &term, NamedFile &folder);
jhammen's avatar
jhammen committed
118
119
120
121
122
    FolderTreeItem *toTreeFolder(NamedFile &folder);
    QMessageBox::StandardButton unsavedChangesDialog(const QString &);
};

#endif // MAINWINDOW_H