mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2024-12-26 15:59:50 -05:00
Add UI as a member variable instead of inheriting it.
This commit is contained in:
parent
f90831b809
commit
57388ac896
@ -16,6 +16,7 @@
|
||||
*/
|
||||
|
||||
#include "MainWindow.h"
|
||||
#include "ui_MainWindow.h"
|
||||
|
||||
#include "core/Database.h"
|
||||
#include "core/Metadata.h"
|
||||
@ -23,28 +24,33 @@
|
||||
#include "gui/DatabaseWidget.h"
|
||||
|
||||
MainWindow::MainWindow()
|
||||
: m_ui(new Ui::MainWindow())
|
||||
{
|
||||
setupUi(this);
|
||||
m_ui->setupUi(this);
|
||||
|
||||
m_dbManager = new DatabaseManager(tabWidget);
|
||||
m_dbManager = new DatabaseManager(m_ui->tabWidget);
|
||||
|
||||
connect(tabWidget, SIGNAL(currentChanged(int)), SLOT(currentTabChanged(int)));
|
||||
connect(m_ui->tabWidget, SIGNAL(currentChanged(int)), SLOT(currentTabChanged(int)));
|
||||
|
||||
connect(actionDatabaseNew, SIGNAL(triggered()), m_dbManager, SLOT(newDatabase()));
|
||||
connect(actionDatabaseOpen, SIGNAL(triggered()), m_dbManager, SLOT(openDatabase()));
|
||||
connect(actionDatabaseSave, SIGNAL(triggered()), m_dbManager, SLOT(saveDatabase()));
|
||||
connect(actionDatabaseSaveAs, SIGNAL(triggered()), m_dbManager, SLOT(saveDatabaseAs()));
|
||||
connect(actionDatabaseClose, SIGNAL(triggered()), m_dbManager, SLOT(closeDatabase()));
|
||||
connect(actionQuit, SIGNAL(triggered()), SLOT(close()));
|
||||
connect(m_ui->actionDatabaseNew, SIGNAL(triggered()), m_dbManager, SLOT(newDatabase()));
|
||||
connect(m_ui->actionDatabaseOpen, SIGNAL(triggered()), m_dbManager, SLOT(openDatabase()));
|
||||
connect(m_ui->actionDatabaseSave, SIGNAL(triggered()), m_dbManager, SLOT(saveDatabase()));
|
||||
connect(m_ui->actionDatabaseSaveAs, SIGNAL(triggered()), m_dbManager, SLOT(saveDatabaseAs()));
|
||||
connect(m_ui->actionDatabaseClose, SIGNAL(triggered()), m_dbManager, SLOT(closeDatabase()));
|
||||
connect(m_ui->actionQuit, SIGNAL(triggered()), SLOT(close()));
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow()
|
||||
{
|
||||
}
|
||||
|
||||
void MainWindow::currentTabChanged(int index)
|
||||
{
|
||||
bool hasTab = (index != -1);
|
||||
|
||||
actionDatabaseSave->setEnabled(hasTab);
|
||||
actionDatabaseSaveAs->setEnabled(hasTab);
|
||||
actionDatabaseClose->setEnabled(hasTab);
|
||||
actionEntryNew->setEnabled(hasTab);
|
||||
actionGroupNew->setEnabled(hasTab);
|
||||
m_ui->actionDatabaseSave->setEnabled(hasTab);
|
||||
m_ui->actionDatabaseSaveAs->setEnabled(hasTab);
|
||||
m_ui->actionDatabaseClose->setEnabled(hasTab);
|
||||
m_ui->actionEntryNew->setEnabled(hasTab);
|
||||
m_ui->actionGroupNew->setEnabled(hasTab);
|
||||
}
|
||||
|
@ -18,23 +18,30 @@
|
||||
#ifndef KEEPASSX_MAINWINDOW_H
|
||||
#define KEEPASSX_MAINWINDOW_H
|
||||
|
||||
#include "ui_MainWindow.h"
|
||||
#include <QtGui/QMainWindow>
|
||||
|
||||
class Database;
|
||||
class DatabaseManager;
|
||||
namespace Ui {
|
||||
class MainWindow;
|
||||
}
|
||||
|
||||
class MainWindow : public QMainWindow, private Ui::MainWindow
|
||||
class MainWindow : public QMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
MainWindow();
|
||||
~MainWindow();
|
||||
|
||||
private Q_SLOTS:
|
||||
void currentTabChanged(int index);
|
||||
|
||||
private:
|
||||
QScopedPointer<Ui::MainWindow> m_ui;
|
||||
DatabaseManager* m_dbManager;
|
||||
|
||||
Q_DISABLE_COPY(MainWindow)
|
||||
};
|
||||
|
||||
#endif // KEEPASSX_MAINWINDOW_H
|
||||
|
Loading…
Reference in New Issue
Block a user