Show measurement database.

--HG--
branch : feature
This commit is contained in:
Roman Telezhynskyi 2015-08-01 16:56:37 +03:00
parent 58f013cd1e
commit 78329af822
5 changed files with 36 additions and 4 deletions

View File

@ -52,9 +52,9 @@ DialogMDataBase::DialogMDataBase(QWidget *parent)
list() list()
{ {
ui->setupUi(this);
InitDataBase(); InitDataBase();
connect(ui->treeWidget, &QTreeWidget::itemChanged, this, &DialogMDataBase::UpdateChecks);
connect(ui->treeWidget, &QTreeWidget::itemClicked, this, &DialogMDataBase::ShowDescription); connect(ui->treeWidget, &QTreeWidget::itemClicked, this, &DialogMDataBase::ShowDescription);
} }
@ -635,9 +635,9 @@ void DialogMDataBase::AddMeasurement(QTreeWidgetItem *group, const QString &name
{ {
m->setCheckState(0, Qt::Unchecked); m->setCheckState(0, Qt::Unchecked);
} }
}
UpdateChecks(m, 0); UpdateChecks(m, 0);
}
const QString text = qApp->TrVars()->MNumber(name) + ". " + qApp->TrVars()->MToUser(name); const QString text = qApp->TrVars()->MNumber(name) + ". " + qApp->TrVars()->MToUser(name);
m->setText(0, text); m->setText(0, text);

View File

@ -36,13 +36,15 @@
#include <QLocalSocket> #include <QLocalSocket>
#include <QResource> #include <QResource>
#include <QTranslator> #include <QTranslator>
#include <QPointer>
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
MApplication::MApplication(int &argc, char **argv) MApplication::MApplication(int &argc, char **argv)
:VAbstractApplication(argc, argv), :VAbstractApplication(argc, argv),
mainWindows(), mainWindows(),
localServer(nullptr), localServer(nullptr),
trVars(nullptr) trVars(nullptr),
dataBase(QPointer<DialogMDataBase>())
{ {
setApplicationDisplayName(VER_PRODUCTNAME_STR); setApplicationDisplayName(VER_PRODUCTNAME_STR);
setApplicationName(VER_INTERNALNAME_STR); setApplicationName(VER_INTERNALNAME_STR);
@ -292,6 +294,22 @@ QString MApplication::diagramsPath() const
#endif #endif
} }
//---------------------------------------------------------------------------------------------------------------------
void MApplication::ShowDataBase()
{
if (dataBase.isNull())
{
dataBase = new DialogMDataBase();
dataBase->setAttribute(Qt::WA_DeleteOnClose, true);
dataBase->setModal(false);
dataBase->show();
}
else
{
dataBase->activateWindow();
}
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
#if defined(Q_WS_MAC) #if defined(Q_WS_MAC)
bool MApplication::event(QEvent* event) bool MApplication::event(QEvent* event)

View File

@ -33,6 +33,7 @@
#include "../vmisc/def.h" #include "../vmisc/def.h"
#include "../vmisc/vtapesettings.h" #include "../vmisc/vtapesettings.h"
#include "../vmisc/vabstractapplication.h" #include "../vmisc/vabstractapplication.h"
#include "dialogs/dialogmdatabase.h"
class MApplication;// use in define class MApplication;// use in define
class TMainWindow; class TMainWindow;
@ -70,6 +71,8 @@ public:
QString translationsPath() const; QString translationsPath() const;
QString diagramsPath() const; QString diagramsPath() const;
void ShowDataBase();
public slots: public slots:
TMainWindow *NewMainWindow(); TMainWindow *NewMainWindow();
@ -82,6 +85,7 @@ private:
QList<QPointer<TMainWindow> > mainWindows; QList<QPointer<TMainWindow> > mainWindows;
QLocalServer *localServer; QLocalServer *localServer;
VTranslateVars *trVars; VTranslateVars *trVars;
QPointer<DialogMDataBase> dataBase;
void Clean(); void Clean();
}; };

View File

@ -1135,6 +1135,7 @@ void TMainWindow::SetupMenu()
// Measurements // Measurements
connect(ui->actionAddCustom, &QAction::triggered, this, &TMainWindow::AddCustom); connect(ui->actionAddCustom, &QAction::triggered, this, &TMainWindow::AddCustom);
connect(ui->actionAddKnown, &QAction::triggered, this, &TMainWindow::AddKnown); connect(ui->actionAddKnown, &QAction::triggered, this, &TMainWindow::AddKnown);
connect(ui->actionDatabase, &QAction::triggered, qApp, &MApplication::ShowDataBase);
// Window // Window
connect(ui->menuWindow, &QMenu::aboutToShow, this, &TMainWindow::AboutToShowWindowMenu); connect(ui->menuWindow, &QMenu::aboutToShow, this, &TMainWindow::AboutToShowWindowMenu);

View File

@ -615,6 +615,7 @@
</property> </property>
<addaction name="actionAddKnown"/> <addaction name="actionAddKnown"/>
<addaction name="actionAddCustom"/> <addaction name="actionAddCustom"/>
<addaction name="actionDatabase"/>
</widget> </widget>
<addaction name="menuFile"/> <addaction name="menuFile"/>
<addaction name="menuMeasurements"/> <addaction name="menuMeasurements"/>
@ -784,6 +785,14 @@
<string>Open template</string> <string>Open template</string>
</property> </property>
</action> </action>
<action name="actionDatabase">
<property name="text">
<string>Database</string>
</property>
<property name="toolTip">
<string>Show information about all known measurement</string>
</property>
</action>
</widget> </widget>
<layoutdefault spacing="6" margin="11"/> <layoutdefault spacing="6" margin="11"/>
<resources> <resources>