Initial core QML API documentation

This commit is contained in:
Robert Griebl
2021-12-14 00:36:13 +01:00
parent 717bb77e4e
commit 679b04ae6b
11 changed files with 1668 additions and 8 deletions
+13
View File
@@ -42,6 +42,7 @@ jobs:
os: ubuntu-20.04
debian_container: "buildpack-deps:bullseye"
qmake_extra_config: "CONFIG+=backend-only"
generate_docs: true
- name: "Linux AppImage 64bit"
artifact: "Linux"
@@ -280,6 +281,18 @@ jobs:
name: ${{ matrix.config.artifact }}
path: "*.app"
- name: Generate Documentation
if: matrix.config.generate_docs
run: |
make apidocs
- name: Publish Documentation
if: matrix.config.generate_docs
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./doc/html/apidocs
release:
needs: [ build ]
if: startsWith(github.ref, 'refs/tags/v')
+2 -1
View File
@@ -28,7 +28,8 @@ ldtest
*.orig
*.rej
ui_*.h
*.pr?.user
*.pr?.user*
.DS_Store
translations/*.qm
CMakeLists.txt.user
doc/html
+9
View File
@@ -101,6 +101,9 @@ OTHER_FILES += \
unix/brickstore.desktop \
unix/brickstore-mime.xml \
windows/brickstore.iss \
doc/apidocs.qdocconf \
doc/apidocs.qdoc \
doc/apidocs.css \
LANGUAGES = en de fr cz pt es
@@ -151,6 +154,12 @@ sentry {
DEFINES *= SENTRY_ENABLED
}
qtPrepareTool(QDOC, qdoc)
#qtPrepareTool(QTATTRIBUTIONSCANNER, qtattributionscanner)
apidocs.commands = $$QDOC -D VERSION=$$VERSION "$$PWD/doc/apidocs.qdocconf"
QMAKE_EXTRA_TARGETS += apidocs
#
# Windows specific
#
+794
View File
@@ -0,0 +1,794 @@
body {
font: normal 400 14px/1.2 Arial;
margin-top: 50px;
font-family: Arial, Helvetica;
text-align: left;
margin-left: 5px;
margin-right: 5px;
background-color: #fff;
}
p {
line-height: 20px
}
img {
margin-left: 0px;
max-width: 800px;
height: auto;
}
.content .border img {
box-shadow:3px 3px 8px 3px rgba(200,200,200,0.5)
}
.content .border .player {
box-shadow:3px 3px 8px 3px rgba(200,200,200,0.5)
}
.content .indexboxcont li {
font: normal bold 13px/1 Verdana
}
.content .normallist li {
font: normal 13px/1 Verdana
}
.descr {
margin-top: 35px;
margin-bottom: 45px;
margin-left: 5px;
text-align: left;
vertical-align: top;
}
.name {
max-width: 75%;
font-weight: 100;
}
tt {
text-align: left
}
/*
-----------
links
-----------
*/
a:link {
color: #007330;
text-decoration: none;
text-align: left;
}
a.qa-mark:target:before {
content: "***";
color: #ff0000;
}
a:hover {
color: #44a51c;
text-align: left;
}
a:visited {
color: #007330;
text-align: left;
}
a:visited:hover {
color: #44a51c;
text-align: left;
}
/*
-----------
offline viewing: HTML links display an icon
-----------
*/
a[href*="http://"]::before,
a[href*="ftp://"]::before,
a[href*="https://"]::before {
content: url(../images/ico_out.png);
padding-right: 5px;
}
.video a {
background: none;
}
.flags {
text-decoration: none;
text-height: 24px;
}
.flags:target {
background-color: #FFFFD6;
}
/*
-------------------------------
NOTE styles
-------------------------------
*/
.admonition {
padding: 5px 0 5px 40px;
border: #ccc 1px solid;
}
.admonition.note, .admonition.important {
background: #f2f2f2 3px 6px no-repeat url(../images/ico_note.png);
}
.admonition.warning {
background: #f2f2f2 3px 6px no-repeat url(../images/ico_note_attention.png);
}
/*
-------------------------------
Top navigation
-------------------------------
*/
.qtref {
display: block;
position: relative;
height: 15px;
z-index: 1;
font-size: 11px;
padding-right: 10px;
float: right;
}
.naviNextPrevious {
clear: both;
display: block;
position: relative;
text-align: right;
top: -47px;
float: right;
height: 20px;
z-index: 1;
padding-right: 10px;
padding-top: 2px;
vertical-align: top;
margin: 0px;
}
.naviNextPrevious > a:first-child {
background-image: url(../images/btn_prev.png);
background-repeat: no-repeat;
background-position: left;
padding-left: 20px;
height: 20px;
padding-left: 20px;
}
.naviNextPrevious > a:last-child {
background-image: url(../images/btn_next.png);
background-repeat: no-repeat;
background-position: right;
padding-right: 20px;
height: 20px;
margin-left: 30px;
}
.naviSeparator { display: none }
/*
-----------
footer and license
-----------
*/
.footer {
text-align: left;
padding-top: 45px;
padding-left: 5px;
margin-top: 45px;
margin-bottom: 45px;
font-size: 10px;
border-top: 1px solid #999;
}
.footer p {
line-height: 14px;
font-size: 11px;
padding: 0;
margin: 0;
}
.footer a[href*="http://"], a[href*="ftp://"], a[href*="https://"] {
font-weight: bold;
}
.footerNavi {
width: auto;
text-align: right;
margin-top: 50px;
z-index: 1;
}
.navigationbar {
display: block;
position: relative;
border-top: 1px solid #cecece;
border-bottom: 1px solid #cecece;
background-color: #F2F2F2;
z-index: 1;
height: 20px;
padding-left: 7px;
margin: 0px;
padding-top: 2px;
margin-left: -5px;
margin-right: -5px;
}
.navigationbar .first {
background: url(../images/home.png);
background-position: left;
background-repeat: no-repeat;
padding-left: 20px;
}
.navigationbar ul {
margin: 0px;
padding: 0px;
}
.navigationbar ul li {
list-style-type: none;
padding-top: 2px;
padding-left: 4px;
margin: 0;
height: 20px;
}
.navigationbar li {
float: left
}
.navigationbar li a, .navigationbar td a {
display: block;
text-decoration: none;
background: url(../images/arrow_bc.png);
background-repeat: no-repeat;
background-position: right;
padding-right: 17px;
}
table.buildversion {
float: right;
margin-top: -18px !important;
}
.navigationbar table {
border-radius: 0;
border: 0 none;
background-color: #F2F2F2;
margin: 0;
}
.navigationbar table td {
padding: 0;
border: 0 none;
}
#buildversion {
font-style: italic;
float: right;
margin-right: 5px;
}
#buildversion a {
background: none;
}
/*
/* table of content
no display
*/
/*
-----------
headers
-----------
*/
@media screen {
.title {
color: #313131;
font-size: 20px;
font-weight: normal;
left: 0;
padding-bottom: 15px;
padding-left: 10px;
padding-top: 15px;
position: absolute;
right: 0;
top: 0;
background-color: #E6E6E6;
border-bottom: 1px #CCC solid;
font-weight: bold;
margin-left: 0px;
margin-right: 0px;
}
.subtitle, .small-subtitle {
display: block;
clear: left;
}
}
h1 {
margin: 0
}
h2, p.h2 {
font: 500 16px/1.2 Arial;
font-weight: 100;
background-color: #F2F3F4;
padding: 4px;
margin-bottom: 15px;
margin-top: 30px;
border-top: #E0E0DE 1px solid;
border-bottom: #E0E0DE 1px solid;
max-width: 99%;
}
h2:target {
background-color: #F2F3D4;
}
h3 {
font: 500 14px/1.2 Arial;
font-weight: 100;
text-decoration: underline;
margin-bottom: 15px;
margin-top: 30px;
}
h3.fn, span.fn {
border-width: 1px;
border-style: solid;
border-color: #E6E6E6;
-moz-border-radius: 7px 7px 7px 7px;
-webkit-border-radius: 7px 7px 7px 7px;
border-radius: 7px 7px 7px 7px;
background-color: #F6F6F6;
word-spacing: 3px;
padding: 5px 5px;
text-decoration: none;
font-weight: bold;
max-width: 75%;
font-size: 14px;
margin: 0px;
margin-top: 30px;
}
.fngroup h3.fngroupitem {
margin-bottom: 5px;
}
h3.fn code {
float: right;
}
h3.fn:target {
background-color: #F6F6D6;
}
.name {
color: #1A1A1A
}
.type {
color: #808080
}
@media print {
.title {
color: #0066CB;
font-family: Arial, Helvetica;
font-size: 32px;
font-weight: normal;
left: 0;
position: absolute;
right: 0;
top: 0;
}
}
/*
-----------------
table styles
-----------------
*/
.table img {
border: none;
margin-left: 0px;
-moz-box-shadow: 0px 0px 0px #fff;
-webkit-box-shadow: 0px 0px 0px #fff;
box-shadow: 0px 0px 0px #fff;
}
/* table with border alternative colours*/
table, pre, .LegaleseLeft {
-moz-border-radius: 7px 7px 7px 7px;
-webkit-border-radius: 7px 7px 7px 7px;
border-radius: 7px 7px 7px 7px;
background-color: #F6F6F6;
border: 1px solid #E6E6E6;
border-collapse: separate;
margin-bottom: 25px;
margin-left: 15px;
font-size: 12px;
line-height: 1.2;
}
table tr.even {
background-color: white;
color: #66666E;
}
table tr.odd {
background-color: #F6F6F6;
color: #66666E;
}
table tr:target {
background-color: #F6F6D6;
}
table thead {
text-align: left;
padding-left: 20px;
background-color: #e1e0e0;
border-left: none;
border-right: none;
}
table thead th {
padding-top: 5px;
padding-left: 10px;
padding-bottom: 5px;
border-bottom: 2px solid #D1D1D1;
padding-right: 10px;
}
table th {
text-align: left;
padding-left: 20px;
}
table td {
padding: 3px 15px 3px 20px;
border-bottom: #CCC dotted 1px;
}
table p {
margin: 0px
}
.LegaleseLeft {
font-family: monospace;
white-space: pre-wrap;
}
/* table bodless & white*/
.borderless {
border-radius: 0px 0px 0px 0px;
background-color: #fff;
border: 1px solid #fff;
}
.borderless tr {
background-color: #FFF;
color: #66666E;
}
.borderless td {
border: none;
border-bottom: #fff dotted 1px;
}
/*
-----------
List
-----------
*/
ul {
margin-top: 10px;
}
li {
margin-bottom: 10px;
padding-left: 8px;
list-style: outside;
text-align: left;
}
ul > li {
list-style-type: square;
}
ol {
margin: 10px;
padding: 0;
}
ol.A > li {
list-style-type: upper-alpha;
}
ol.a > li{
list-style-type: lower-alpha;
}
ol > li {
margin-left: 30px;
padding-left: 8px;
list-style-type: decimal;
}
ol.A > li {
list-style-type: upper-alpha;
}
ol.a > li {
list-style-type: lower-alpha;
}
ol.i > li {
list-style-type: lower-roman;
}
ol.I > li {
list-style-type: upper-roman;
}
.centerAlign {
text-align: left
}
.cpp, .LegaleseLeft {
display: block;
margin: 10px;
overflow: auto;
padding: 20px 20px 20px 20px;
}
.js {
display: block;
margin: 10px;
overflow: auto;
padding: 20px 20px 20px 20px;
}
.memItemLeft {
padding-right: 3px
}
.memItemRight {
padding: 3px 15px 3px 0
}
.qml {
display: block;
margin: 10px;
overflow: auto;
padding: 20px 20px 20px 20px;
}
.qmlextra {
padding-left: 5px;
float: right;
color: #254117;
}
.rightAlign {
padding: 3px 5px 3px 10px;
text-align: right;
}
.qmldoc {
margin-left: 15px
}
.flowList {
padding: 25px
}
.flowList dd {
display: inline-block;
margin-left: 10px;
width: 255px;
line-height: 1.15em;
overflow-x: hidden;
text-overflow: ellipsis
}
.alphaChar {
font-size: 2em;
position: relative
}
/*
-----------
Content table
-----------
*/
@media print {
.toc {
float: right;
clear: right;
padding-bottom: 10px;
padding-top: 50px;
width: 100%;
background-image: url(../images/bgrContent.png);
background-position: top;
background-repeat: no-repeat;
}
}
@media screen {
.toc {
float: right;
clear: right;
vertical-align: top;
-moz-border-radius: 7px 7px 7px 7px;
-webkit-border-radius: 7px 7px 7px 7px;
border-radius: 7px 7px 7px 7px;
background: #FFF url('../images/bgrContent.png');
background-position: top;
background-repeat: repeat-x;
border: 1px solid #E6E6E6;
padding-left: 5px;
padding-bottom: 10px;
height: auto;
width: 200px;
text-align: left;
margin-left: 20px;
margin-top: 5px;
}
}
.toc h3 {
text-decoration: none
}
.toc h3 {
font: 500 14px/1.2 Arial;
font-weight: 100;
padding: 0px;
margin: 0px;
padding-top: 5px;
padding-left: 5px;
}
.toc ul {
padding-left: 10px;
padding-right: 5px;
}
.toc ul li {
margin-left: 15px;
list-style-image: url(../images/bullet_dn.png);
marker-offset: 0px;
margin-bottom: 8px;
padding-left: 0px;
}
.toc .level1 {
border: none
}
.toc .level2 {
border: none;
margin-left: 25px;
}
.level3 {
border: none;
margin-left: 30px;
}
.clearfix {
clear: both
}
/*
-----------
Landing page
-----------
*/
.col-group {
white-space: nowrap;
vertical-align: top;
}
.landing h2 {
background-color: transparent;
border: none;
margin-bottom: 0px;
font-size: 18px;
}
.landing a, .landing li {
font-size: 13px;
font-weight: bold !important;
}
.col-1 {
display: inline-block;
white-space: normal;
width: 70%;
height: 100%;
float: left;
}
.col-2 {
display: inline-block;
white-space: normal;
width: 20%;
margin-left: 5%;
position: relative;
top: -20px;
}
.col-1 h1 {
margin: 20px 0 0 0;
}
.col-1 h2 {
font-size: 18px;
font-weight: bold !important;
}
.landingicons {
display: inline-block;
width: 100%;
}
.icons1of3 {
display: inline-block;
width: 33.3333%;
float: left;
}
.icons1of3 h2, .doc-column h2 {
font-size: 15px;
margin: 0px;
padding: 0px;
}
div.multi-column {
position: relative;
}
div.multi-column div {
display: -moz-inline-box;
display: inline-block;
vertical-align: top;
margin-top: 1em;
margin-right: 4em;
width: 24em;
}
.mainContent .video {
width:40%;
max-width:640px;
margin: 15px 0 0 15px;
position:relative;
display:table
}
.mainContent .video iframe {
width:100%;
height:100%;
position:absolute;
top:0;
left:0
}
+28
View File
@@ -0,0 +1,28 @@
/*! \page index.html
\keyword BrickStore QML API Documentation
\title BrickStore QML API Documentation
The \l{BrickStore} module provides QML types for creating mobile user interface as well as
for scripting extension in the desktop version.
The QML types can be imported into your application or extension using the
following import statement in your .qml file:
\badcode
import BrickStore 1.0
\endcode
\section1 QML Types
The following QML types are available:
\generatelist {qmltypesbymodule BrickStore}
\noautolist
*/
/*! \qmlmodule BrickStore 1.0
\title BrickStore QML types
\ingroup qmlmodules
\brief Provides QML types for BrickStore.
*/
+55
View File
@@ -0,0 +1,55 @@
project = BrickStore
description = BrickStore scripting API
versionsym = BRICKSTORE_VERSION
sources.fileextensions = "*.cpp *.qdoc *.mm *.qml"
headers.fileextensions = "*.h *.ch *.h++ *.hh *.hpp *.hxx"
examples.fileextensions = "*.cpp *.h *.qml *.yaml"
examples.imageextensions = "*.png *.jpg *.svg"
headerdirs += \
../src/qmlapi/ \
../src/desktop/ \
sourcedirs += \
. \
../src/qmlapi/ \
../src/desktop/ \
#depends += qtcore qtquick qtqml
outputdir = html/apidocs
HTML.stylesheets = apidocs.css
HTML.footer = \
"<div class=\"footer\">\n" \
" <p>\n" \
" <acronym title=\"Copyright\">&copy;</acronym> 2021 Robert Griebl.\n" \
" The documentation provided herein is licensed under the terms of the" \
" <a href=\"http://www.gnu.org/licenses/fdl.html\">GNU Free Documentation" \
" License version 1.3</a> as published by the Free Software Foundation.\n" \
" All trademarks are property of their respective owners.</p>\n" \
"</div>\n"
HTML.headerstyles = \
" <link rel=\"stylesheet\" type=\"text/css\" href=\"style/apidocs.css\" />\n"
HTML.endheader = \
"</head>\n"
HTML.postheader = \
"<body>\n" \
"<div class=\"header\" id=\"qtdocheader\">\n"\
" <div class=\"main\">\n" \
" <div class=\"main-rounded\">\n" \
" <div class=\"navigationbar\">\n"\
" <ul>\n"\
HTML.postpostheader = \
" </ul>\n"\
" </div>\n" \
"</div>\n" \
"<div class=\"content\">\n" \
"<div class=\"line\">\n" \
"<div class=\"content mainContent\">\n" \
+1 -1
View File
@@ -302,7 +302,7 @@ QCoro::Task<bool> Application::checkBrickLinkLogin()
} else {
if (co_await UIHelpers::question(tr("No valid BrickLink login settings found.<br /><br />Do you want to change the settings now?")
) == UIHelpers::Yes) {
showSettings("bricklink"_l1);
emit showSettings("bricklink"_l1);
}
}
co_return false;
+672
View File
@@ -65,6 +65,23 @@ void QmlImageItem::paint(QPainter *painter)
///////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
/*! \qmltype BrickLink
\inherits QtObject
\inqmlmodule BrickStore
\ingroup qml-api
\brief The core singleton managing the data transfer from and to BrickLink.
This singleton is responsible for handling all communications with the BrickLink servers, as
well as giving access to the BrickLink item catalog, which is available through these types:
\list
\li ItemType
\li Category
\li Color
\li Item
\li Picture
\li PriceGuide
\endlist
*/
QmlBrickLink *QmlBrickLink::s_inst = nullptr;
@@ -110,16 +127,39 @@ QmlBrickLink::QmlBrickLink(BrickLink::Core *core)
});
}
/*! \qmlproperty Item BrickLink::noItem
\readonly
A special Item object denoting an invalid item. The object's Item::isNull returns \c true.
Used as a return value for functions that can fail.
*/
QmlItem QmlBrickLink::noItem() const
{
return QmlItem { };
}
/*! \qmlproperty Color BrickLink::noColor
\readonly
A special Color object denoting an invalid color. The object's Color::isNull returns \c true.
Used as a return value for functions that can fail.
*/
QmlColor QmlBrickLink::noColor() const
{
return QmlColor { };
}
/*! \qmlmethod Color BrickLink::color(var color)
Create a JavaScript Color wrapper for a C++ \c{BrickLink::Color *} \a color obtained from a
data model.
*/
/*! \qmlmethod Color BrickLink::color(string colorName)
Returns a Color object corresponding to the given BrickLink \a colorName. If there is no match,
the returned object is noColor.
*/
/*! \qmlmethod Color BrickLink::color(uint colorId)
Returns a Color object corresponding to the given BrickLink \a colorId. If there is no match,
the returned object is noColor.
*/
QmlColor QmlBrickLink::color(const QVariant &v) const
{
if (v.userType() == qMetaTypeId<const BrickLink::Color *>())
@@ -130,41 +170,95 @@ QmlColor QmlBrickLink::color(const QVariant &v) const
return d->color(v.value<uint>());
}
/*! \qmlmethod Color BrickLink::colorFromLDrawId(int colorId)
Returns a Color object corresponding to the given LDraw \a colorId. If there is no match (or
if a LDraw installation isn't available), the returned object is noColor.
*/
QmlColor QmlBrickLink::colorFromLDrawId(int ldrawId) const
{
return d->colorFromLDrawId(ldrawId);
}
/*! \qmlmethod Category BrickLink::category(int categoryId)
Returns a Category object corresponding to the given BrickLink \a categoryId. If there is no
match, the returned object is noCategory.
*/
QmlCategory QmlBrickLink::category(int id) const
{
return d->category(uint(id));
}
/*! \qmlmethod ItemType BrickLink::itemType(string itemTypeId)
Returns an ItemType object corresponding to the given BrickLink \a itemTypeId. If there is no
match, the returned object is noItemType.
\note The id is a single letter string and has to be one of \c{PCGIMOPS}.
*/
QmlItemType QmlBrickLink::itemType(const QString &itemTypeId) const
{
return d->itemType(firstCharInString(itemTypeId));
}
/*! \qmlmethod Item BrickLink::item(string itemTypeId, string itemId)
Returns an Item object corresponding to the given BrickLink \a itemTypeId and \a itemId. If
there is no match, the returned object is noItem.
*/
QmlItem QmlBrickLink::item(const QString &itemTypeId, const QString &itemId) const
{
return d->item(firstCharInString(itemTypeId), itemId.toLatin1());
}
/*! \qmlsignal BrickLink::priceGuideUpdated(PriceGuide priceGuide)
This signal is emitted everytime the state of the \a priceGuide object changes. Receiving this
signal doesn't mean the preice guide data is available: you have to check the object's
properties to see what has changed.
*/
/*! \qmlmethod PriceGuide BrickLink::priceGuide(Item item, Color color, bool highPriority = false)
Creates a PriceGuide object that asynchronously loads (or downloads) the price guide data for
the given \a item and \a color combination. If you set \a highPriority to \c true the
load/download request will be pre-prended to the work queue instead of appended.
You need to connect to the signal BrickLink::priceGuideUpdated() to know when the data has
been loaded.
\sa PriceGuide
*/
QmlPriceGuide QmlBrickLink::priceGuide(QmlItem item, QmlColor color, bool highPriority)
{
return QmlPriceGuide { d->priceGuide(item.wrappedObject(), color.wrappedObject(), highPriority) };
}
/*! \qmlsignal BrickLink::pictureUpdated(Picture picture)
This signal is emitted everytime the state of the \a picture object changes. Receiving this
signal doesn't mean the picture is available: you have to check the object's properties
to see what has changed.
*/
/*! \qmlmethod Picture BrickLink::picture(Item item, Color color, bool highPriority = false)
Creates a Picture object that asynchronously loads (or downloads) the picture for the given
\a item and \a color combination. If you set \a highPriority to \c true the load/download
request will be pre-prended to the work queue instead of appended.
You need to connect to the signal BrickLink::pictureUpdated() to know when the data has
been loaded.
\sa Picture
*/
QmlPicture QmlBrickLink::picture(QmlItem item, QmlColor color, bool highPriority)
{
return QmlPicture { d->picture(item.wrappedObject(), color.wrappedObject(), highPriority) };
}
/*! \qmlmethod Picture BrickLink::largePicture(Item item, bool highPriority = false)
Creates a Picture object that asynchronously loads (or downloads) the large picture for the
given \a item. If you set \a highPriority to \c true the load/download request will be
pre-prended to the work queue instead of appended.
You need to connect to the signal BrickLink::pictureUpdated() to know when the data has
been loaded.
\sa Picture
*/
QmlPicture QmlBrickLink::largePicture(QmlItem item, bool highPriority)
{
return QmlPicture { d->largePicture(item.wrappedObject(), highPriority) };
}
/*! \qmlmethod Lot BrickLink::lot(var lot)
Create a JavaScript Lot wrapper for a C++ \c{BrickLink::Lot *} \a lot obtained from a data model.
*/
QmlLot QmlBrickLink::lot(const QVariant &v) const
{
if (v.userType() == qMetaTypeId<const BrickLink::Lot *>())
@@ -206,6 +300,32 @@ char QmlBrickLink::firstCharInString(const QString &str)
///////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
/*! \qmltype Category
\inqmlmodule BrickStore
\ingroup qml-api
\brief This value type represents a BrickLink item category.
Each category in the BrickLink catalog is available as a Category object.
You cannot create Category objects yourself, but you can retrieve a Category object given the
id via BrickLink::category().
Each Item also has a read-only property Item::category.
See \l https://www.bricklink.com/catalogCategory.asp
*/
/*! \qmlproperty bool Category::isNull
\readonly
Returns whether this Category is \c null. Since this type is a value wrapper around a C++
object, we cannot use the normal JavaScript \c null notation.
*/
/*! \qmlproperty int Category::id
\readonly
The BrickLink id of this category.
*/
/*! \qmlproperty string Category::name
\readonly
The BrickLink name of this category.
*/
QmlCategory::QmlCategory(const BrickLink::Category *cat)
: QmlWrapperBase(cat)
@@ -217,6 +337,97 @@ QmlCategory::QmlCategory(const BrickLink::Category *cat)
///////////////////////////////////////////////////////////////////////
/*! \qmltype ItemType
\inqmlmodule BrickStore
\ingroup qml-api
\brief This value type represents a BrickLink item type.
Each item type in the BrickLink catalog is available as an ItemType object.
You cannot create ItemType objects yourself, but you can retrieve an ItemType object given the
id via BrickLink::itemType().
Each Item also has a read-only property Item::itemType.
The currently available item types are
\table
\header
\li Id
\li Name
\row
\li \c B
\li Book
\row
\li \c C
\li Catalog
\row
\li \c G
\li Gear
\row
\li \c I
\li Instruction
\row
\li \c M
\li Minifigure
\row
\li \c O
\li Original Box
\row
\li \c P
\li Part
\row
\li \c S
\li Set
\endtable
*/
/*! \qmlproperty bool ItemType::isNull
\readonly
Returns whether this ItemType is \c null. Since this type is a value wrapper around a C++
object, we cannot use the normal JavaScript \c null notation.
*/
/*! \qmlproperty int ItemType::id
\readonly
The BrickLink id of this item type.
*/
/*! \qmlproperty string ItemType::name
\readonly
The BrickLink name of this item type.
*/
/*! \qmlproperty list<Category> ItemType::categories
\readonly
A list of Category objects describing all the categories that are referencing at least one item
of the given item type.
*/
/*! \qmlproperty bool ItemType::hasInventories
\readonly
Returns \c true if items under this type can have inventories, or \c false otherwise.
*/
/*! \qmlproperty bool ItemType::hasColors
\readonly
Returns \c true if items under this type can have colors, or \c false otherwise.
*/
/*! \qmlproperty bool ItemType::hasYearReleased
\readonly
Returns \c true if items under this type have data about the year the item was release,
or \c false otherwise.
*/
/*! \qmlproperty bool ItemType::hasWeight
\readonly
Returns \c true if items under this type can have weights, or \c false otherwise.
*/
/*! \qmlproperty bool ItemType::hasSubConditions
\readonly
Returns \c true if items under this type can have sub-conditions, or \c false otherwise.
*/
/*! \qmlproperty int ItemType::pictureId
\readonly
Item types may not have their own pictures, but use the pictures of another item type: in this
case you can get the id of the item type providing the pictures.
*/
/*! \qmlproperty size ItemType::pictureSize
\readonly
The default size and aspect ratio for item pictures of this type.
*/
QmlItemType::QmlItemType(const BrickLink::ItemType *itt)
: QmlWrapperBase(itt)
{ }
@@ -236,6 +447,84 @@ QVariantList QmlItemType::categories() const
///////////////////////////////////////////////////////////////////////
/*! \qmltype Color
\inqmlmodule BrickStore
\ingroup qml-api
\brief This value type represents a BrickLink color.
Each color in the BrickLink catalog is available as a Color object.
You cannot create Color objects yourself, but you can retrieve a Color object given the
id via the various BrickLink::color() overloads and BrickLink::colorFromLDrawId().
See \l https://www.bricklink.com/catalogColors.asp
*/
/*! \qmlproperty bool Color::isNull
\readonly
Returns whether this Color is \c null. Since this type is a value wrapper around a C++
object, we cannot use the normal JavaScript \c null notation.
*/
/*! \qmlproperty int Color::id
\readonly
The BrickLink id of this color.
*/
/*! \qmlproperty string Color::name
\readonly
The BrickLink name of this color.
*/
/*! \qmlproperty color Color::color
\readonly
Returns the RGB value of this BrickLink color as a basic QML color type.
*/
/*! \qmlproperty int Color::ldrawId
\readonly
The LDraw id of this color, or \c -1 if there is no match or if a LDraw installation isn't
available.
*/
/*! \qmlproperty bool Color::solid
\readonly
Returns \c true if this color is a solid color, or \c false otherwise.
*/
/*! \qmlproperty bool Color::transparent
\readonly
Returns \c true if this color is transparent, or \c false otherwise.
*/
/*! \qmlproperty bool Color::glitter
\readonly
Returns \c true if this color is glittery, or \c false otherwise.
*/
/*! \qmlproperty bool Color::speckle
\readonly
Returns \c true if this color is speckled, or \c false otherwise.
*/
/*! \qmlproperty bool Color::metallic
\readonly
Returns \c true if this color is metallic, or \c false otherwise.
*/
/*! \qmlproperty bool Color::chrome
\readonly
Returns \c true if this color is chrome-like, or \c false otherwise.
*/
/*! \qmlproperty bool Color::milky
\readonly
Returns \c true if this color is milky, or \c false otherwise.
*/
/*! \qmlproperty bool Color::modulex
\readonly
Returns \c true if this color is a Modulex color, or \c false otherwise.
*/
/*! \qmlproperty real Color::popularity
\readonly
Returns the popularity of this color, normalized to the range \c{[0 .. 1]}.
The raw popularity value is derived from summing up the counts of the \e Parts, \e{In Sets},
\e Wanted and \e{For Sale} columns in the \l{https://www.bricklink.com/catalogColors.asp}
{BrickLink Color Guide table}.
*/
/*! \qmlproperty image Color::image
\readonly
Returns a 20x20 pixel image of this color.
*/
QmlColor::QmlColor(const BrickLink::Color *col)
: QmlWrapperBase(col)
{ }
@@ -250,6 +539,69 @@ QImage QmlColor::image() const
///////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
/*! \qmltype Item
\inqmlmodule BrickStore
\ingroup qml-api
\brief This value type represents a BrickLink item.
Each item in the BrickLink catalog is available as an Item object.
You cannot create Item objects yourself, but you can retrieve an Item object given the
id via BrickLink::item().
See \l https://www.bricklink.com/catalog.asp
*/
/*! \qmlproperty bool Item::isNull
\readonly
Returns whether this Item is \c null. Since this type is a value wrapper around a C++
object, we cannot use the normal JavaScript \c null notation.
*/
/*! \qmlproperty int Item::id
\readonly
The BrickLink id of this item.
*/
/*! \qmlproperty string Item::name
\readonly
The BrickLink name of this item.
*/
/*! \qmlproperty ItemType Item::itemType
\readonly
The BrickLink item type of this item.
*/
/*! \qmlproperty Category Item::category
\readonly
The BrickLink category of this item.
*/
/*! \qmlproperty bool Item::hasInventory
\readonly
Returns \c true if a valid inventory exists for this item, or \c false otherwise.
*/
/*! \qmlproperty date Item::inventoryUpdated
\readonly
Holds the time stamp of the last successful update of the item's inventory.
*/
/*! \qmlproperty Color Item::defaultColor
\readonly
Returns the default color used by BrickLink to display a large picture for this item.
*/
/*! \qmlproperty real Item::weight
\readonly
Returns the weight of this item in gram.
*/
/*! \qmlproperty date Item::yearReleased
\readonly
Returns the year this item was first released.
*/
/*! \qmlproperty list<Color> Item::knownColors
\readonly
Returns a list of Color objects, containing all the colors the item is known to exist in.
\note An item might still exist in more colors than returned here: BrickStore is deriving this
data by looking at all the known inventories and PCCs (part-color-codes).
*/
/*! \qmlmethod bool Item::hasKnownColor(Color color)
Returns \c true if this item is known to exist in the given \a color, or \c false otherwise.
\sa knownColors
*/
QmlItem::QmlItem(const BrickLink::Item *item)
: QmlWrapperBase(item)
@@ -289,6 +641,59 @@ QVariantList QmlItem::consistsOf() const
///////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
/*! \qmltype Picture
\inqmlmodule BrickStore
\ingroup qml-api
\brief This value type represents a picture of a BrickLink item.
Each picture of an item in the BrickLink catalog is available as a Picture object.
You cannot create Picture objects yourself, but you can retrieve a Picture object given the
item and color id via BrickLink::picture() or BrickLink::largePicture().
\note Pictures aren't readily available, but need to be asynchronously loaded (or even
downloaded) at runtime. You need to connect to the signal BrickLink::pictureUpdated()
to know when the data has been loaded.
*/
/*! \qmlproperty bool Picture::isNull
\readonly
Returns whether this Picture is \c null. Since this type is a value wrapper around a C++
object, we cannot use the normal JavaScript \c null notation.
*/
/*! \qmlproperty Item Picture::item
\readonly
The BrickLink item reference this picture is requested for.
*/
/*! \qmlproperty Color Picture::color
\readonly
The BrickLink color reference this picture is requested for.
*/
/*! \qmlproperty date Picture::lastUpdated
\readonly
Holds the time stamp of the last successful update of this picture.
*/
/*! \qmlproperty UpdateStatus Picture::updateStatus
\readonly
Returns the current update status. The available values are:
\value BrickLink::Ok The last picture load (or download) was successful.
\value BrickLink::Loading BrickStore is currently loading the picture from the local cache.
\value BrickLink::Updating BrickStore is currently downloading the picture from BrickLink.
\value BrickLink::UpdateFailed The last download from BrickLink failed. isValid might still be
\c true, if there was a valid picture available before the
failed update!
*/
/*! \qmlproperty bool Picture::isValid
\readonly
Returns whether the image property currently holds a valid image.
*/
/*! \qmlproperty image Picture::image
\readonly
Returns the image if the Picture object isValid, or a null image otherwise.
*/
/*! \qmlmethod Picture::update(bool highPriority = false)
Tries to re-download the picture from the BrickLink server. If you set \a highPriority to \c
true the load/download request will be pre-prended to the work queue instead of appended.
*/
QmlPicture::QmlPicture(BrickLink::Picture *pic)
: QmlWrapperBase(pic)
@@ -330,6 +735,90 @@ void QmlPicture::update(bool highPriority)
///////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
/*! \qmltype PriceGuide
\inqmlmodule BrickStore
\ingroup qml-api
\brief This value type represents the price guide for a BrickLink item.
Each price guide of an item in the BrickLink catalog is available as a PriceGuide object.
You cannot create PriceGuide objects yourself, but you can retrieve a PriceGuide object given the
item and color id via BrickLink::priceGuide().
\note PriceGuides aren't readily available, but need to be asynchronously loaded (or even
downloaded) at runtime. You need to connect to the signal BrickLink::priceGuideUpdated()
to know when the data has been loaded.
The following three enumerations are used to retrieve the price guide data from this object:
\b Time
\value BrickLink.PastSix The sales in the last six months.
\value BrickLink.Current The items currently for sale.
\b Condition
\value BrickLink.New Only items in new condition.
\value BrickLink.Used Only items in used condition.
\b Price
\value BrickLink.Lowest The lowest price.
\value BrickLink.Average The average price.
\value BrickLink.WAverage The weighted average price.
\value BrickLink.Highest The highest price.
*/
/*! \qmlproperty bool PriceGuide::isNull
\readonly
Returns whether this PriceGuide is \c null. Since this type is a value wrapper around a C++
object, we cannot use the normal JavaScript \c null notation.
*/
/*! \qmlproperty Item PriceGuide::item
\readonly
The BrickLink item reference this price guide is requested for.
*/
/*! \qmlproperty Color PriceGuide::color
\readonly
The BrickLink color reference this price guide is requested for.
*/
/*! \qmlproperty date PriceGuide::lastUpdated
\readonly
Holds the time stamp of the last successful update of this price guide.
*/
/*! \qmlproperty UpdateStatus PriceGuide::updateStatus
\readonly
Returns the current update status. The available values are:
\value BrickLink.Ok The last picture load (or download) was successful.
\value BrickLink.Loading BrickStore is currently loading the picture from the local cache.
\value BrickLink.Updating BrickStore is currently downloading the picture from BrickLink.
\value BrickLink.UpdateFailed The last download from BrickLink failed. isValid might still be
\c true, if there was a valid picture available before the failed
update!
*/
/*! \qmlproperty bool PriceGuide::isValid
\readonly
Returns whether this object currently holds valid price guide data.
*/
/*! \qmlmethod PriceGuide::update(bool highPriority = false)
Tries to re-download the price guide from the BrickLink server. If you set \a highPriority to \c
true the load/download request will be pre-prended to the work queue instead of appended.
*/
/*! \qmlmethod int PriceGuide::quantity(Time time, Condition condition)
Returns the number of items for sale (or item that have been sold) given the \a time frame and
\a condition. Returns \c 0 if no data is available.
See the PriceGuide type documentation for the possible values of the Time and
Condition enumerations.
*/
/*! \qmlmethod int PriceGuide::lots(Time time, Condition condition)
Returns the number of lots for sale (or lots that have been sold) given the \a time frame and
\a condition. Returns \c 0 if no data is available.
See the PriceGuide type documentation for the possible values of the Time and
Condition enumerations.
*/
/*! \qmlmethod real PriceGuide::price(Time time, Condition condition, Price price)
Returns the price of items for sale (or item that have been sold) given the \a time frame,
\a condition and \a price type. Returns \c 0 if no data is available.
See the PriceGuide type documentation for the possible values of the Time,
Condition and Price enumerations.
*/
QmlPriceGuide::QmlPriceGuide(BrickLink::PriceGuide *pg)
: QmlWrapperBase(pg)
@@ -392,6 +881,189 @@ double QmlPriceGuide::price(QmlBrickLink::Time time, QmlBrickLink::Condition con
///////////////////////////////////////////////////////////////////////
/*! \qmltype Lot
\inqmlmodule BrickStore
\ingroup qml-api
\brief This value type represent a lot in a document.
A Lot corresponds to a row in a BrickStore document.
*/
/*! \qmlproperty bool Lot::isNull
\readonly
Returns whether this Lot is \c null. Since this type is a value wrapper around a C++ object, we
cannot use the normal JavaScript \c null notation.
*/
/*! \qmlproperty Item Lot::item
The Item represented by this lot. Can be a BrickLink::noItem, if there's no item set.
*/
/*! \qmlproperty Color Lot::color
The Color selected for this lot. Can be BrickLink::noColor, if there's no color set.
*/
/*! \qmlproperty Category Lot::category
\readonly
The Category of the lot's item or BrickLink::noCategory, if the lot's item is not valid.
*/
/*! \qmlproperty ItemType Lot::itemType
\readonly
The ItemType of the lot's item or BrickLink::noItemType, if the lot's item is not valid.
*/
/*! \qmlproperty string Lot::itemId
\readonly
The id of the lot's item. The same as \c{item.id}, but you don't have to
check for isNull on \c item.
*/
/*! \qmlproperty string Lot::id
\readonly
Obsolete. Please use itemId instead.
*/
/*! \qmlproperty string Lot::itemName
\readonly
The name of the lot's item. The same as \c{item.name}, but you don't have to
check for isNull on \c item.
*/
/*! \qmlproperty string Lot::name
\readonly
Obsolete. Please use itemName instead.
*/
/*! \qmlproperty string Lot::colorName
\readonly
The color name of the lot's item. The same as \c{color.name}, but you don't have to check for
isNull on \c color.
*/
/*! \qmlproperty string Lot::categoryName
\readonly
The category name of the lot's item. The same as \c{item.category.name}, but you don't have to
check for isNull on \c item.
*/
/*! \qmlproperty string Lot::itemTypeName
\readonly
The item-type name of the lot's item. The same as \c{item.itemType.name}, but you don't have to
check for isNull on \c item.
*/
/*! \qmlproperty int Lot::itemYearReleased
\readonly
The year the lot's item was first released.
*/
/*! \qmlproperty Status Lot::status
Represents the status of this lot. The Status enumeration has these values:
\value BrickLink.Include The green checkmark in the UI.
\value BrickLink.Exclude The red stop sign in the UI.
\value BrickLink.Extra The blue plus sign in the UI.
*/
/*! \qmlproperty Condition Lot::condition
Describes the condition of this lot. The Condition enumeration has these values:
\value BrickLink.New The items in this lot are new.
\value BrickLink.Used The items in this lot are used.
*/
/*! \qmlproperty SubCondition Lot::subCondition
Describes the sub-condition of this lot, if it represents a set. The SubCondition enumeration
has these values:
\value BrickLink.None No sub-condition is set.
\value BrickLink.Complete The set is complete.
\value BrickLink.Incomplete The set is not complete.
\value BrickLink.Sealed The set is still sealed.
*/
/*! \qmlproperty string Lot::comments
The comment or description for this lot. This is the public text that a buyer can see.
*/
/*! \qmlproperty string Lot::remarks
The remark is the private text that only the seller can see.
*/
/*! \qmlproperty int Lot::quantity
The quantity of the item.
*/
/*! \qmlproperty int Lot::bulkQuantity
The bulk quantity. This lot can only be sold in multiple of this.
*/
/*! \qmlproperty int Lot::tier1Quantity
The tier-1 quantity: if a buyer buys this quantity or more, the price will be tier1Price
instead of price.
*/
/*! \qmlproperty int Lot::tier2Quantity
The tier-2 quantity: if a buyer buys this quantity or more, the price will be tier2Price
instead of tier1Price.
\note This value needs to be larger than tier1Quantity.
*/
/*! \qmlproperty int Lot::tier3Quantity
The tier-3 quantity: if a buyer buys this quantity or more, the price will be tier3Price
instead of tier2Price.
\note This value needs to be larger than tier2Quantity.
*/
/*! \qmlproperty real Lot::price
The unit price of the item.
*/
/*! \qmlproperty real Lot::tier1Price
The tier-3 price: this will be the price, if a buyer buys tier1Quantity or more parts.
\note This value needs to be smaller than price.
*/
/*! \qmlproperty real Lot::tier2Price
The tier-3 price: this will be the price, if a buyer buys tier2Quantity or more parts.
\note This value needs to be smaller than tier2Price.
*/
/*! \qmlproperty real Lot::tier3Price
The tier-3 price: this will be the price, if a buyer buys tier3Quantity or more parts.
\note This value needs to be smaller than tier2Price.
*/
/*! \qmlproperty int Lot::sale
The optional sale on this lots in percent. \c{[0 .. 100]}
*/
/*! \qmlproperty real Lot::total
\readonly
A convenience value, return price times quantity.
*/
/*! \qmlproperty uint Lot::lotId
The BrickLink lot-id, which uniquely identifies a lot for sale on BrickLink.
*/
/*! \qmlproperty bool Lot::retain
A boolean flag indicating whether the lot should be retained in the store's stockroom if the
last item has been sold.
*/
/*! \qmlproperty Stockroom Lot::stockroom
Describes if and in which stockroom this lot is located. The Stockroom enumeration has these
values:
\value BrickLink.None Not in a stockroom.
\value BrickLink.A In stockroom \c A.
\value BrickLink.B In stockroom \c B.
\value BrickLink.C In stockroom \c C.
*/
/*! \qmlproperty real Lot::totalWeight
The weight of the complete lot, i.e. quantity times the weight of a single item.
*/
/*! \qmlproperty string Lot::reserved
The name of the buyer this item is reserved for or an empty string.
*/
/*! \qmlproperty bool Lot::alternate
A boolean flag denoting this lot as an \e alternate in a set inventory.
\note This value does not get saved.
*/
/*! \qmlproperty uint Lot::alternateId
If this lot is an \e alternate in a set inventory, this property holds the \e{alternate id}.
\note This value does not get saved.
*/
/*! \qmlproperty bool Lot::counterPart
A boolean flag denoting this lot as a \e{counter part} in a set inventory.
\note This value does not get saved.
*/
/*! \qmlproperty bool Lot::incomplete
\readonly
Returns \c false if this lot has a valid item and color, or \c true otherwise.
*/
/*! \qmlproperty image Lot::image
\readonly
The item's image in the lot's color; can be \c null.
\note The image isn't readily available, but needs to be asynchronously loaded (or even
downloaded) at runtime. See the Picture type for more information.
*/
QmlLot::QmlLot(BrickLink::Lot *lot, DocumentModel *document)
: QmlWrapperBase(lot)
, document(document)
-3
View File
@@ -83,9 +83,6 @@ class QmlBrickLink : public QObject
Q_OBJECT
Q_PRIVATE_PROPERTY(d, QString cachePath READ dataPath CONSTANT)
Q_PRIVATE_PROPERTY(d, QSize standardPictureSize READ standardPictureSize CONSTANT)
Q_PRIVATE_PROPERTY(d, bool ldrawEnabled READ isLDrawEnabled CONSTANT)
Q_PRIVATE_PROPERTY(d, QString ldrawPath READ ldrawDataPath)
Q_PRIVATE_PROPERTY(d, bool online READ onlineStatus)
// const QImage noImage(const QSize &s) const;
// const QImage colorImage(const Color *col, int w, int h) const;
+90 -1
View File
@@ -28,11 +28,51 @@
#include "common/document.h"
#include "common/documentmodel.h"
#include "common/documentio.h"
#include "common/onlinestate.h"
#include "common/recentfiles.h"
#include "brickstore_wrapper.h"
#include "version.h"
/*! \qmltype BrickStore
\inherits QtObject
\inqmlmodule BrickStore
\ingroup qml-api
\brief This singleton represents global settings and state.
A kitchen sink type singleton for all global state, settings and utility functions.
*/
/*! \qmlsignal BrickStore::showSettings(string page)
\internal
*/
/*! \qmlproperty string BrickStore::defaultCurrencyCode
\readonly
The user's default ISO currency code (e.g. \c EUR).
*/
/*! \qmlproperty string BrickStore::versionNumber
\readonly
BrickStore's version as a string (e.g. \c "2021.10.2").
*/
/*! \qmlproperty string BrickStore::buildNumber
\readonly
BrickStore's build number as a string (e.g. \c "42").
*/
/*! \qmlproperty bool BrickStore::databaseValid
\readonly
Returns whether the current database is valid or not.
*/
/*! \qmlproperty date BrickStore::lastDatabaseUpdate
\readonly
This property holds the date and time of the last successful database update.
*/
/*! \qmlproperty string BrickStore::online
\readonly
The current online state of the application. This is mirroring the operating system's online
state.
*/
QmlBrickStore *QmlBrickStore::s_inst = nullptr;
void QmlBrickStore::registerTypes()
@@ -69,6 +109,9 @@ QmlBrickStore::QmlBrickStore()
connect(Application::inst(), &Application::showSettings,
this, &QmlBrickStore::showSettings);
connect(OnlineState::inst(), &OnlineState::onlineStateChanged,
this, &QmlBrickStore::onlineStateChanged);
connect(BrickLink::core(), &BrickLink::Core::databaseDateChanged,
this, &QmlBrickStore::lastDatabaseUpdateChanged);
connect(BrickLink::core(), &BrickLink::Core::databaseDateChanged,
@@ -122,9 +165,19 @@ QVariantMap QmlBrickStore::about() const
QString QmlBrickStore::defaultCurrencyCode() const
{
return Config::inst()->defaultCurrencyCode();
return Config::inst()->defaultCurrencyCode();
}
bool QmlBrickStore::onlineState() const
{
return OnlineState::inst()->isOnline();
}
/*! \qmlmethod string BrickStore::symbolForCurrencyCode(string currencyCode)
Returns the currency symbol for the ISO \a currencyCode if available or the \a currencyCode
itself otherwise. E.g. \c EUR will be mapped to \c €.
*/
QString QmlBrickStore::symbolForCurrencyCode(const QString &currencyCode) const
{
static QHash<QString, QString> cache;
@@ -144,27 +197,58 @@ QString QmlBrickStore::symbolForCurrencyCode(const QString &currencyCode) const
return s;
}
/*! \qmlmethod string BrickStore::toCurrencyString(real value, string symbol = "", int precision = 3)
Correctly formats the given currency \a value according to the user's locale and returns it as
a string. Also appends a currency \a symbol if provided.
The default number of decimal places is \c 3, but you can change this via the \a precision
parameter.
*/
QString QmlBrickStore::toCurrencyString(double value, const QString &symbol, int precision) const
{
return Currency::toString(value, symbol, precision);
}
/*! \qmlmethod string BrickStore::toWeightString(real value, bool showUnit = false)
Correctly formats the given weight \a value according to the user's locale and the
metric/imperial setting in BrickStore and returns it as a string. Also
appends the corresponding unit if \a showUnit is set to \c true.
*/
QString QmlBrickStore::toWeightString(double value, bool showUnit) const
{
return Utility::weightToString(value, Config::inst()->measurementSystem(), true, showUnit);
}
/*! \qmlmethod stringlist BrickStore::nameFiltersForBrickLinkXML(bool includeAll = false)
Returns a list of file extension that can be used when creating a FileDialog to open
BrickLink XML files. If \a includeAll is set, a match-everything filter \c * will be added to
this list.
*/
QStringList QmlBrickStore::nameFiltersForBrickLinkXML(bool includeAll) const
{
return DocumentIO::nameFiltersForBrickLinkXML(includeAll);
}
/*! \qmlmethod stringlist BrickStore::nameFiltersForBrickStoreXML(bool includeAll = false)
Returns a list of file extension that can be used when creating a FileDialog to open
BrickStore document files. If \a includeAll is set, a match-everything filter \c * will be
added to this list.
*/
QStringList QmlBrickStore::nameFiltersForBrickStoreXML(bool includeAll) const
{
return DocumentIO::nameFiltersForBrickStoreXML(includeAll);
}
/*! \qmlmethod stringlist BrickStore::nameFiltersForLDraw(bool includeAll = false)
Returns a list of file extension that can be used when creating a FileDialog to open
LDraw files. If \a includeAll is set, a match-everything filter \c * will be added to this
list.
*/
QStringList QmlBrickStore::nameFiltersForLDraw(bool includeAll) const
{
return DocumentIO::nameFiltersForLDraw(includeAll);
@@ -180,6 +264,11 @@ QDateTime QmlBrickStore::lastDatabaseUpdate() const
return BrickLink::core()->databaseDate();
}
/*! \qmlmethod bool BrickStore::updateDatabase()
Starts an asychronous database update in the background. Returns \c true if the update was
started and \c false if it failed (e.g. there were documents with unsaved changes).
*/
bool QmlBrickStore::updateDatabase()
{
return QCoro::waitFor(Application::inst()->updateDatabase());
+4 -2
View File
@@ -110,6 +110,7 @@ class QmlBrickStore : public QObject
Q_PROPERTY(QVariantMap about READ about CONSTANT)
Q_PROPERTY(bool databaseValid READ isDatabaseValid NOTIFY databaseValidChanged)
Q_PROPERTY(QDateTime lastDatabaseUpdate READ lastDatabaseUpdate NOTIFY lastDatabaseUpdateChanged)
Q_PROPERTY(bool online READ onlineState NOTIFY onlineStateChanged)
public:
static void registerTypes();
@@ -124,10 +125,10 @@ public:
QString buildNumber() const;
RecentFiles *recentFiles() const;
ColumnLayoutsModel *columnLayouts() const;
QVariantMap about() const;
QString defaultCurrencyCode() const;
bool onlineState() const;
Q_INVOKABLE QString symbolForCurrencyCode(const QString &currencyCode) const;
Q_INVOKABLE QString toCurrencyString(double value, const QString &symbol = { }, int precision = 3) const;
Q_INVOKABLE QString toWeightString(double value, bool showUnit = false) const;
@@ -145,6 +146,7 @@ signals:
void showSettings(const QString &page);
void databaseValidChanged(bool valid);
void lastDatabaseUpdateChanged(const QDateTime &lastUpdate);
void onlineStateChanged(bool online);
private: