mirror of
https://gitea.msk.dinamika-avia.ru/Constanta-Design/RRJServer.git
synced 2026-03-28 19:55:48 +03:00
refact1
This commit is contained in:
119
LibInstructorsAndTrainees/commonview.h
Normal file
119
LibInstructorsAndTrainees/commonview.h
Normal file
@@ -0,0 +1,119 @@
|
||||
#ifndef COMMONVIEW_H
|
||||
#define COMMONVIEW_H
|
||||
|
||||
#include <QTreeWidget>
|
||||
#include <QTranslator>
|
||||
#include <QMutex>
|
||||
#include <QMap>
|
||||
#include "instructorsAndTrainees_global.h"
|
||||
#include "connectortoserver.h"
|
||||
#include "waitanimationwidget.h"
|
||||
|
||||
//Родительский класс представления БД Инструкторов/Обучаемых (самого верхнего уровня)
|
||||
|
||||
class CommonView : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
enum TypeView
|
||||
{
|
||||
onlyView,
|
||||
control
|
||||
};
|
||||
|
||||
enum TypeObject
|
||||
{
|
||||
objInstructor,
|
||||
objTrainee,
|
||||
objGroup
|
||||
};
|
||||
|
||||
protected:
|
||||
enum ColumnsTreeUsers{
|
||||
clmn_Name = 0,
|
||||
clmn_Login,
|
||||
clmn_Password,
|
||||
clmn_Class,
|
||||
clmn_Computer,
|
||||
clmn_IP_address,
|
||||
clmn_Administrator,
|
||||
clmn_Archived,
|
||||
clmn_Logged,
|
||||
clmn_ID,
|
||||
clmn_count
|
||||
};
|
||||
|
||||
public:
|
||||
CommonView(ConnectorToServer* connectorToServer, TypeView type, QWidget *parent = nullptr);
|
||||
~CommonView();
|
||||
|
||||
void resizeEvent(QResizeEvent *event) override;
|
||||
|
||||
public:
|
||||
void setAdminMode(bool adminMode)
|
||||
{
|
||||
this->adminMode = adminMode;
|
||||
}
|
||||
void activate()
|
||||
{
|
||||
treeWidget->setEnabled(true);
|
||||
}
|
||||
void deactivate()
|
||||
{
|
||||
treeWidget->clear();
|
||||
treeWidget->setEnabled(false);
|
||||
lastCurrentID = 0;
|
||||
mapNewMsg.clear();
|
||||
}
|
||||
void clearSelection()
|
||||
{
|
||||
treeWidget->clearSelection();
|
||||
lastCurrentID = 0;
|
||||
}
|
||||
|
||||
protected:
|
||||
void setArchiveVisible(bool archiveVisible)
|
||||
{
|
||||
this->archiveVisible = archiveVisible;
|
||||
}
|
||||
void setNotLoggedInVisible(bool notLoggedInVisible)
|
||||
{
|
||||
this->notLoggedInVisible = notLoggedInVisible;
|
||||
}
|
||||
|
||||
void setItemColorArchive(QTreeWidgetItem* item);
|
||||
void setItemColorNoArchive(QTreeWidgetItem* item);
|
||||
|
||||
void setItemColor(QTreeWidgetItem* item, QColor color);
|
||||
|
||||
void preparationTreeWidget();
|
||||
|
||||
private:
|
||||
int calculateWidth_0Column();
|
||||
void setWidthColumnsTree();
|
||||
|
||||
protected:
|
||||
void reSetHeadTreeWidget();
|
||||
|
||||
protected:
|
||||
ConnectorToServer* connectorToServer;
|
||||
QTreeWidget* treeWidget;
|
||||
QList<int> listWidthColumn;
|
||||
QString TypeUserDB;
|
||||
QMutex mtxTreeWidget;
|
||||
TypeView typeView;
|
||||
bool archiveVisible;
|
||||
bool notLoggedInVisible;
|
||||
bool adminMode;
|
||||
bool authComplited;
|
||||
int lastCurrentID;
|
||||
TypeObject typeObject;
|
||||
|
||||
QMutex mtxmapNewMsg;
|
||||
QMap<int, bool> mapNewMsg;
|
||||
|
||||
WaitAnimationWidget *waitAnimationWidget;
|
||||
};
|
||||
|
||||
#endif // COMMONVIEW_H
|
||||
Reference in New Issue
Block a user