mirror of
https://github.com/QuasarApp/DocsSite.git
synced 2025-05-11 18:49:34 +00:00
refactoring
This commit is contained in:
parent
4a92817a66
commit
d14ebb252f
@ -13,6 +13,7 @@ QObject *AbstractSideBarItem::makeBlok() const {
|
||||
block->setTitle(title());
|
||||
block->setDescription(description());
|
||||
block->setBanner(backgroud());
|
||||
block->setPath(projectName());
|
||||
|
||||
return block;
|
||||
}
|
||||
|
@ -33,6 +33,12 @@ public:
|
||||
*/
|
||||
virtual QString backgroud() const = 0;
|
||||
|
||||
/**
|
||||
* @brief projectName this is name of folder with documentation data of project.
|
||||
* @return path to data of project
|
||||
*/
|
||||
virtual QString projectName() const = 0;
|
||||
|
||||
QObject *makeBlok() const;
|
||||
};
|
||||
|
||||
|
@ -1,6 +1,8 @@
|
||||
#include "mainmodel.h"
|
||||
#include "quasarapppage.h"
|
||||
#include "reader.h"
|
||||
#include <cqtdeployer.h>
|
||||
#include <home.h>
|
||||
#include <qasarapporder.h>
|
||||
#include <quasarapp.h>
|
||||
#include <quasarappsupportplatforms.h>
|
||||
@ -101,7 +103,8 @@ void makePage(QList<QObject *> *page, const Type& blockData) {
|
||||
|
||||
template<class Type, class ... Types>
|
||||
void makePage(QList<QObject *> *page, const Type& blockData, const Types& ... data) {
|
||||
// static_assert (std::is_same_v<Type, IResources>, "makePage must be use IResources schilds classes");
|
||||
static_assert (std::is_base_of_v<IResources, Type>,
|
||||
"The makePage fucntion must be use IResources schilds classes");
|
||||
|
||||
if (page) {
|
||||
page->push_back(blockData.makeBlok());
|
||||
@ -114,5 +117,10 @@ void MainModel::initQuasarApp() {
|
||||
makePage(page, QuasarAppPage{}, QuasarAppSupportPlatforms{}, QasarAppOrder{});
|
||||
_QuasarAppPages.insert("QuasarApp", page);
|
||||
|
||||
auto sideBar = new QList<QObject*>();
|
||||
makePage(sideBar, Home{}, CQtDeployer{});
|
||||
_QuasarAppPages.insert("SideBar", sideBar);
|
||||
_pageListModel->setExternalSource(sideBar);
|
||||
|
||||
}
|
||||
|
||||
|
@ -8,6 +8,7 @@
|
||||
*/
|
||||
class QuasarAppPage: public AbstractPage
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
QuasarAppPage();
|
||||
|
||||
|
@ -17,6 +17,10 @@ QString SideBarItem::banner() const {
|
||||
return m_banner;
|
||||
}
|
||||
|
||||
QString SideBarItem::path() const {
|
||||
return m_path;
|
||||
}
|
||||
|
||||
void SideBarItem::setTitle(QString title) {
|
||||
if (m_title == title)
|
||||
return;
|
||||
@ -40,3 +44,11 @@ void SideBarItem::setBanner(QString banner) {
|
||||
m_banner = banner;
|
||||
emit bannerChanged(m_banner);
|
||||
}
|
||||
|
||||
void SideBarItem::setPath(QString path) {
|
||||
if (m_path == path)
|
||||
return;
|
||||
|
||||
m_path = path;
|
||||
emit pathChanged(m_path);
|
||||
}
|
||||
|
@ -11,6 +11,7 @@ class SideBarItem: public QObject
|
||||
Q_PROPERTY(QString title READ title WRITE setTitle NOTIFY titleChanged)
|
||||
Q_PROPERTY(QString description READ description WRITE setDescription NOTIFY descriptionChanged)
|
||||
Q_PROPERTY(QString banner READ banner WRITE setBanner NOTIFY bannerChanged)
|
||||
Q_PROPERTY(QString path READ path WRITE setPath NOTIFY pathChanged)
|
||||
|
||||
public:
|
||||
explicit SideBarItem(QObject *parent = nullptr);
|
||||
@ -18,21 +19,26 @@ public:
|
||||
QString description() const;
|
||||
QString banner() const;
|
||||
|
||||
QString path() const;
|
||||
|
||||
public slots:
|
||||
void setTitle(QString title);
|
||||
void setDescription(QString description);
|
||||
void setBanner(QString banner);
|
||||
void setPath(QString path);
|
||||
|
||||
signals:
|
||||
void titleChanged(QString title);
|
||||
void descriptionChanged(QString description);
|
||||
void bannerChanged(QString banner);
|
||||
void pathChanged(QString path);
|
||||
|
||||
private:
|
||||
|
||||
QString m_title;
|
||||
QString m_description;
|
||||
QString m_banner;
|
||||
QString m_path;
|
||||
};
|
||||
|
||||
|
||||
|
@ -17,3 +17,7 @@ QString CQtDeployer::title() const {
|
||||
QString CQtDeployer::backgroud() const {
|
||||
return "CQtDeployer.png";
|
||||
}
|
||||
|
||||
QString CQtDeployer::projectName() const {
|
||||
return "CQtDeployer";
|
||||
}
|
||||
|
@ -16,6 +16,8 @@ public:
|
||||
QString description() const;
|
||||
QString title() const;
|
||||
QString backgroud() const;
|
||||
QString projectName() const;
|
||||
|
||||
};
|
||||
|
||||
#endif // CQTDEPLOYER_H
|
||||
|
@ -16,3 +16,7 @@ QString Home::title() const {
|
||||
QString Home::backgroud() const {
|
||||
return "QuasarApp.png";
|
||||
}
|
||||
|
||||
QString Home::projectName() const {
|
||||
return "";
|
||||
}
|
||||
|
@ -16,6 +16,7 @@ public:
|
||||
QString description() const;
|
||||
QString title() const;
|
||||
QString backgroud() const;
|
||||
QString projectName() const;
|
||||
};
|
||||
|
||||
#endif // HOME_H
|
||||
|
@ -14,20 +14,24 @@ Drawer {
|
||||
|
||||
ListView {
|
||||
id: viewPort
|
||||
model: parent.model
|
||||
model: root.model
|
||||
|
||||
delegate: Component {
|
||||
ImageView {
|
||||
property var data: modelData
|
||||
|
||||
anchors.fill: parent
|
||||
soucre: "qrc:/img/res/LOGO.png"
|
||||
text: "QuasarApp"
|
||||
toolTip: "QuasarApp Group"
|
||||
anchors.margins: 20
|
||||
borderColor: "#00a4e1"
|
||||
|
||||
height: width * 0.3
|
||||
width: root.width
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
anchors.fill: parent
|
||||
}
|
||||
}
|
||||
|
@ -37,6 +37,19 @@
|
||||
<translation>Темный режим</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>Home</name>
|
||||
<message>
|
||||
<location filename="../SideBar/home.cpp" line="9"/>
|
||||
<source>Back to main page</source>
|
||||
<translation type="unfinished">Вернуться на главную страницу</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../SideBar/home.cpp" line="13"/>
|
||||
<source>Main page</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>Languages</name>
|
||||
<message>
|
||||
|
Loading…
x
Reference in New Issue
Block a user