4
0
mirror of https://github.com/QuasarApp/DocsSite.git synced 2025-05-09 09:49:34 +00:00

work with sideBar (begin )

This commit is contained in:
Andrei Yankovich 2020-10-01 17:52:53 +03:00
parent 21da756fcc
commit 4a92817a66
26 changed files with 306 additions and 120 deletions

@ -13,6 +13,7 @@ if(TARGET ${PROJECT_NAME})
return()
endif()
set(DISABLE_EXAMPLES ON)
add_subdirectory(QuasarAppLib)
add_subdirectory(ViewSolutions)
@ -34,6 +35,8 @@ find_package(Qt5 COMPONENTS Core LinguistTools REQUIRED)
file(GLOB SOURCE_CPP
"src/*.cpp"
"src/Models/*.cpp"
"src/SideBar/*.cpp"
"src/*.qrc"
)
set(TS_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src/translations")
@ -56,5 +59,6 @@ target_compile_definitions(${PROJECT_NAME}
target_link_libraries(${PROJECT_NAME} PRIVATE Qt5::Core ViewSolutions QuasarApp BaseFront)
target_include_directories(${PROJECT_NAME} PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/src")
target_include_directories(${PROJECT_NAME} PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/src/Models")
target_include_directories(${PROJECT_NAME} PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/src/SideBar")
initWasmSupport(${PROJECT_NAME} deployWasm.json)

@ -1 +1 @@
Subproject commit 2e1cbba4422ab3fe704b510d816560ca70857223
Subproject commit 4612b8f0a657517879fa7b61fb24275553a69cd9

@ -17,6 +17,3 @@ QObject * AbstractPage::makeBlok() const {
return block;
}
QString AbstractPage::resourcesPath() const {
return "image://curhost/plugins/images";
}

@ -1,13 +1,15 @@
#ifndef ABSTRACTPAGE_H
#define ABSTRACTPAGE_H
#include "iresources.h"
#include <QObject>
#include <QString>
/**
* @brief The AbstractPage class - This is interface of all text pages on cpp.
*/
class AbstractPage: public QObject
class AbstractPage: public QObject, public IResources
{
Q_OBJECT
public:
@ -40,12 +42,7 @@ public:
QObject *makeBlok() const;
protected:
/**
* @brief resourcesPath This method return path to resources of site.
* By Default this is plugins folder.
* @return path tot resources.
*/
QString resourcesPath() const;
};
#endif // ABSTRACTPAGE_H

@ -0,0 +1,18 @@
#include "abstractsidebaritem.h"
#include <sidebaritem.h>
AbstractSideBarItem::AbstractSideBarItem()
{
}
QObject *AbstractSideBarItem::makeBlok() const {
auto block = new SideBarItem();
block->setTitle(title());
block->setDescription(description());
block->setBanner(backgroud());
return block;
}

@ -0,0 +1,39 @@
#ifndef ABSTRACTSIDEBARITEM_H
#define ABSTRACTSIDEBARITEM_H
#include "iresources.h"
#include <QObject>
/**
* @brief The AbstractSideBarItem class This is interface for sidebar items
*/
class AbstractSideBarItem: public QObject, public IResources
{
Q_OBJECT
public:
AbstractSideBarItem();
/**
* @brief description This is base method for get text description of page.
* All description must be use the tr method of qt.
* @return transalted text.
*/
virtual QString description() const = 0;
/**
* @brief title This method return title of page.
* @return title of page.
*/
virtual QString title() const = 0;
/**
* @brief backgroud This is path to image or video of background.
* @return path to backgroud.
*/
virtual QString backgroud() const = 0;
QObject *makeBlok() const;
};
#endif // ABSTRACTSIDEBARITEM_H

@ -0,0 +1,10 @@
#include "iresources.h"
IResources::IResources()
{
}
QString IResources::resourcesPath() const {
return "image://curhost/plugins/images";
}

@ -0,0 +1,28 @@
#ifndef IRESOURCES_H
#define IRESOURCES_H
#include <QString>
class QObject;
class IResources
{
public:
IResources();
virtual ~IResources() = default;
/**
* @brief makeBlok This method build infoblock from available data.
* @return the page data
*/
virtual QObject *makeBlok() const = 0;
/**
* @brief resourcesPath This method return path to resources of site.
* By Default this is plugins folder.
* @return path tot resources.
*/
virtual QString resourcesPath() const;
};
#endif // IRESOURCES_H

@ -60,9 +60,10 @@ void MainModel::changeLanguage(int code) {
break;
}
default:
QuasarAppUtils::Locales::setLocale(prefix);
}
QuasarAppUtils::Locales::setLocale(prefix);
}
QObject *MainModel::pageModel() const {
@ -100,6 +101,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");
if (page) {
page->push_back(blockData.makeBlok());
makePage(page, data...);

@ -0,0 +1,42 @@
#include "sidebaritem.h"
SideBarItem::SideBarItem(QObject *parent) : QObject(parent)
{
}
QString SideBarItem::title() const {
return m_title;
}
QString SideBarItem::description() const {
return m_description;
}
QString SideBarItem::banner() const {
return m_banner;
}
void SideBarItem::setTitle(QString title) {
if (m_title == title)
return;
m_title = title;
emit titleChanged(m_title);
}
void SideBarItem::setDescription(QString description) {
if (m_description == description)
return;
m_description = description;
emit descriptionChanged(m_description);
}
void SideBarItem::setBanner(QString banner) {
if (m_banner == banner)
return;
m_banner = banner;
emit bannerChanged(m_banner);
}

@ -0,0 +1,40 @@
#ifndef SIDEBARITEM_H
#define SIDEBARITEM_H
#include <QObject>
class SideBarItem: public QObject
{
Q_OBJECT
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)
public:
explicit SideBarItem(QObject *parent = nullptr);
QString title() const;
QString description() const;
QString banner() const;
public slots:
void setTitle(QString title);
void setDescription(QString description);
void setBanner(QString banner);
signals:
void titleChanged(QString title);
void descriptionChanged(QString description);
void bannerChanged(QString banner);
private:
QString m_title;
QString m_description;
QString m_banner;
};
#endif // SIDEBARITEM_H

@ -0,0 +1,19 @@
#include "cqtdeployer.h"
CQtDeployer::CQtDeployer()
{
}
QString CQtDeployer::description() const {
return tr("Crossplatform tool for deploying cpp applications."
" The CQtDeployer is application for extract all depends library of executable and create launch script for your application.");
}
QString CQtDeployer::title() const {
return "CQtDeployer";
}
QString CQtDeployer::backgroud() const {
return "CQtDeployer.png";
}

@ -0,0 +1,21 @@
#ifndef CQTDEPLOYER_H
#define CQTDEPLOYER_H
#include <abstractsidebaritem.h>
class CQtDeployer: public AbstractSideBarItem
{
Q_OBJECT
public:
CQtDeployer();
// AbstractSideBarItem interface
public:
QString description() const;
QString title() const;
QString backgroud() const;
};
#endif // CQTDEPLOYER_H

18
Site/src/SideBar/home.cpp Normal file

@ -0,0 +1,18 @@
#include "home.h"
Home::Home()
{
}
QString Home::description() const {
return tr("Back to main page");
}
QString Home::title() const {
return tr("Main page");
}
QString Home::backgroud() const {
return "QuasarApp.png";
}

21
Site/src/SideBar/home.h Normal file

@ -0,0 +1,21 @@
#ifndef HOME_H
#define HOME_H
#include <abstractsidebaritem.h>
class Home: public AbstractSideBarItem
{
Q_OBJECT
public:
Home();
// AbstractSideBarItem interface
public:
QString description() const;
QString title() const;
QString backgroud() const;
};
#endif // HOME_H

@ -24,71 +24,6 @@ ToolBar {
font.pointSize: 20
}
// ImageView {
// background: (0 == privateRoot.currentItem)? Material.accent : "#00000000"
// Layout.fillHeight: true
// Layout.preferredWidth: height * 1
// soucre : "qrc:/img/images/LOGO.png"
// toolTip: qsTr("Back to main page");
// power: 1.9
// onClicked: {
// privateRoot.currentItem = 0
// }
// }
// ImageView {
// background: (1 == privateRoot.currentItem)? Material.accent : "#00000000"
// Layout.fillHeight: true
// Layout.preferredWidth: height * 1
// soucre : "qrc:/img/images/CQtDeployer logo.png"
// toolTip: qsTr("Crossplatform tool for deploying cpp applications." +
// " The CQtDeployer is application for extract all depends library of executable and create launch script for your application.");
// power: 1.9
// onClicked: {
// privateRoot.currentItem = 1
// }
// }
// ImageView {
// background: (2 == privateRoot.currentItem)? Material.accent : "#00000000"
// Layout.fillHeight: true
// Layout.preferredWidth: height * 1
// soucre : "qrc:/img/images/Qt-Secret Logo.png"
// toolTip: qsTr("Fast encryption library supporting RSA and AES algorithms.");
// power: 1.9
// onClicked: {
// privateRoot.currentItem = 2
// }
// }
// ImageView {
// background: (3 == privateRoot.currentItem)? Material.accent : "#00000000"
// Layout.fillHeight: true
// Layout.preferredWidth: height * 1
// soucre : "qrc:/img/images/HanoiTowers.png"
// toolTip: qsTr("Simple Crossplatform game");
// power: 1.9
// onClicked: {
// privateRoot.currentItem = 3
// }
// }
// ImageView {
// background: (4 == privateRoot.currentItem)? Material.accent : "#00000000"
// Layout.fillHeight: true
// Layout.preferredWidth: height * 1
// soucre : "qrc:/img/images/QtBigint Logo.png"
// toolTip: qsTr("QtBigInt - Arbitrary-sized integer class for C++ and build system qmake and cmake. Power by minigmp.");
// power: 1.9
// onClicked: {
// privateRoot.currentItem = 4
// }
// }
Item {
Layout.fillWidth: true

@ -14,26 +14,37 @@ RowLayout {
mainModel.changeLanguage(currentItem);
}
ImageView {
background: (0 == root.currentItem)? Material.accent : "#00000000"
ToolButton {
Layout.preferredHeight: itemHeigh
Layout.preferredWidth: itemHeigh
soucre : "qrc:/img/images/EN.png"
toolTip: qsTr("Select English language");
power: 1.9
text : "EN"
onClicked: {
root.currentItem = 0
}
ToolTip {
parent: parent
visible: parent.hovered
text: qsTr("Select English language")
delay: 500
}
}
ImageView {
background: (1 == root.currentItem)? Material.accent : "#00000000"
ToolButton {
Layout.preferredHeight: itemHeigh
Layout.preferredWidth: itemHeigh
soucre : "qrc:/img/images/RU.png"
toolTip: qsTr("Select Russian language");
power: 1.9
text : "RU"
ToolTip {
parent: parent
visible: parent.hovered
text: qsTr("Select Russian language");
delay: 500
}
onClicked: {
root.currentItem = 1

@ -10,9 +10,11 @@ Drawer {
width: Math.max(parent.width * 0.3, 50 * Screen.pixelDensity)
height: parent.height
property var model: null
ListView {
id: viewPort
property real globalPos: 0
model: parent.model
delegate: Component {
ImageView {

@ -40,6 +40,7 @@ ApplicationWindow {
SideBar {
id: drawer
model: (mainModel)? mainModel.pageListModel: null
}

@ -1,11 +0,0 @@
<b> The QuasarApp</b> is developing open source mobile and desktop applications.<br><br>
Our company has ben created on 2017 yahr and have experians of develepment android and desctop applications and games.
<br><br>
During our existence, we have accumulated more than 40 software components and ready-made solutions for the most diverse tasks.
This approach allows us now to create final products with impressive speed. If you have an idea for the application, we will hear you.
<br><br>
At the moment, we can offer support for our solutions for the following platforms:<br><br>
* <i> Linux </i><br>
* <i> Windows </i><br>
* <i> Android </i><br>
* <i> Web </i><br>

Binary file not shown.

Before

(image error) Size: 8.6 KiB

Binary file not shown.

Before

(image error) Size: 12 KiB

@ -6,23 +6,6 @@
<file>View/Languages.qml</file>
<file>View/SideBar.qml</file>
</qresource>
<qresource prefix="/img">
<file>images/HanoiTowers.png</file>
<file>images/LOGO.png</file>
<file>images/CQtDeployer logo.png</file>
<file>images/QtBigint Logo.png</file>
<file>images/Qt-Secret Logo.png</file>
<file>images/os.png</file>
<file>images/EN.png</file>
<file>images/RU.png</file>
<file>images/crossplatforms.png</file>
<file>images/startup.png</file>
</qresource>
<qresource prefix="/sources">
<file>html/QuasarAppAbout.htm</file>
<file>html/QuasarAppLinks.htm</file>
<file>html/QuasarAppRequest.htm</file>
</qresource>
<qresource prefix="/fonts">
<file>fonts/Roboto-Regular.ttf</file>
<file>fonts/Lato-Regular.ttf</file>

@ -1,6 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="ru_RU">
<context>
<name>CQtDeployer</name>
<message>
<location filename="../SideBar/cqtdeployer.cpp" line="9"/>
<source>Crossplatform tool for deploying cpp applications. The CQtDeployer is application for extract all depends library of executable and create launch script for your application.</source>
<translation type="unfinished">Кроссплатформенный инструмент для развертывания приложений cpp. CQtDeployer - это приложение для извлечения всех зависимых библиотек исполняемых файлов и создания сценария запуска для вашего приложения.</translation>
</message>
</context>
<context>
<name>Header</name>
<message>
@ -24,7 +32,7 @@
<translation type="vanished">QtBigInt - Класс для работы с числами произвольного размера для C ++ и систем сборок qmake и cmake. Основоно но minigmp.</translation>
</message>
<message>
<location filename="../View/Header.qml" line="103"/>
<location filename="../View/Header.qml" line="38"/>
<source>Dark Mode</source>
<translation>Темный режим</translation>
</message>
@ -32,12 +40,12 @@
<context>
<name>Languages</name>
<message>
<location filename="../View/Languages.qml" line="22"/>
<location filename="../View/Languages.qml" line="29"/>
<source>Select English language</source>
<translation>Выберите английский язык</translation>
</message>
<message>
<location filename="../View/Languages.qml" line="35"/>
<location filename="../View/Languages.qml" line="44"/>
<source>Select Russian language</source>
<translation>Выбрать русский язык</translation>
</message>