124 lines
2.8 KiB
C++
124 lines
2.8 KiB
C++
#ifndef MAINWINDOW_H
|
|
#define MAINWINDOW_H
|
|
|
|
#include <QItemSelection>
|
|
#include <QMainWindow>
|
|
|
|
QT_BEGIN_NAMESPACE
|
|
|
|
class QUndoStack;
|
|
|
|
class QUndoView;
|
|
namespace Ui {
|
|
class MainWindow;
|
|
}
|
|
QT_END_NAMESPACE
|
|
|
|
class GenericCore;
|
|
class TableModel;
|
|
class GeneralSortFilterModel;
|
|
class NewItemDialog;
|
|
class EditItemDialog;
|
|
|
|
using namespace std;
|
|
|
|
class MainWindow : public QMainWindow {
|
|
Q_OBJECT
|
|
|
|
public:
|
|
MainWindow(QWidget* parent = nullptr);
|
|
~MainWindow();
|
|
|
|
signals:
|
|
void displayStatusMessage(QString message);
|
|
void checkForUpdates();
|
|
|
|
protected:
|
|
void closeEvent(QCloseEvent* event) override;
|
|
|
|
private slots:
|
|
void showStatusMessage(const QString text);
|
|
void onCurrentChanged(const QModelIndex& current, const QModelIndex& previous);
|
|
void onSelectionChanged(const QItemSelection& selected, const QItemSelection& deselected);
|
|
|
|
void onAboutClicked();
|
|
void on_actionCheck_for_update_triggered();
|
|
|
|
void on_pushButton_clicked();
|
|
|
|
/// slots for menu actions
|
|
void openNewItemDialog();
|
|
void openEditItemDialog();
|
|
void deleteCurrentItem();
|
|
void deleteSelectedtItems();
|
|
|
|
void onCleanStateChanged(bool clean);
|
|
void onShowUndoViewToggled(bool checked);
|
|
|
|
/// 'File' slots
|
|
void saveItems();
|
|
void importCSV();
|
|
void exportCSV();
|
|
|
|
/// 'Edit' slots
|
|
void findItems();
|
|
|
|
/// 'Server' slots
|
|
void fetchItems();
|
|
void postItems();
|
|
void deleteItem();
|
|
|
|
/// 'Tools' slots
|
|
void execSettingsDialog();
|
|
|
|
private:
|
|
Ui::MainWindow* ui;
|
|
|
|
unique_ptr<GenericCore> m_core;
|
|
shared_ptr<GeneralSortFilterModel> m_proxyModel;
|
|
QUndoStack* m_modelUndoStack;
|
|
unique_ptr<QUndoView> m_modelUndoView;
|
|
|
|
/// File actions
|
|
unique_ptr<QAction> m_newFileAct;
|
|
unique_ptr<QAction> m_openAct;
|
|
unique_ptr<QAction> m_saveAct;
|
|
unique_ptr<QAction> m_importAct;
|
|
unique_ptr<QAction> m_exportAct;
|
|
unique_ptr<QAction> m_printAct;
|
|
unique_ptr<QAction> m_exitAct;
|
|
/// Edit actions
|
|
unique_ptr<QAction> m_undoAct;
|
|
unique_ptr<QAction> m_redoAct;
|
|
unique_ptr<QAction> m_cutAct;
|
|
unique_ptr<QAction> m_copyAct;
|
|
unique_ptr<QAction> m_pasteAct;
|
|
unique_ptr<QAction> m_openNewItemDialogAct;
|
|
unique_ptr<QAction> m_openEditItemDialogAct;
|
|
unique_ptr<QAction> m_deleteItemAct;
|
|
unique_ptr<QAction> m_findItemAct;
|
|
/// Server actions
|
|
unique_ptr<QAction> m_fetchItemsAct;
|
|
unique_ptr<QAction> m_postItemsAct;
|
|
unique_ptr<QAction> m_deleteItemsAct;
|
|
|
|
/// View actions
|
|
unique_ptr<QAction> m_showModelUndoViewAct;
|
|
|
|
/// Dialogs
|
|
unique_ptr<NewItemDialog> m_newItemDialog;
|
|
unique_ptr<EditItemDialog> m_editItemDialog;
|
|
|
|
/// Setup functions
|
|
void setupModelViews();
|
|
void createActions();
|
|
void createFileActions();
|
|
void createUndoActions();
|
|
void createEditActions();
|
|
void createServerActions();
|
|
void createToolsActions();
|
|
void createHelpMenu();
|
|
void createGuiDialogs();
|
|
};
|
|
#endif // MAINWINDOW_H
|