Skip to content

Commit

Permalink
add template qss and add qssbuilder.py and deploy.py
Browse files Browse the repository at this point in the history
  • Loading branch information
dingjiangfeng committed Jul 28, 2014
1 parent 0e6621c commit 4706857
Show file tree
Hide file tree
Showing 48 changed files with 1,790 additions and 72 deletions.
18 changes: 1 addition & 17 deletions QCFramer.pro
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@ SOURCES += \
dialogs/aboutdialog.cpp \
dialogs/bgskinpopup.cpp \
dialogs/settingdialog.cpp \
functionpages/audiorecord/qaudiolevel.cpp \
functionpages/audiorecord/wavrecordmanager.cpp \
functionpages/audiorecord/wavrecordwidget.cpp \
functionpages/audiorecord/wavutil.cpp \
functionpages/aboutpage.cpp \
functionpages/ftablewidget.cpp \
functionpages/gradientshow.cpp \
Expand Down Expand Up @@ -57,10 +53,6 @@ HEADERS += \
dialogs/aboutdialog.h \
dialogs/bgskinpopup.h \
dialogs/settingdialog.h \
functionpages/audiorecord/qaudiolevel.h \
functionpages/audiorecord/wavrecordmanager.h \
functionpages/audiorecord/wavrecordwidget.h \
functionpages/audiorecord/wavutil.h \
functionpages/aboutpage.h \
functionpages/ftablewidget.h \
functionpages/gradientshow.h \
Expand Down Expand Up @@ -91,17 +83,9 @@ HEADERS += \
QFramer/ftabwidget.h \
QFramer/ftitlebar.h \
QFramer/futil.h \
QFramer/fwigglywidget.h \
iflytek/include/msp_cmn.h \
iflytek/include/msp_errors.h \
iflytek/include/msp_types.h \
iflytek/include/qisr.h \
iflytek/include/qtts.h
QFramer/fwigglywidget.h

RESOURCES += \
QCFramer.qrc


LIBS+= -L "$$PWD/iflytek/lib" -lmsc

RC_ICONS = "skin/images/QFramer.ico"
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,5 @@ With user interactive experience(UE) become more and more important in modern s
####5.Contact
+ `Email:` ding465398889@163.com or dragondjf@gmail.com or 465398889@qq.com
+ `Github:` https://github.com/dragondjf/QCFramer

> If this framework id helpful to you , please add a star
6 changes: 3 additions & 3 deletions build.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
mingw32-make.exe clean
qmake.exe QFramer.pro -r -spec win32-g++
mingw32-make.exe
C:\\Qt\\Qt5.3.1\\Tools\\mingw482_32\\bin\\mingw32-make.exe clean
C:\\Qt\\Qt5.3.1\\5.3\\mingw482_32\\bin\\qmake.exe QCFramer.pro -r -spec win32-g++
C:\\Qt\\Qt5.3.1\\Tools\\mingw482_32\\bin\\mingw32-make.exe
46 changes: 46 additions & 0 deletions deploy.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# -*- coding: utf-8 -*-
import os
import sys
import copy
import shutil
import subprocess
try:
import xml.etree.cElementTree as ET
except ImportError:
import xml.etree.ElementTree as ET

distWinPath = os.sep.join([os.getcwd(), 'distwin'])

def delete_file_folder(src):
'''delete files and folders'''
if os.path.isfile(src):
try:
os.remove(src)
except:
pass
elif os.path.isdir(src):
for item in os.listdir(src):
itemsrc = os.path.join(src, item)
delete_file_folder(itemsrc)
try:
os.rmdir(src)
except Exception, e:
print e

if __name__ == '__main__':
buildPaths = []
tree = ET.parse('QCFramer.pro.user')
root = tree.getroot()
for child in root:
for cchild in child:
for ccchild in cchild:
for cccchild in ccchild:
if cccchild.attrib['key'] == "ProjectExplorer.BuildConfiguration.BuildDirectory":
buildPaths.append(cccchild.text)
delete_file_folder(distWinPath)
for item in ['distwin']:
os.mkdir(os.sep.join([os.getcwd(), item]))
exePath = os.sep.join([buildPaths[1], 'release', 'QCFramer.exe'])
shutil.copyfile(exePath, os.sep.join([distWinPath, 'QCFramer.exe']))
os.chdir(distWinPath)
subprocess.call(["windeployqt.exe", "QCFramer.exe"])
Binary file added distwin/Qt5Core.dll
Binary file not shown.
Binary file added distwin/Qt5Gui.dll
Binary file not shown.
Binary file added distwin/Qt5PrintSupport.dll
Binary file not shown.
Binary file added distwin/Qt5Svg.dll
Binary file not shown.
Binary file added distwin/Qt5Widgets.dll
Binary file not shown.
Binary file added distwin/accessible/qtaccessiblewidgets.dll
Binary file not shown.
Binary file added distwin/iconengines/qsvgicon.dll
Binary file not shown.
Binary file added distwin/icudt52.dll
Binary file not shown.
Binary file added distwin/icuin52.dll
Binary file not shown.
Binary file added distwin/icuuc52.dll
Binary file not shown.
Binary file added distwin/imageformats/qdds.dll
Binary file not shown.
Binary file added distwin/imageformats/qgif.dll
Binary file not shown.
Binary file added distwin/imageformats/qicns.dll
Binary file not shown.
Binary file added distwin/imageformats/qico.dll
Binary file not shown.
Binary file added distwin/imageformats/qjp2.dll
Binary file not shown.
Binary file added distwin/imageformats/qjpeg.dll
Binary file not shown.
Binary file added distwin/imageformats/qmng.dll
Binary file not shown.
Binary file added distwin/imageformats/qsvg.dll
Binary file not shown.
Binary file added distwin/imageformats/qtga.dll
Binary file not shown.
Binary file added distwin/imageformats/qtiff.dll
Binary file not shown.
Binary file added distwin/imageformats/qwbmp.dll
Binary file not shown.
Binary file added distwin/imageformats/qwebp.dll
Binary file not shown.
Binary file added distwin/platforms/qwindows.dll
Binary file not shown.
Binary file added distwin/printsupport/windowsprintersupport.dll
Binary file not shown.
Binary file added distwin/qt_cs.qm
Binary file not shown.
Binary file added distwin/qt_de.qm
Binary file not shown.
Binary file added distwin/qt_fi.qm
Binary file not shown.
Binary file added distwin/qt_hu.qm
Binary file not shown.
Binary file added distwin/qt_it.qm
Binary file not shown.
Binary file added distwin/qt_ja.qm
Binary file not shown.
Binary file added distwin/qt_ru.qm
Binary file not shown.
Binary file added distwin/qt_sk.qm
Binary file not shown.
Binary file added distwin/qt_uk.qm
Binary file not shown.
2 changes: 0 additions & 2 deletions mainwindow/centerwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,10 @@ void CenterWindow::initUI()
{
uiElements = new UIElement;
mathPlot = new MathPlot;
recordManger = new WavRecordManager;
aboutPage = new AboutPage;

addWidget(tr("Home"), tr("Home"), uiElements);
addWidget(tr("MathPlot"),tr("MathPlot"), mathPlot);
addWidget(tr("Voice"), tr("Voice"), recordManger);
addWidget(tr("About"),tr("About"), aboutPage);
addWiggleWiget();
setAlignment(TopCenter);
Expand Down
2 changes: 0 additions & 2 deletions mainwindow/centerwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#include "functionpages/aboutpage.h"
#include "functionpages/mathplot.h"
#include"functionpages/uielement.h"
#include"functionpages/audiorecord/wavrecordmanager.h"
#include<QVBoxLayout>

class CenterWindow : public FCenterWindow
Expand All @@ -15,7 +14,6 @@ class CenterWindow : public FCenterWindow
public:
UIElement* uiElements;
MathPlot* mathPlot;
WavRecordManager* recordManger;
AboutPage* aboutPage;

static CenterWindow* instance;
Expand Down
15 changes: 14 additions & 1 deletion mainwindow/thememenu.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#include "thememenu.h"
#include "QFramer/futil.h"
#include<QApplication>
#include<QFileDialog>
#include<QDir>
ThemeMenu::ThemeMenu(QWidget *parent) :
QMenu(parent)
{
Expand All @@ -11,7 +13,7 @@ ThemeMenu::ThemeMenu(QWidget *parent) :

void ThemeMenu::initData()
{
actionNames<< tr("BW")<<tr("BB");
actionNames<< tr("BW")<<tr("BB") << tr("Custom Skin");
}

void ThemeMenu::initUI()
Expand All @@ -28,6 +30,7 @@ void ThemeMenu::initConnect()
{
connect(actionMaps[tr("BW")], SIGNAL(triggered()), this, SLOT(changeTheme1()));
connect(actionMaps[tr("BB")], SIGNAL(triggered()), this, SLOT(changeTheme2()));
connect(actionMaps[tr("Custom Skin")], SIGNAL(triggered()), this, SLOT(changeThemeFromFile()));
}

void ThemeMenu::changeTheme1()
Expand All @@ -39,3 +42,13 @@ void ThemeMenu::changeTheme2()
{
setSkinForApp(QString(":/qss/skin/qss/fblue.qss"));
}

void ThemeMenu::changeThemeFromFile()
{
QString fileName;
fileName = QFileDialog::getOpenFileName(this,
tr("Laod qss"), QDir::currentPath(), tr("Qss Files (*.qss)"));
if (fileName != ""){
setSkinForApp(fileName);
}
}
1 change: 1 addition & 0 deletions mainwindow/thememenu.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class ThemeMenu : public QMenu
public slots:
void changeTheme1();
void changeTheme2();
void changeThemeFromFile();
};

#endif // THEMEMENU_H
33 changes: 33 additions & 0 deletions qssbuilder.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# -*- coding: utf-8 -*-
import os
import sys
import copy

qssFolder = os.sep.join([os.getcwd(), 'skin', 'qss'])
qssTemplatePath = os.sep.join([qssFolder, 'template.qss'])


theme = {
'main_gradient_color': "green",
'main_background_color': "gray",
'main_hover_color': "red",
'main_select_color': "white",
'combox_background_color': "black"
}


if __name__ == '__main__':
if len(sys.argv) >= 2:
newQssFileName = sys.argv[1]
else:
newQssFileName = "test.qss"

qssOutFileName = os.sep.join([qssFolder, newQssFileName])

with open(qssTemplatePath) as f:
qssContent = f.read()
for key, value in theme.items():
qssContent = qssContent.replace(key, value)

with open(qssOutFileName, 'w') as f:
f.write(qssContent)
Binary file added skin/images/appbar.black_down.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added skin/images/appbar.black_right.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
47 changes: 23 additions & 24 deletions skin/qss/fblue.qss
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ QMenu::icon:checked { /* appearance of a 'checked' icon */

QMenu::item:disabled
{
background: rgb(125, 125, 125);
background-color: gray;
border: 1px inset gray;
position: absolute;
top: 1px;
Expand Down Expand Up @@ -416,57 +416,63 @@ QGroupBox::title {
}
/* ******************QGroupBox****************** */


/* ******************FTitleBar****************** */

QFrame#FTitleBar{
background-color: rgb(40, 47, 63);
}

QToolButton#titleToolButton{
/* ******************QToolButton**************** */
QToolButton{
background-color: transparent;
color: rgb(92, 113, 134);
}


QToolButton#titleToolButton:hover{
QToolButton:hover{
background-color: rgb(69, 187, 217);
color: white;
border: 1px;
}

QToolButton#titleToolButton:disabled{
QToolButton:disabled{
background-color: gray;
border: 1px;
}

QToolButton#titleToolButton[popupMode="1"] { /* only for MenuButtonPopup */
QToolButton[popupMode="1"] { /* only for MenuButtonPopup */
padding-right: 0px; /* make way for the popup button */
}

QToolButton#titleToolButton::menu-button {
QToolButton::menu-button {
border: none;
}

QToolButton#titleToolButton::menu-arrow {
QToolButton::menu-arrow {
image: none;
}

QToolButton#titleToolButton::menu-indicator {
QToolButton::menu-indicator {
image: none;
}

QToolButton#titleToolButton:open { /* when the button has its menu open */
QToolButton:open { /* when the button has its menu open */
background-color: rgb(63, 147, 168);
}
/* ******************QToolButton**************** */

/* ******************FTitleBar****************** */

QFrame#FTitleBar{
background-color: rgb(40, 47, 63);
}

QFrame QLabel#FTitleLabel{
color: white;
/*font-family: 'Verdana';*/
font-size: 12px;
padding-left: 5px;
}

QToolButton#close{
background-color: transparent;
color: white;
}


QToolButton#close:hover{
background-color: red;
border: 1px;
Expand All @@ -481,13 +487,6 @@ QWidget#FTabTile{
background-color: rgb(40, 47, 63);
}

QFrame QLabel#FTitleLabel{
color: white;
/*font-family: 'Verdana';*/
font-size: 12px;
padding-left: 5px;
}

QFrame#FNavgationBar_bottom{
background-color: rgb(40, 47, 63);
border-bottom: 1px solid black;
Expand Down
Loading

0 comments on commit 4706857

Please sign in to comment.