OpenTwin 0.1
OpenTwin
 
Loading...
Searching...
No Matches
ProjectOverviewWidget.h
Go to the documentation of this file.
1
4// ###########################################################################################################################################################################################################################################################################################################################
5
6#pragma once
7
8// OpenTwin header
9#include "ControlsManager.h"
10#include "ProjectInformation.h"
13
14// Qt header
15#include <QtCore/qobject.h>
16#include <QtCore/qstring.h>
17#include <QtGui/qicon.h>
18
19// std header
20#include <map>
21#include <list>
22#include <string>
23
24class QTableWidget;
25class QTableWidgetItem;
26
27namespace tt { class Page; }
28namespace tt { class Group; }
29namespace ot { class Label; }
30namespace ot { class Table; }
31namespace ot { class CheckBox; }
32namespace ot { class LineEdit; }
33namespace ot { class ToolButton; }
34
35class ProjectOverviewEntry : public QObject {
36 Q_OBJECT
38public:
39 ProjectOverviewEntry(const ProjectInformation& _projectInfo, const QIcon& _projectTypeIcon, bool _ownerIsCreator, QTableWidget* _table);
40
41 void setIsChecked(bool _checked);
42 bool getIsChecked(void) const;
43 QString getProjectName(void) const;
44 bool getOwnerIsCreator(void) const { return m_ownerIsCreator; };
45
46Q_SIGNALS:
48
49private Q_SLOTS:
50 void slotCheckedChanged(void);
51
52private:
53 QTableWidget* m_table;
54 bool m_ownerIsCreator;
55 ot::CheckBox* m_checkBox;
56 QTableWidgetItem* m_typeItem;
57 QTableWidgetItem* m_nameItem;
58 QTableWidgetItem* m_ownerItem;
59 QTableWidgetItem* m_groupsItem;
60 QTableWidgetItem* m_lastAccessTimeItem;
61
62};
63
64// ###########################################################################################################################################################################################################################################################################################################################
65
66// ###########################################################################################################################################################################################################################################################################################################################
67
68// ###########################################################################################################################################################################################################################################################################################################################
69
70class ProjectOverviewWidget : public QObject, public ot::QWidgetInterface, public LockableWidget {
71 Q_OBJECT
73public:
74 enum class ViewMode {
75 ViewAll,
77 };
78
79 ProjectOverviewWidget(tt::Page* _ttbPage);
80 virtual ~ProjectOverviewWidget();
81
82 virtual void setWidgetLocked(bool _isLocked) override;
83
84 virtual QWidget* getQWidget(void) override { return m_widget; };
85 virtual const QWidget* getQWidget(void) const override { return m_widget; };
86
87 QString getCurrentProjectFilter(void) const;
88
89 std::list<QString> getSelectedProjects(void) const;
90
91 void refreshProjectList(void);
92 void refreshRecentProjects(void);
93
94Q_SIGNALS:
103
104private Q_SLOTS:
105 void slotUpdateItemSelection(void);
106
107 void slotCreateProject(void);
108 void slotProjectDoubleClicked(int _row, int _column);
109
110 void slotRefreshProjectList(void);
111 void slotRefreshRecentProjects(void);
112 void slotRefreshAllProjects(void);
113
114 void slotToggleViewMode(void);
115 void slotOpenProject(void);
116 void slotCopyProject(void);
117 void slotRenameProject(void);
118 void slotDeleteProject(void);
119 void slotExportProject(void);
120 void slotAccessProject(void);
121 void slotOwnerProject(void);
122
123 void slotFilterChanged(void);
124 void slotProjectCheckedChanged(void);
125
126 void slotHeaderClicked(int _index);
127
128private:
129 ot::ToolButton* iniToolButton(const QString& _text, const QString& _iconPath, tt::Group* _group, const QString& _toolTip);
130 void clear(void);
131 void addProject(const ProjectInformation& _projectInfo, bool _ownerIsCreator);
132 void updateCountLabel(bool _hasMore);
133 void updateToggleViewModeButton(void);
134 void updateToolButtonsEnabledState(bool _forceDisabled = false);
135 bool hasDifferentSelectedOwner(void);
136 ProjectOverviewEntry* findEntry(const QString& _projectName);
137 void sortTable(void);
138
139 enum SortMode {
140 NameAscending,
141 NameDescending,
142 LastAccessAscending,
143 LastAccessDescending
144 };
145
146 ViewMode m_mode;
147 SortMode m_sortMode;
148
149 QWidget* m_widget;
150
151 ot::LineEdit* m_filter;
152 ot::Table* m_table;
153 ot::Label* m_countLabel;
154
155 ot::ToolButton* m_createButton;
156 ot::ToolButton* m_refreshButton;
157 ot::ToolButton* m_toggleViewModeButton;
158
159 ot::ToolButton* m_openButton;
160 ot::ToolButton* m_copyButton;
161 ot::ToolButton* m_renameButton;
162 ot::ToolButton* m_deleteButton;
163 ot::ToolButton* m_exportButton;
164 ot::ToolButton* m_accessButton;
165 ot::ToolButton* m_ownerButton;
166
167 std::list<ProjectOverviewEntry*> m_entries;
168};
This file contains defines that may be used simplyfy class creation.
#define OT_DECL_NODEFAULT(___class)
Removes the default copy constructor and assignment operator.
Definition OTClassHelper.h:22
Definition Group.h:20
Definition ControlsManager.h:58
Definition ProjectInformation.h:18
Definition ProjectOverviewWidget.h:35
void checkedChanged()
bool getIsChecked(void) const
Definition ProjectOverviewWidget.cpp:97
void setIsChecked(bool _checked)
Definition ProjectOverviewWidget.cpp:93
QString getProjectName(void) const
Definition ProjectOverviewWidget.cpp:101
ProjectOverviewEntry(const ProjectInformation &_projectInfo, const QIcon &_projectTypeIcon, bool _ownerIsCreator, QTableWidget *_table)
Definition ProjectOverviewWidget.cpp:40
bool getOwnerIsCreator(void) const
Definition ProjectOverviewWidget.h:44
Definition ProjectOverviewWidget.h:70
virtual const QWidget * getQWidget(void) const override
Definition ProjectOverviewWidget.h:85
QString getCurrentProjectFilter(void) const
Definition ProjectOverviewWidget.cpp:208
ProjectOverviewWidget(tt::Page *_ttbPage)
Definition ProjectOverviewWidget.cpp:123
ViewMode
Definition ProjectOverviewWidget.h:74
void exportProjectRequest(void)
void deleteProjectRequest(void)
void createProjectRequest(void)
std::list< QString > getSelectedProjects(void) const
Definition ProjectOverviewWidget.cpp:212
void projectAccessRequest(void)
void projectOwnerRequest(void)
void refreshRecentProjects(void)
Definition ProjectOverviewWidget.cpp:226
void refreshProjectList(void)
Definition ProjectOverviewWidget.cpp:222
void copyProjectRequest(void)
void openProjectRequest(void)
virtual void setWidgetLocked(bool _isLocked) override
Definition ProjectOverviewWidget.cpp:200
void renameProjectRequest(void)
virtual QWidget * getQWidget(void) override
Returns a pointer to the root widget of this object.
Definition ProjectOverviewWidget.h:84
virtual ~ProjectOverviewWidget()
Definition ProjectOverviewWidget.cpp:196
Definition CheckBox.h:17
Definition Label.h:17
Definition LineEdit.h:17
Definition QWidgetInterface.h:18
Definition Table.h:22
Definition ToolButton.h:19
Definition Connector.h:8
Definition TabToolBar.h:18