mirror of
https://github.com/QuasarApp/DocsSite.git
synced 2025-05-16 04:49:33 +00:00
refactoring
This commit is contained in:
parent
4a92817a66
commit
d14ebb252f
@ -13,6 +13,7 @@ QObject *AbstractSideBarItem::makeBlok() const {
|
|||||||
block->setTitle(title());
|
block->setTitle(title());
|
||||||
block->setDescription(description());
|
block->setDescription(description());
|
||||||
block->setBanner(backgroud());
|
block->setBanner(backgroud());
|
||||||
|
block->setPath(projectName());
|
||||||
|
|
||||||
return block;
|
return block;
|
||||||
}
|
}
|
||||||
|
@ -33,6 +33,12 @@ public:
|
|||||||
*/
|
*/
|
||||||
virtual QString backgroud() const = 0;
|
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;
|
QObject *makeBlok() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
#include "mainmodel.h"
|
#include "mainmodel.h"
|
||||||
#include "quasarapppage.h"
|
#include "quasarapppage.h"
|
||||||
#include "reader.h"
|
#include "reader.h"
|
||||||
|
#include <cqtdeployer.h>
|
||||||
|
#include <home.h>
|
||||||
#include <qasarapporder.h>
|
#include <qasarapporder.h>
|
||||||
#include <quasarapp.h>
|
#include <quasarapp.h>
|
||||||
#include <quasarappsupportplatforms.h>
|
#include <quasarappsupportplatforms.h>
|
||||||
@ -101,7 +103,8 @@ void makePage(QList<QObject *> *page, const Type& blockData) {
|
|||||||
|
|
||||||
template<class Type, class ... Types>
|
template<class Type, class ... Types>
|
||||||
void makePage(QList<QObject *> *page, const Type& blockData, const Types& ... data) {
|
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) {
|
if (page) {
|
||||||
page->push_back(blockData.makeBlok());
|
page->push_back(blockData.makeBlok());
|
||||||
@ -114,5 +117,10 @@ void MainModel::initQuasarApp() {
|
|||||||
makePage(page, QuasarAppPage{}, QuasarAppSupportPlatforms{}, QasarAppOrder{});
|
makePage(page, QuasarAppPage{}, QuasarAppSupportPlatforms{}, QasarAppOrder{});
|
||||||
_QuasarAppPages.insert("QuasarApp", page);
|
_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
|
class QuasarAppPage: public AbstractPage
|
||||||
{
|
{
|
||||||
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
QuasarAppPage();
|
QuasarAppPage();
|
||||||
|
|
||||||
|
@ -17,6 +17,10 @@ QString SideBarItem::banner() const {
|
|||||||
return m_banner;
|
return m_banner;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString SideBarItem::path() const {
|
||||||
|
return m_path;
|
||||||
|
}
|
||||||
|
|
||||||
void SideBarItem::setTitle(QString title) {
|
void SideBarItem::setTitle(QString title) {
|
||||||
if (m_title == title)
|
if (m_title == title)
|
||||||
return;
|
return;
|
||||||
@ -40,3 +44,11 @@ void SideBarItem::setBanner(QString banner) {
|
|||||||
m_banner = banner;
|
m_banner = banner;
|
||||||
emit bannerChanged(m_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 title READ title WRITE setTitle NOTIFY titleChanged)
|
||||||
Q_PROPERTY(QString description READ description WRITE setDescription NOTIFY descriptionChanged)
|
Q_PROPERTY(QString description READ description WRITE setDescription NOTIFY descriptionChanged)
|
||||||
Q_PROPERTY(QString banner READ banner WRITE setBanner NOTIFY bannerChanged)
|
Q_PROPERTY(QString banner READ banner WRITE setBanner NOTIFY bannerChanged)
|
||||||
|
Q_PROPERTY(QString path READ path WRITE setPath NOTIFY pathChanged)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit SideBarItem(QObject *parent = nullptr);
|
explicit SideBarItem(QObject *parent = nullptr);
|
||||||
@ -18,21 +19,26 @@ public:
|
|||||||
QString description() const;
|
QString description() const;
|
||||||
QString banner() const;
|
QString banner() const;
|
||||||
|
|
||||||
|
QString path() const;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void setTitle(QString title);
|
void setTitle(QString title);
|
||||||
void setDescription(QString description);
|
void setDescription(QString description);
|
||||||
void setBanner(QString banner);
|
void setBanner(QString banner);
|
||||||
|
void setPath(QString path);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void titleChanged(QString title);
|
void titleChanged(QString title);
|
||||||
void descriptionChanged(QString description);
|
void descriptionChanged(QString description);
|
||||||
void bannerChanged(QString banner);
|
void bannerChanged(QString banner);
|
||||||
|
void pathChanged(QString path);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
QString m_title;
|
QString m_title;
|
||||||
QString m_description;
|
QString m_description;
|
||||||
QString m_banner;
|
QString m_banner;
|
||||||
|
QString m_path;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -17,3 +17,7 @@ QString CQtDeployer::title() const {
|
|||||||
QString CQtDeployer::backgroud() const {
|
QString CQtDeployer::backgroud() const {
|
||||||
return "CQtDeployer.png";
|
return "CQtDeployer.png";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString CQtDeployer::projectName() const {
|
||||||
|
return "CQtDeployer";
|
||||||
|
}
|
||||||
|
@ -16,6 +16,8 @@ public:
|
|||||||
QString description() const;
|
QString description() const;
|
||||||
QString title() const;
|
QString title() const;
|
||||||
QString backgroud() const;
|
QString backgroud() const;
|
||||||
|
QString projectName() const;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CQTDEPLOYER_H
|
#endif // CQTDEPLOYER_H
|
||||||
|
@ -16,3 +16,7 @@ QString Home::title() const {
|
|||||||
QString Home::backgroud() const {
|
QString Home::backgroud() const {
|
||||||
return "QuasarApp.png";
|
return "QuasarApp.png";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString Home::projectName() const {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
@ -16,6 +16,7 @@ public:
|
|||||||
QString description() const;
|
QString description() const;
|
||||||
QString title() const;
|
QString title() const;
|
||||||
QString backgroud() const;
|
QString backgroud() const;
|
||||||
|
QString projectName() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // HOME_H
|
#endif // HOME_H
|
||||||
|
@ -14,20 +14,24 @@ Drawer {
|
|||||||
|
|
||||||
ListView {
|
ListView {
|
||||||
id: viewPort
|
id: viewPort
|
||||||
model: parent.model
|
model: root.model
|
||||||
|
|
||||||
delegate: Component {
|
delegate: Component {
|
||||||
ImageView {
|
ImageView {
|
||||||
property var data: modelData
|
property var data: modelData
|
||||||
|
|
||||||
anchors.fill: parent
|
|
||||||
soucre: "qrc:/img/res/LOGO.png"
|
soucre: "qrc:/img/res/LOGO.png"
|
||||||
text: "QuasarApp"
|
text: "QuasarApp"
|
||||||
toolTip: "QuasarApp Group"
|
toolTip: "QuasarApp Group"
|
||||||
anchors.margins: 20
|
anchors.margins: 20
|
||||||
borderColor: "#00a4e1"
|
borderColor: "#00a4e1"
|
||||||
|
|
||||||
|
height: width * 0.3
|
||||||
|
width: root.width
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
anchors.fill: parent
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -37,6 +37,19 @@
|
|||||||
<translation>Темный режим</translation>
|
<translation>Темный режим</translation>
|
||||||
</message>
|
</message>
|
||||||
</context>
|
</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>
|
<context>
|
||||||
<name>Languages</name>
|
<name>Languages</name>
|
||||||
<message>
|
<message>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user