Skip to content

Commit

Permalink
feat: add buildDtkVersion/runtimeDtkVersion to DApplication
Browse files Browse the repository at this point in the history
    buildDtkVersion: return the libdtkwidget version of build application
    runtimeDtkVersion: return the libdtkwidget version of runing application

Change-Id: I4d8053265a6bdd5fd7f78fc4a843cc491c1189f2
  • Loading branch information
zccrs authored and deepin-gerrit committed Feb 5, 2018
1 parent 5f48b1f commit 9aaa158
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/widgets/dapplication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,16 @@ bool DApplication::isDXcbPlatform()
return qApp && (qApp->platformName() == DXCB_PLUGIN_KEY || qApp->property(DXCB_PLUGIN_SYMBOLIC_PROPERTY).toBool());
}

int DApplication::buildDtkVersion()
{
return DtkBuildVersion::value;
}

int DApplication::runtimeDtkVersion()
{
return DTK_VERSION;
}

/**
* @brief DApplication::productName returns the product name of this application.
*
Expand Down Expand Up @@ -704,4 +714,6 @@ bool DApplication::notify(QObject *obj, QEvent *event)
return QApplication::notify(obj, event);
}

int DtkBuildVersion::value = 0;

DWIDGET_END_NAMESPACE
21 changes: 21 additions & 0 deletions src/widgets/dapplication.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@ class LIBDTKWIDGETSHARED_EXPORT DApplication : public QApplication, public DTK_C
static bool loadDXcbPlugin();
static bool isDXcbPlatform();

// return the libdtkwidget version of build application
static int buildDtkVersion();
// return the libdtkwidget version of runing application
static int runtimeDtkVersion();

// meta information that necessary to create a about dialog for the application.
QString productName() const;
void setProductName(const QString &productName);
Expand Down Expand Up @@ -132,6 +137,22 @@ class LIBDTKWIDGETSHARED_EXPORT DApplication : public QApplication, public DTK_C
friend class DMainWindowPrivate;
};

class DtkBuildVersion {
public:
static int value;
};

#ifndef LIBDTKWIDGET_LIBRARY
class Q_DECL_HIDDEN _DtkBuildVersion {
public:
_DtkBuildVersion() {
DtkBuildVersion::value = DTK_VERSION;
}
};

static _DtkBuildVersion _dtk_build_version;
#endif

DWIDGET_END_NAMESPACE

#endif // DAPPLICATION_H
4 changes: 4 additions & 0 deletions src/widgets/dtitlebar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,10 @@ DTitlebar::DTitlebar(QWidget *parent) :
QFrame(parent),
DObject(*new DTitlebarPrivate(this))
{
if (DApplication::buildDtkVersion() < DTK_VERSION_CHECK(2, 0, 6, 1)) {
setBackgroundTransparent(true);
}

DThemeManager::registerWidget(this, {"transparent"});

D_D(DTitlebar);
Expand Down

0 comments on commit 9aaa158

Please sign in to comment.