93 lines
2.7 KiB
C++
93 lines
2.7 KiB
C++
#ifndef MAINWINDOW_H
|
|
#define MAINWINDOW_H
|
|
|
|
#include <QMainWindow>
|
|
#include "manager.h"
|
|
#include "genpass.h"
|
|
//# include"recordmodificationdialog.h"
|
|
//#include "addst.h"
|
|
#include"adddialog.h"
|
|
#include"del.h"
|
|
#include"about.h"
|
|
//#include"hello.h"
|
|
#include"cryptographer.h"
|
|
|
|
QT_BEGIN_NAMESPACE
|
|
namespace Ui { class MainWindow; }
|
|
QT_END_NAMESPACE
|
|
|
|
class MainWindow : public QMainWindow
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
MainWindow(QWidget *parent = nullptr);
|
|
~MainWindow();
|
|
Ui::MainWindow* getUI();
|
|
void createModel();
|
|
void putRecord(Record* record);
|
|
Record* getRecord(int index);
|
|
void updateRecord(Record* r);
|
|
void deleteRecord();
|
|
int getRecordsCount();
|
|
bool initAppWithDatabaseFile(const QString &dbFileFullPath, const QString &password, bool isCreationNeed);
|
|
void connectToDatabase(const QString &dbName);
|
|
void createDatabase(const QString &dbName, const QString &password);
|
|
bool checkPassoword(QString word);
|
|
private:
|
|
// Manager* manager;
|
|
Ui::MainWindow *ui;
|
|
GenPass genpass;
|
|
AddDialog *dial;
|
|
About about;
|
|
// Hello* hello;
|
|
SimpleCrypt* crypto;
|
|
QSqlDatabase m_db; // объект базы данных.
|
|
QSqlQuery *query; // указатель на запрос.
|
|
QSqlTableModel *model; // указатель на таблицу данных в приложении.
|
|
|
|
Del* del;
|
|
// AddSt addst;
|
|
static const QString fileDialogFilterString;
|
|
static constexpr char* checkpoint = "checkpoint";
|
|
inline quint64 convertPassword(const QString &word)
|
|
{
|
|
quint64 value = 0;
|
|
for(auto x : word.toStdString())
|
|
{
|
|
value+=(char)x;
|
|
}
|
|
return value;
|
|
}
|
|
|
|
// void initAppWithDatabaseFile(const QString &dbFileFullPath);
|
|
|
|
private slots:
|
|
void on_actionCreateNewDatabase_triggered();
|
|
|
|
void on_actionOpenDatabase_triggered();
|
|
void on_addButton_clicked();
|
|
|
|
void addRecordSlot(Record *r);//слот принимающий текст из LineEdit
|
|
// void openDBSlot(QString path);
|
|
void acceptDelete();
|
|
|
|
void on_pushButton_clicked();
|
|
// void on_pushButton_2_clicked();
|
|
void on_actionExit_triggered();
|
|
// void on_tableView_activated(const QModelIndex &index);
|
|
void on_deleteButton_clicked();
|
|
void on_pushButton_5_clicked();
|
|
// void on_editButton_clicked();
|
|
void on_pushButton_7_clicked();
|
|
void on_actionblakc_triggered();
|
|
void on_pushButton_9_clicked();
|
|
void on_action_7_triggered();
|
|
// void on_action_2_triggered();
|
|
// void on_action_2_triggered(bool checked);
|
|
// void on_editSaveButton_clicked();
|
|
void on_pushButton_4_clicked();
|
|
void on_pushButton_6_clicked();
|
|
};
|
|
#endif // MAINWINDOW_H
|