2025-10-02 15:03:26 +02:00
|
|
|
#ifndef MAINWINDOW_H
|
|
|
|
|
#define MAINWINDOW_H
|
|
|
|
|
|
2025-12-08 15:05:04 +01:00
|
|
|
#include <QItemSelection>
|
2025-10-02 15:03:26 +02:00
|
|
|
#include <QMainWindow>
|
|
|
|
|
|
2025-12-07 10:56:30 +01:00
|
|
|
QT_BEGIN_NAMESPACE
|
2025-12-04 16:44:31 +01:00
|
|
|
|
2025-12-06 10:36:21 +01:00
|
|
|
class QUndoStack;
|
2025-12-11 16:01:48 +01:00
|
|
|
|
|
|
|
|
class QUndoView;
|
2025-10-02 15:03:26 +02:00
|
|
|
namespace Ui {
|
|
|
|
|
class MainWindow;
|
|
|
|
|
}
|
|
|
|
|
QT_END_NAMESPACE
|
|
|
|
|
|
2025-12-04 16:44:31 +01:00
|
|
|
class GenericCore;
|
2025-12-17 10:33:18 +01:00
|
|
|
class TableModel;
|
2026-01-12 09:57:44 +01:00
|
|
|
class GeneralSortFilterModel;
|
2025-12-17 10:33:18 +01:00
|
|
|
class NewItemDialog;
|
|
|
|
|
class EditItemDialog;
|
2025-12-04 16:44:31 +01:00
|
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
|
|
2025-10-02 15:03:26 +02:00
|
|
|
class MainWindow : public QMainWindow {
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
MainWindow(QWidget* parent = nullptr);
|
|
|
|
|
~MainWindow();
|
|
|
|
|
|
2025-10-31 15:02:14 +01:00
|
|
|
signals:
|
|
|
|
|
void displayStatusMessage(QString message);
|
2025-10-31 15:31:33 +01:00
|
|
|
void checkForUpdates();
|
2025-10-31 15:22:20 +01:00
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
void closeEvent(QCloseEvent* event) override;
|
|
|
|
|
|
2025-10-02 15:03:26 +02:00
|
|
|
private slots:
|
2025-10-31 15:31:33 +01:00
|
|
|
void showStatusMessage(const QString text);
|
2025-12-22 11:21:44 +01:00
|
|
|
void onCurrentChanged(const QModelIndex& current, const QModelIndex& previous);
|
2025-12-08 15:05:04 +01:00
|
|
|
void onSelectionChanged(const QItemSelection& selected, const QItemSelection& deselected);
|
|
|
|
|
|
|
|
|
|
void onAboutClicked();
|
2025-11-04 21:21:28 +01:00
|
|
|
void on_actionCheck_for_update_triggered();
|
2025-10-31 15:31:33 +01:00
|
|
|
|
2025-10-02 15:03:26 +02:00
|
|
|
void on_pushButton_clicked();
|
|
|
|
|
|
2025-12-07 10:56:30 +01:00
|
|
|
/// slots for menu actions
|
|
|
|
|
void openNewItemDialog();
|
2025-12-17 10:33:18 +01:00
|
|
|
void openEditItemDialog();
|
2025-12-22 11:21:44 +01:00
|
|
|
void deleteCurrentItem();
|
2025-12-08 15:05:04 +01:00
|
|
|
void deleteSelectedtItems();
|
2025-12-07 10:56:30 +01:00
|
|
|
|
2025-12-11 16:01:48 +01:00
|
|
|
void onCleanStateChanged(bool clean);
|
|
|
|
|
void onShowUndoViewToggled(bool checked);
|
|
|
|
|
|
2025-12-23 10:18:00 +01:00
|
|
|
/// 'File' slots
|
|
|
|
|
void saveItems();
|
2026-01-04 16:52:03 +01:00
|
|
|
void importCSV();
|
2026-01-06 10:05:16 +01:00
|
|
|
void exportCSV();
|
2025-12-23 10:18:00 +01:00
|
|
|
|
2026-01-12 15:02:34 +01:00
|
|
|
/// 'Edit' slots
|
|
|
|
|
void findItems();
|
|
|
|
|
|
2026-01-29 09:00:12 +01:00
|
|
|
/// 'Server' slots
|
|
|
|
|
void fetchItems();
|
|
|
|
|
void postItems();
|
2026-02-02 16:26:13 +01:00
|
|
|
void deleteItem();
|
2026-01-29 09:00:12 +01:00
|
|
|
|
2026-02-03 11:22:55 +01:00
|
|
|
/// 'Tools' slots
|
|
|
|
|
void execSettingsDialog();
|
|
|
|
|
|
2025-10-02 15:03:26 +02:00
|
|
|
private:
|
|
|
|
|
Ui::MainWindow* ui;
|
|
|
|
|
|
2025-12-04 16:44:31 +01:00
|
|
|
unique_ptr<GenericCore> m_core;
|
2026-01-12 15:02:34 +01:00
|
|
|
shared_ptr<GeneralSortFilterModel> m_proxyModel;
|
2025-12-11 16:01:48 +01:00
|
|
|
QUndoStack* m_modelUndoStack;
|
|
|
|
|
unique_ptr<QUndoView> m_modelUndoView;
|
2025-12-04 16:44:31 +01:00
|
|
|
|
|
|
|
|
/// 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;
|
2026-01-29 09:00:12 +01:00
|
|
|
/// Server actions
|
|
|
|
|
unique_ptr<QAction> m_fetchItemsAct;
|
|
|
|
|
unique_ptr<QAction> m_postItemsAct;
|
2026-02-02 16:26:13 +01:00
|
|
|
unique_ptr<QAction> m_deleteItemsAct;
|
2026-01-29 09:00:12 +01:00
|
|
|
|
2025-12-11 16:01:48 +01:00
|
|
|
/// View actions
|
|
|
|
|
unique_ptr<QAction> m_showModelUndoViewAct;
|
2025-11-04 21:21:28 +01:00
|
|
|
|
2025-12-07 10:56:30 +01:00
|
|
|
/// Dialogs
|
|
|
|
|
unique_ptr<NewItemDialog> m_newItemDialog;
|
2025-12-17 10:33:18 +01:00
|
|
|
unique_ptr<EditItemDialog> m_editItemDialog;
|
2025-12-07 10:56:30 +01:00
|
|
|
|
2025-11-04 21:21:28 +01:00
|
|
|
/// Setup functions
|
2026-03-01 11:42:30 +01:00
|
|
|
void setupModelViews();
|
2025-11-04 21:21:28 +01:00
|
|
|
void createActions();
|
2025-12-04 16:44:31 +01:00
|
|
|
void createFileActions();
|
2025-12-11 16:01:48 +01:00
|
|
|
void createUndoActions();
|
2025-12-04 16:44:31 +01:00
|
|
|
void createEditActions();
|
2026-01-29 09:00:12 +01:00
|
|
|
void createServerActions();
|
2026-02-03 11:22:55 +01:00
|
|
|
void createToolsActions();
|
2025-11-04 21:21:28 +01:00
|
|
|
void createHelpMenu();
|
2025-12-07 10:56:30 +01:00
|
|
|
void createGuiDialogs();
|
2025-10-02 15:03:26 +02:00
|
|
|
};
|
|
|
|
|
#endif // MAINWINDOW_H
|