diff --git a/QtScrcpy/QtScrcpy.pro b/QtScrcpy/QtScrcpy.pro index c947acc..0afdc4e 100644 --- a/QtScrcpy/QtScrcpy.pro +++ b/QtScrcpy/QtScrcpy.pro @@ -48,6 +48,10 @@ HEADERS += \ FORMS += \ dialog.ui +# 试用检查 +# DEFINES += TRIAL_EXPIRE_CHECK +DEFINES += TRIAL_TIMES=10 + # 子工程 include ($$PWD/common/common.pri) include ($$PWD/adb/adb.pri) diff --git a/QtScrcpy/device/ui/videoform.cpp b/QtScrcpy/device/ui/videoform.cpp index 282bc16..36a6ef4 100644 --- a/QtScrcpy/device/ui/videoform.cpp +++ b/QtScrcpy/device/ui/videoform.cpp @@ -343,6 +343,16 @@ QRect VideoForm::getScreenRect() return screenRect; } +bool VideoForm::checkTrialExpire() +{ + static int trialTimes = 0; + if (++trialTimes > TRIAL_TIMES) { + QMessageBox::warning(this, "QtScrcpy", QStringLiteral("试用已结束,购买正式版本请联系作者"), QMessageBox::Ok); + return true; + } + return false; +} + void VideoForm::updateStyleSheet(bool vertical) { if (vertical) { @@ -500,6 +510,12 @@ void VideoForm::setDevice(Device *device) void VideoForm::mousePressEvent(QMouseEvent *event) { +#ifdef TRIAL_EXPIRE_CHECK + if (checkTrialExpire()) { + return; + } +#endif + if (event->button() == Qt::MiddleButton) { if (m_device && !m_device->isCurrentCustomKeymap()) { emit m_device->postGoHome(); diff --git a/QtScrcpy/device/ui/videoform.h b/QtScrcpy/device/ui/videoform.h index bda37a4..0b07c0c 100644 --- a/QtScrcpy/device/ui/videoform.h +++ b/QtScrcpy/device/ui/videoform.h @@ -45,6 +45,7 @@ private: void moveCenter(); void installShortcut(); QRect getScreenRect(); + bool checkTrialExpire(); protected: void mousePressEvent(QMouseEvent *event);