feat: add try check

This commit is contained in:
rankun 2020-08-02 15:27:23 +08:00
commit ef4280f7ff
3 changed files with 21 additions and 0 deletions

View file

@ -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)

View file

@ -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();

View file

@ -45,6 +45,7 @@ private:
void moveCenter();
void installShortcut();
QRect getScreenRect();
bool checkTrialExpire();
protected:
void mousePressEvent(QMouseEvent *event);