This repository has been archived by the owner on Oct 11, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update template Log: : Change-Id: Ie35be380a971a511301b83967b774ebeac6ae797
- Loading branch information
Showing
15 changed files
with
322 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# 0.1 | ||
Init |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
PREFIX = /usr | ||
|
||
all: | ||
|
||
install: | ||
mkdir -p $(DESTDIR)$(PREFIX)/share/qtcreator/templates/wizards/projects | ||
cp -r dtkapplication $(DESTDIR)$(PREFIX)/share/qtcreator/templates/wizards/projects/ | ||
chmod 755 $(DESTDIR)$(PREFIX)/share/qtcreator/templates/wizards/projects/dtkapplication |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# QtCreator Template for DTK | ||
|
||
provide a simple DTK application template for your qtcreator. | ||
|
||
## Dependencies | ||
|
||
In debian, use below command to install compile dependencies: | ||
|
||
`sudo apt-get install qtcreator libdtkwidget-dev libdtkcore-dev` | ||
|
||
## Installation | ||
|
||
``` | ||
$ cd qtcreator-template-dtk | ||
$ sudo make install | ||
``` | ||
|
||
## Getting help | ||
|
||
Any usage issues can ask for help via | ||
|
||
* [Gitter](https://gitter.im/orgs/linuxdeepin/rooms) | ||
* [IRC channel](https://webchat.freenode.net/?channels=deepin) | ||
* [Forum](https://bbs.deepin.org) | ||
* [WiKi](http://wiki.deepin.org/) | ||
|
||
## Getting involved | ||
|
||
We encourage you to report issues and contribute changes | ||
|
||
* [Contribution guide for developers](https://github.com/linuxdeepin/developer-center/wiki/Contribution-Guidelines-for-Developers-en). (English) | ||
* [开发者代码贡献指南](https://github.com/linuxdeepin/developer-center/wiki/Contribution-Guidelines-for-Developers) (中文) | ||
|
||
## License | ||
|
||
qtcreator-template-dtk is licensed under [GPLv3](LICENSE). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
qtcreator-template-dtk (0.0.1-1) unstable; urgency=medium | ||
|
||
* Init | ||
|
||
-- Deepin Package Builder <[email protected]> Tue, 27 Nov 2018 10:03:28 +0000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
9 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
Source: qtcreator-template-dtk | ||
Section: misc | ||
Priority: optional | ||
Maintainer: Deepin Packages Builder <[email protected]> | ||
Build-Depends: debhelper (>= 9) | ||
Standards-Version: 3.9.8 | ||
|
||
Package: qtcreator-template-dtk | ||
Architecture: any | ||
Depends: ${misc:Depends}, | ||
${shlibs:Depends} | ||
Description: QtCreator template for dtk | ||
Support for creating a dtk gui project in qtcreator by default. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
Format: http://dep.debian.net/deps/dep5/ | ||
Upstream-Name: deepin-gtk-theme | ||
Upstream-Contact: Deepin Project <[email protected]> | ||
Source: http://www.linuxdeepin.com | ||
|
||
Files: * | ||
Copyright: 2015 Deepin Technology Co., Ltd. | ||
License: LGPL-3+ | ||
This is free software; you can redistribute it and/or modify it | ||
under the terms of the GNU Lesser General Public License as published by the | ||
Free Software Foundation; either version 3 of the License, or (at your | ||
option) any later version. | ||
. | ||
This library is distributed in the hope that it will be useful, but WITHOUT | ||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License | ||
for more details. | ||
. | ||
You should have received a copy of the GNU Lesser General Public | ||
License along with this library; if not, write to the | ||
Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | ||
02110-1301 USA. | ||
. | ||
See /usr/share/common-licenses/LGPL-3 on your debian system. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#! /usr/bin/make -f | ||
%: | ||
dh $@ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
3.0 (native) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
cmake_minimum_required(VERSION 3.7) | ||
|
||
project(%{ProjectName}) | ||
|
||
set(CMAKE_CXX_STANDARD 11) | ||
set(CMAKE_INCLUDE_CURRENT_DIR ON) | ||
set(CMAKE_AUTOMOC ON) | ||
set(CMAKE_AUTORCC ON) | ||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall") | ||
|
||
# Find the library | ||
find_package(PkgConfig REQUIRED) | ||
find_package(Qt5Widgets REQUIRED) | ||
find_package(DtkWidget REQUIRED) | ||
|
||
add_executable(${PROJECT_NAME} "%{CppFileName}" resources.qrc) | ||
|
||
target_include_directories(%{ProjectName} PUBLIC ${DtkWidget_INCLUDE_DIRS} ${OBJECT_BINARY_DIR}) | ||
target_link_libraries(%{ProjectName} | ||
${DtkWidget_LIBRARIES} | ||
${Qt5Widgets_LIBRARIES} | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
QT += core gui dtkwidget | ||
|
||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets | ||
|
||
TARGET = %{ProjectName} | ||
TEMPLATE = app | ||
|
||
SOURCES += \\ | ||
%{CppFileName} | ||
|
||
RESOURCES += \ | ||
resources.qrc |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
#include <DApplication> | ||
#include <DMainWindow> | ||
#include <DWidgetUtil> | ||
#include <DApplicationSettings> | ||
#include <DTitlebar> | ||
#include <DProgressBar> | ||
#include <DFontSizeManager> | ||
|
||
#include <QPropertyAnimation> | ||
#include <QDate> | ||
#include <QLayout> | ||
DWIDGET_USE_NAMESPACE | ||
|
||
int main(int argc, char *argv[]) | ||
{ | ||
QGuiApplication::setAttribute(Qt::AA_UseHighDpiPixmaps); | ||
DApplication a(argc, argv); | ||
a.setOrganizationName("deepin"); | ||
a.setApplicationName("dtk-application"); | ||
a.setApplicationVersion("1.0"); | ||
a.setProductIcon(QIcon(":/images/logo.svg")); | ||
a.setProductName("Dtk Application"); | ||
a.setApplicationDescription("This is a dtk template application."); | ||
|
||
a.loadTranslator(); | ||
a.setApplicationDisplayName(QCoreApplication::translate("Main", "DTK Application")); | ||
|
||
// 保存程序的窗口主题设置 | ||
DApplicationSettings as; | ||
Q_UNUSED(as) | ||
|
||
DMainWindow w; | ||
w.titlebar()->setIcon(QIcon(":/images/logo.svg")); | ||
w.titlebar()->setTitle("Hello dtk"); | ||
// 设置标题,宽度不够会隐藏标题文字 | ||
w.setMinimumSize(QSize(600, 200)); | ||
|
||
QWidget *cw = new QWidget(&w); | ||
QVBoxLayout *layout = new QVBoxLayout(cw); | ||
QDate today = QDate::currentDate(); | ||
DProgressBar *yearProgressBar = new DProgressBar(); | ||
yearProgressBar->setMaximum(today.daysInYear()); | ||
// 绑定字体大小 | ||
DFontSizeManager::instance()->bind(yearProgressBar, DFontSizeManager::T1); | ||
|
||
yearProgressBar->setAlignment(Qt::AlignCenter); | ||
QObject::connect(yearProgressBar, &DProgressBar::valueChanged, yearProgressBar, [yearProgressBar](int value){ | ||
yearProgressBar->setFormat(QString("您的 %1 使用进度: %2%").arg(QDate::currentDate().year()) | ||
.arg(value * 100 / yearProgressBar->maximum())); | ||
}); | ||
|
||
layout->addWidget(yearProgressBar); | ||
w.setCentralWidget(cw); | ||
w.show(); | ||
|
||
auto animation = new QPropertyAnimation(yearProgressBar, "value"); | ||
animation->setDuration(5000); | ||
animation->setStartValue(0); | ||
animation->setEndValue(today.dayOfYear()); | ||
animation->start(); | ||
|
||
Dtk::Widget::moveToCenter(&w); | ||
|
||
return a.exec(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<RCC> | ||
<qresource prefix="/"> | ||
<file>images/logo.svg</file> | ||
</qresource> | ||
</RCC> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
{ | ||
"version": 1, | ||
"supportedProjectTypes": [ "CMakeProjectManager.CMakeProject", "Qt4ProjectManager.Qt4Project" ], | ||
"id": "Deepin DTK Application", | ||
"category": "F.Application", | ||
"trDescription": "Create a simple DTK template.", | ||
"trDisplayName": "Dtk Widgets Application", | ||
"trDisplayCategory": "Application", | ||
"icon": "../../global/guiapplication.png", | ||
"enabled": "%{JS: [ %{Plugins} ].indexOf('CppEditor') >= 0 && ([ %{Plugins} ].indexOf('QmakeProjectManager') >= 0 || [ %{Plugins} ].indexOf('QbsProjectManager') >= 0 || [ %{Plugins} ].indexOf('CMakeProjectManager') >= 0)}", | ||
|
||
"options": | ||
[ | ||
{ "key": "ProjectFile", "value": "%{JS: '%{BuildSystem}' === 'qmake' ? '%{ProFile}' : '%{CMakeFile}'}"}, | ||
{ "key": "ProFile", "value": "%{JS: Util.fileName('%{ProjectDirectory}/%{ProjectName}', 'pro')}" }, | ||
{ "key": "QbsFile", "value": "%{JS: Util.fileName('%{ProjectDirectory}/%{ProjectName}', 'qbs')}" }, | ||
{ "key": "CMakeFile", "value": "%{ProjectDirectory}/CMakeLists.txt" }, | ||
{ "key": "CppFileName", "value": "%{JS: 'main.' + Util.preferredSuffix('text/x-c++src')}" } | ||
], | ||
|
||
"pages": | ||
[ | ||
{ | ||
"trDisplayName": "Project Location", | ||
"trShortTitle": "Location", | ||
"typeId": "Project" | ||
}, | ||
{ | ||
"trDisplayName": "Define Build System", | ||
"trShortTitle": "Build System", | ||
"typeId": "Fields", | ||
"enabled": "%{JS: ! %{IsSubproject}}", | ||
"data": | ||
[ | ||
{ | ||
"name": "BuildSystem", | ||
"trDisplayName": "Build system:", | ||
"type": "ComboBox", | ||
"data": | ||
{ | ||
"index": 0, | ||
"items": | ||
[ | ||
{ | ||
"trKey": "qmake", | ||
"value": "qmake", | ||
"condition": "%{JS: [ %{Plugins} ].indexOf('QmakeProjectManager') >= 0}" | ||
}, | ||
{ | ||
"trKey": "CMake", | ||
"value": "cmake", | ||
"condition": "%{JS: [ %{Plugins} ].indexOf('CMakeProjectManager') >= 0}" | ||
} | ||
] | ||
} | ||
} | ||
] | ||
}, | ||
{ | ||
"trDisplayName": "Kit Selection", | ||
"trShortTitle": "Kits", | ||
"typeId": "Kits", | ||
"enabled": "%{JS: ! %{IsSubproject}}", | ||
"data": { "projectFilePath": "%{ProjectFile}" } | ||
}, | ||
{ | ||
"trDisplayName": "Project Management", | ||
"trShortTitle": "Summary", | ||
"typeId": "Summary" | ||
} | ||
], | ||
"generators": | ||
[ | ||
{ | ||
"typeId": "File", | ||
"data": | ||
[ | ||
{ | ||
"source": "file.pro", | ||
"target": "%{ProFile}", | ||
"openAsProject": true, | ||
"condition": "%{JS: '%{BuildSystem}' === 'qmake'}" | ||
}, | ||
{ | ||
"source": "CMakeLists.txt", | ||
"openAsProject": true, | ||
"condition": "%{JS: '%{BuildSystem}' === 'cmake'}" | ||
}, | ||
{ | ||
"source": "resources.qrc" | ||
}, | ||
{ | ||
"source": "images/logo.svg" | ||
}, | ||
{ | ||
"source": "main.cpp", | ||
"target": "%{CppFileName}", | ||
"openInEditor": true | ||
}, | ||
{ | ||
"source": "../git.ignore", | ||
"target": ".gitignore", | ||
"condition": "%{JS: ! %{IsSubproject} && '%{VersionControl}' === 'G.Git'}" | ||
} | ||
] | ||
} | ||
] | ||
} |