mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-28 13:10:19 +00:00
96d1cc570e
The Command line execution of Subsurface happened before the GUI was created, this leaded to various bugs by me(tm) over time. This patch seems to fix all of those, by reusing the same code for GUI interaction and CommandLine interaction. I had to rework how the main.c worked, it used to be C code calling C++ code, and this is non desirable, since C doesn't really understand C++. I Moved all of C-related code to 'subsurfacestartup.c/h' and created a tiny wrapper to call it, so all of the C code is still C code, and the new main.cpp calls the mainwindow->loadFiles and mainWindow->importFiles to get rid of the bugs that happened before. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
127 lines
2.9 KiB
C++
127 lines
2.9 KiB
C++
/*
|
|
* mainwindow.h
|
|
*
|
|
* header file for the main window of Subsurface
|
|
*
|
|
*/
|
|
#ifndef MAINWINDOW_H
|
|
#define MAINWINDOW_H
|
|
|
|
#include <QMainWindow>
|
|
#include <QAction>
|
|
|
|
struct DiveList;
|
|
class QSortFilterProxyModel;
|
|
class DiveTripModel;
|
|
|
|
|
|
namespace Ui
|
|
{
|
|
class MainWindow;
|
|
}
|
|
|
|
class DiveInfo;
|
|
class DiveNotes;
|
|
class Stats;
|
|
class Equipment;
|
|
class QItemSelection;
|
|
class DiveListView;
|
|
class GlobeGPS;
|
|
class MainTab;
|
|
class ProfileGraphicsView;
|
|
class QWebView;
|
|
|
|
enum MainWindowTitleFormat { MWTF_DEFAULT, MWTF_FILENAME };
|
|
|
|
class MainWindow : public QMainWindow
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
enum {COLLAPSED, EXPANDED};
|
|
|
|
MainWindow();
|
|
ProfileGraphicsView *graphics();
|
|
MainTab *information();
|
|
DiveListView *dive_list();
|
|
GlobeGPS *globe();
|
|
void showError(QString message);
|
|
void setTitle(enum MainWindowTitleFormat format);
|
|
|
|
// The 'Change DC Shortcuts' should only be enabled
|
|
// when the profile's visible.
|
|
void disableDcShortcuts();
|
|
void enableDcShortcuts();
|
|
void loadFiles(const QStringList files);
|
|
void importFiles(const QStringList importFiles);
|
|
|
|
private slots:
|
|
/* file menu action */
|
|
void on_actionNew_triggered();
|
|
void on_actionOpen_triggered();
|
|
void on_actionSave_triggered();
|
|
void on_actionSaveAs_triggered();
|
|
void on_actionClose_triggered();
|
|
void on_actionImport_triggered();
|
|
void on_actionExportUDDF_triggered();
|
|
void on_actionPrint_triggered();
|
|
void on_actionPreferences_triggered();
|
|
void on_actionQuit_triggered();
|
|
|
|
/* log menu actions */
|
|
void on_actionDownloadDC_triggered();
|
|
void on_actionDownloadWeb_triggered();
|
|
void on_actionEditDeviceNames_triggered();
|
|
void on_actionAddDive_triggered();
|
|
void on_actionRenumber_triggered();
|
|
void on_actionAutoGroup_triggered();
|
|
void on_actionToggleZoom_triggered();
|
|
void on_actionYearlyStatistics_triggered();
|
|
|
|
/* view menu actions */
|
|
void on_actionViewList_triggered();
|
|
void on_actionViewProfile_triggered();
|
|
void on_actionViewInfo_triggered();
|
|
void on_actionViewGlobe_triggered();
|
|
void on_actionViewAll_triggered();
|
|
void on_actionPreviousDC_triggered();
|
|
void on_actionNextDC_triggered();
|
|
|
|
/* other menu actions */
|
|
void on_actionSelectEvents_triggered();
|
|
void on_actionInputPlan_triggered();
|
|
void on_actionAboutSubsurface_triggered();
|
|
void on_actionUserManual_triggered();
|
|
void on_actionDivePlanner_triggered();
|
|
|
|
/* monitor resize of the info-profile splitter */
|
|
void on_mainSplitter_splitterMoved(int pos, int idx);
|
|
void on_infoProfileSplitter_splitterMoved(int pos, int idx);
|
|
|
|
void current_dive_changed(int divenr);
|
|
void initialUiSetup();
|
|
|
|
protected:
|
|
void closeEvent(QCloseEvent *);
|
|
|
|
public slots:
|
|
void readSettings();
|
|
void refreshDisplay();
|
|
void showProfile();
|
|
|
|
private:
|
|
Ui::MainWindow *ui;
|
|
QAction *actionNextDive;
|
|
QAction *actionPreviousDive;
|
|
QWebView *helpView;
|
|
QString filter();
|
|
bool askSaveChanges();
|
|
void writeSettings();
|
|
void redrawProfile();
|
|
void file_save();
|
|
void file_save_as();
|
|
void setupSplitters();
|
|
};
|
|
|
|
MainWindow *mainWindow();
|
|
|
|
#endif
|