openPilotLog
backupwidget.h
1 /*
2  *openPilotLog - A FOSS Pilot Logbook Application
3  *Copyright (C) 2020-2022 Felix Turowsky
4  *
5  *This program is free software: you can redistribute it and/or modify
6  *it under the terms of the GNU General Public License as published by
7  *the Free Software Foundation, either version 3 of the License, or
8  *(at your option) any later version.
9  *
10  *This program is distributed in the hope that it will be useful,
11  *but WITHOUT ANY WARRANTY; without even the implied warranty of
12  *MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  *GNU General Public License for more details.
14  *
15  *You should have received a copy of the GNU General Public License
16  *along with this program. If not, see <https://www.gnu.org/licenses/>.
17  */
18 #ifndef BACKUPWIDGET_H
19 #define BACKUPWIDGET_H
20 
21 #include "src/classes/paths.h"
22 
23 #include <QWidget>
24 #include <QStandardItemModel>
25 #include <QFileSystemModel>
26 #include <QFileSystemWatcher>
27 #include <QTableView>
28 
29 namespace Ui {
30 class BackupWidget;
31 }
32 
42 class BackupWidget : public QWidget
43 {
44  Q_OBJECT
45 public:
46  explicit BackupWidget(QWidget *parent = nullptr);
47  ~BackupWidget();
48 
52  static const QString backupName();
53 
57  static const QString absoluteBackupPath();
58 
59 private slots:
60  void on_tableView_clicked(const QModelIndex &index);
61 
65  void on_createLocalPushButton_clicked();
66 
70  void on_restoreLocalPushButton_clicked();
71 
75  void on_deleteSelectedPushButton_clicked();
76 
80  void on_createExternalPushButton_clicked();
81 
85  void on_restoreExternalPushButton_clicked();
86 
90  void on_aboutPushButton_clicked();
91 
92 private:
93  Ui::BackupWidget *ui;
94 
95  QStandardItemModel *model;
96  QTableView *view;
97  QList<int> selectedRows;
98  void refresh();
99 
100 protected:
104  void changeEvent(QEvent* event) override;
105 };
106 
107 #endif // BACKUPWIDGET_H
The BackupWidget is the interface for the user to create and restore backups of the database.
Definition: backupwidget.h:43
static const QString backupName()
Generates a filename for creating a backup.
Definition: backupwidget.cpp:88
static const QString absoluteBackupPath()
Generates the absolute path for a new local backup file.
Definition: backupwidget.cpp:80
void changeEvent(QEvent *event) override
Handles change events, like updating the UI to new localisation.
Definition: backupwidget.cpp:49