Skip to content

Commit

Permalink
Fix debian/rules bug in aarch64
Browse files Browse the repository at this point in the history
  • Loading branch information
KangLin committed Jun 20, 2024
1 parent ec3b9fc commit 190284b
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 11 deletions.
2 changes: 1 addition & 1 deletion 3th_libs/LunarCalendar
12 changes: 7 additions & 5 deletions Src/FrmFullScreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,15 @@ int CFrmFullScreen::Prompt(const QString szPrompt, int nValue, int nMin, int nMa

int CFrmFullScreen::SetBackgroupImage(const QString szImage)
{
m_bpBackgroup.load(szImage);
QImage img(szImage);
return SetBackgroupImage(img);
}

int CFrmFullScreen::SetBackgroupImage(const QImage img)
{
setStyleSheet("");
QPalette palette;
palette.setBrush(QPalette::Window, QBrush(m_bpBackgroup.scaled(this->geometry().size())));
palette.setBrush(QPalette::Window, QBrush(img.scaled(this->geometry().size())));
setPalette(palette);

setStyleSheet("");

return 0;
}
1 change: 1 addition & 0 deletions Src/FrmFullScreen.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class CFrmFullScreen : public QWidget

int Prompt(const QString szPrompt, int nValue = 0, int nMin = 0, int nMax = 100, bool bInverted = false);
int SetBackgroupImage(const QString szImage);
int SetBackgroupImage(const QImage img);

protected:
virtual void paintEvent(QPaintEvent *event);
Expand Down
18 changes: 18 additions & 0 deletions Src/ObjectFactory.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,14 @@ class CObjectFactory
if(b)
value = QIcon(p);
}
if("backgroundImage" == szName && value.isValid())
{
QImage img;
QByteArray ba = QByteArray::fromBase64(value.toByteArray());
bool b = img.loadFromData(ba);
if(b)
value = img;
}
if(value.isValid())
pThis->setProperty(szName.toStdString().c_str(), value);
/*int nIndex = pObj->indexOfProperty(szName.toStdString().c_str());
Expand Down Expand Up @@ -117,6 +125,16 @@ class CObjectFactory
if(!ba.isEmpty())
value = ba.toBase64();
}
if("backgroundImage" == szName && !value.isNull())
{
QImage img = value.value<QImage>();
QByteArray ba;
QBuffer buf(&ba);
if(buf.open(QIODevice::WriteOnly))
img.save(&buf, "PNG");
if(!ba.isEmpty())
value = ba.toBase64();
}
//qDebug() << "property name: " << szName << " value: " << value.toString();
if(value.isValid())
{
Expand Down
12 changes: 12 additions & 0 deletions Src/Task.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,18 @@ QString CTask::szRemaining()
return tm.toString("HH:mm:ss");
}

QImage CTask::GetBackground() const
{
return m_imgBackground;
}

void CTask::SetBackground(const QImage &newImgBackground)
{
if (m_imgBackground == newImgBackground)
return;
m_imgBackground = newImgBackground;
}

int CTask::GetPromptInterval() const
{
return m_nPromptInterval;
Expand Down
12 changes: 8 additions & 4 deletions Src/Task.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class CTask : public QObject
Q_PROPERTY(bool end READ End)
Q_PROPERTY(QString description READ GetDescription)
Q_PROPERTY(QIcon icon READ GetIcon WRITE SetIcon)
Q_PROPERTY(QImage backgroundImage READ GetBackground WRITE SetBackground)
Q_PROPERTY(QString startSound READ GetStartSound WRITE SetStartSound)
Q_PROPERTY(QString runSound READ GetRunSound WRITE SetRunSound)

Expand All @@ -48,6 +49,8 @@ class CTask : public QObject
Q_INVOKABLE virtual QString GetContent() const;
Q_INVOKABLE virtual int SetIcon(QIcon icon);
Q_INVOKABLE QIcon GetIcon();
Q_INVOKABLE QImage GetBackground() const;
Q_INVOKABLE void SetBackground(const QImage &newImgBackground);
Q_INVOKABLE virtual int GetInterval() const;
Q_INVOKABLE virtual int SetInterval(int nInterval);
Q_INVOKABLE virtual int GetPromptInterval() const;
Expand All @@ -58,7 +61,7 @@ class CTask : public QObject
Q_INVOKABLE virtual QString GetRunSound();
Q_INVOKABLE virtual int SetSound(const QString &szStartSound = QString(),
const QString &szRunSound = QString());

Q_INVOKABLE virtual int LoadSettings(const QDomElement &e);
Q_INVOKABLE virtual int SaveSettings(QDomElement &e);

Expand All @@ -80,6 +83,7 @@ class CTask : public QObject
virtual bool End();

int Elapsed();

protected Q_SLOTS:
virtual void slotPrompt();

Expand All @@ -94,7 +98,6 @@ protected Q_SLOTS:
protected:
int Remaining();
QString szRemaining();

//QTimer m_PromptTimer;
QTime m_PromptTime;
int m_nPromptInterval;
Expand All @@ -105,11 +108,12 @@ protected Q_SLOTS:
QString m_szTitle;
QString m_szContent;
QIcon m_Icon;

QImage m_imgBackground;

QElapsedTimer m_Time;
int m_nInterval;

int Init();
int Init();
};

Q_DECLARE_METATYPE(CTask)
Expand Down
3 changes: 2 additions & 1 deletion debian/rules
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ override_dh_auto_configure:
-DCMAKE_BUILD_TYPE=Release

override_dh_auto_build:
cmake --build $(BUILD_DIR) --config Release --parallel $(if "`cat /proc/cpuinfo |grep 'cpu cores' |wc -l`", `cat /proc/cpuinfo |grep 'cpu cores' |wc -l`, 1)
cmake --build $(BUILD_DIR) --config Release \
--parallel $(if "`cat /proc/cpuinfo |grep 'processor' |wc -l`", `cat /proc/cpuinfo |grep 'processor' |wc -l`, 1)

override_dh_auto_install:
cmake --install $(BUILD_DIR) --config Release \
Expand Down

0 comments on commit 190284b

Please sign in to comment.