Locate resources at runtime using QDir::currentpath

This commit is contained in:
Achraf k 2022-02-17 17:54:26 +01:00
parent 5b1269dcfa
commit e04298e24e
27 changed files with 67 additions and 54 deletions

View File

@ -1,12 +1,10 @@
#include "appbar.h"
#include "appbar_p.h"
#include <QtWidgets/QGraphicsDropShadowEffect>
#include <QPainter>
#include "lib/style.h"
namespace md {
/*!
* \class QtMaterialAppBarPrivate
* \class AppBarPrivate
* \internal
*/

View File

@ -3,6 +3,8 @@
#include <QtGlobal>
#include <QColor>
#include <QtWidgets/QGraphicsDropShadowEffect>
#include <QPainter>
namespace md
{

View File

@ -1,13 +1,9 @@
#include "autocomplete_internal.h"
#include <QSignalTransition>
#include <QPropertyAnimation>
#include <QtWidgets/QGraphicsOpacityEffect>
#include <QDebug>
namespace md
{
/*!
* \class QtMaterialAutoCompleteStateMachine
* \class AutoCompleteStateMachine
* \internal
*/

View File

@ -1,7 +1,12 @@
#ifndef AUTOCOMPLETESTATEMACHINE_H
#define AUTOCOMPLETESTATEMACHINE_H
#include <QtWidgets/QGraphicsOpacityEffect>
#include <QStateMachine>
#include <QSignalTransition>
#include <QPropertyAnimation>
#include <QDebug>
#include "autocomplete.h"
namespace md

View File

@ -1,13 +1,11 @@
#include "avatar.h"
#include "avatar_p.h"
#include <QPainter>
#include <QPainterPath>
#include "lib/style.h"
namespace md
{
/*!
* \class QtMaterialAvatarPrivate
* \class AvatarPrivate
* \internal
*/

View File

@ -7,6 +7,9 @@
#include <QIcon>
#include <QPixmap>
#include <QColor>
#include <QPainter>
#include <QPainterPath>
#include "lib/theme.h"
namespace md

View File

@ -1,13 +1,12 @@
#include "badge.h"
#include "badge_p.h"
#include <QPainter>
#include "lib/style.h"
namespace md
{
/*!
* \class QtMaterialBadgePrivate
* \class BadgePrivate
* \internal
*/

View File

@ -5,6 +5,7 @@
#include <QSize>
#include <QIcon>
#include <QColor>
#include <QPainter>
namespace md
{

View File

@ -1,9 +1,5 @@
#include "circularprogress.h"
#include "circularprogress_p.h"
#include <QPropertyAnimation>
#include <QParallelAnimationGroup>
#include <QPainter>
#include <QPainterPath>
#include "circularprogress_internal.h"
#include "lib/style.h"
@ -11,7 +7,7 @@ namespace md
{
/*!
* \class QtMaterialCircularProgressPrivate
* \class CircularProgressPrivate
* \internal
*/

View File

@ -2,7 +2,13 @@
#define CIRCULARPROGRESS_P_H
#include <QtGlobal>
#include <QPropertyAnimation>
#include <QParallelAnimationGroup>
#include <QPainter>
#include <QPainterPath>
#include "lib/theme.h"
namespace md
{

View File

@ -82,7 +82,7 @@ void DialogProxy::paintEvent(QPaintEvent *event)
}
/*!
* \class QtMaterialDialogWindow
* \class DialogWindow
* \internal
*/

View File

@ -1,14 +1,10 @@
#include "drawer_internal.h"
#include <QState>
#include <QPainter>
#include <QtWidgets/QLayout>
#include <QSignalTransition>
#include <QPropertyAnimation>
#include "drawer.h"
namespace md
{
/*!
* \class QtMaterialDrawerStateMachine
* \class DrawerStateMachine
* \internal
*/

View File

@ -2,6 +2,12 @@
#define DRAWER_INTERNAL_H
#include <QStateMachine>
#include <QState>
#include <QPainter>
#include <QtWidgets/QLayout>
#include <QSignalTransition>
#include <QPropertyAnimation>
#include "lib/overlaywidget.h"
namespace md
@ -52,7 +58,6 @@ inline qreal DrawerStateMachine::opacity() const
class DrawerWidget : public OverlayWidget
{
Q_OBJECT
Q_PROPERTY(int offset WRITE setOffset READ offset)
public:

View File

@ -1,15 +1,12 @@
#include "fab.h"
#include "fab_p.h"
#include <QtWidgets/QGraphicsDropShadowEffect>
#include <QState>
#include <QEvent>
#include <QPainter>
#include "lib/rippleoverlay.h"
namespace md
{
/*!
* \class QtMaterialFloatingActionButtonPrivate
* \class FloatingActionButtonPrivate
* \internal
*/

View File

@ -1,7 +1,13 @@
#ifndef FAB_P_H
#define FAB_P_H
#include <QtWidgets/QGraphicsDropShadowEffect>
#include <QState>
#include <QEvent>
#include <QPainter>
#include "raisedbutton_p.h"
namespace md
{

View File

@ -8,7 +8,7 @@
namespace md
{
/*!
* \class QtMaterialCheckablePrivate
* \class CheckablePrivate
* \internal
*/
@ -26,8 +26,8 @@ void CheckablePrivate::init()
Q_Q(Checkable);
rippleOverlay = new RippleOverlay;
checkedIcon = new CheckableIcon(QIcon(":/icons/icons/toggle/svg/production/ic_check_box_24px.svg"), q);
uncheckedIcon = new CheckableIcon(QIcon(":/icons/icons/toggle/svg/production/ic_check_box_outline_blank_24px.svg"), q);
checkedIcon = new CheckableIcon(QIcon(QDir::currentPath()+"/../components/icons/toggle/svg/production/ic_check_box_24px.svg"), q);
uncheckedIcon = new CheckableIcon(QIcon(QDir::currentPath()+"/../components/icons/toggle/svg/production/ic_check_box_outline_blank_24px.svg"), q);
stateMachine = new QStateMachine(q);
uncheckedState = new QState;
checkedState = new QState;

View File

@ -9,6 +9,7 @@
#include <QEventTransition>
#include <QColor>
#include <QCoreApplication>
#include <QDir>
#include "lib/checkable.h"

View File

@ -4,7 +4,7 @@
namespace md
{
/*!
* \class QtMaterialOverlayWidget
* \class OverlayWidget
* \internal
*/

View File

@ -4,7 +4,7 @@
namespace md
{
/*!
* \class QtMaterialRipple
* \class Ripple
* \internal
*/

View File

@ -1,11 +1,10 @@
#include "lib/style.h"
#include <QFontDatabase>
#include "lib/theme.h"
namespace md
{
/*!
* \class QtMaterialStylePrivate
* \class StylePrivate
* \internal
*/
@ -22,15 +21,15 @@ void StylePrivate::init()
{
Q_Q(Style);
QFontDatabase::addApplicationFont(":/fonts/roboto_regular");
QFontDatabase::addApplicationFont(":/fonts/roboto_medium");
QFontDatabase::addApplicationFont(":/fonts/roboto_bold");
QFontDatabase::addApplicationFont(QDir::currentPath()+"/../fonts/roboto_regular");
QFontDatabase::addApplicationFont(QDir::currentPath()+"/../fonts/roboto_medium");
QFontDatabase::addApplicationFont(QDir::currentPath()+"/../fonts/roboto_bold");
q->setTheme(new Theme);
}
/*!
* \class QtMaterialStyle
* \class Style
* \internal
*/

View File

@ -2,6 +2,8 @@
#define STYLE_P_H
#include <QtGlobal>
#include <QFontDatabase>
#include <QDir>
namespace md
{

View File

@ -1,12 +1,10 @@
#include "lib/theme.h"
#include "lib/theme_p.h"
#include <QString>
#include <QStringBuilder>
#include <QDebug>
namespace md
{
/*!material
* \class QtMaterialThemePrivate
/*!
* \class ThemePrivate
* \internal
*/
@ -156,7 +154,7 @@ void Theme::setColor(const QString &key, Material::Color color)
QIcon Theme::icon(QString category, QString icon)
{
return QIcon(":/icons/icons/" % category % "/svg/production/ic_" % icon % "_24px.svg");
return QIcon(QDir::currentPath() % "/../components/icons/" % category % "/svg/production/ic_" % icon % "_24px.svg");
}
}

View File

@ -3,6 +3,10 @@
#include <QHash>
#include <QColor>
#include <QString>
#include <QStringBuilder>
#include <QDir>
#include <QDebug>
namespace md
{

View File

@ -70,7 +70,8 @@ void AvatarSettingsEditor::updateWidget()
m_avatar->setLetter(QChar('X'));
break;
case 1:
m_avatar->setImage(QImage(":/images/assets/sikh.jpg"));
qDebug()<<QDir::currentPath()+"/assets/sikh.jpg";
m_avatar->setImage(QImage(QDir::currentPath()+"/assets/sikh.jpg"));
break;
case 2:
m_avatar->setIcon(Theme::icon("communication", "message"));

View File

@ -2,8 +2,9 @@
#define AVATARSETTINGSEDITOR_H
#include <QWidget>
#include <QColorDialog>
#include <QDir>
#include <avatar.h>
#include <lib/theme.h>

View File

@ -1,12 +1,9 @@
#include "badgesettingseditor.h"
#include <QColorDialog>
#include <avatar.h>
#include <badge.h>
BadgeSettingsEditor::BadgeSettingsEditor(QWidget *parent)
: QWidget(parent),
ui(new Ui::BadgeSettingsForm),
m_avatar(new Avatar(QImage(":/images/assets/sikh.jpg"))),
m_avatar(new Avatar(QImage(QDir::currentPath()+"/assets/sikh.jpg"))),
m_badge(new Badge)
{
QVBoxLayout *layout = new QVBoxLayout;

View File

@ -2,6 +2,8 @@
#define BADGESETTINGSEDITOR_H
#include <QWidget>
#include <QColorDialog>
#include <QDir>
#include <avatar.h>
#include <badge.h>