Skip to content

Commit

Permalink
add aboutlabel
Browse files Browse the repository at this point in the history
  • Loading branch information
dragondjf committed Aug 5, 2014
1 parent 6e9197e commit 6a1351e
Show file tree
Hide file tree
Showing 8 changed files with 66 additions and 1 deletion.
4 changes: 4 additions & 0 deletions QCFramer.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -1899,11 +1899,15 @@
<file>skin/images/splash.jpg</file>
<file>skin/images/splash.png</file>
<file>skin/images/bg.png</file>
<file>skin/images/bear.jpg</file>
</qresource>
<qresource prefix="/qss">
<file>skin/qss/BB.qss</file>
<file>skin/qss/BW.qss</file>
<file>skin/qss/GB.qss</file>
<file>skin/qss/GG.qss</file>
</qresource>
<qresource prefix="/about">
<file>skin/html/about.html</file>
</qresource>
</RCC>
25 changes: 25 additions & 0 deletions functionpages/uielement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include "ftablewidget.h"
#include "QFramer/ftabwidget.h"
#include "QFramer/fnofocusdelegate.h"
#include "QFramer/futil.h"
#include <QGridLayout>
#include <QGroupBox>
#include<QLabel>
Expand All @@ -53,6 +54,7 @@ void UIElement::initUI()
initTableWidget();
initTreeWidget();
initProgressBar();
initAboutLabel();
for(int i = 1; i< 8; ++i)
{
QLabel* label = new QLabel(QString::number(i));
Expand Down Expand Up @@ -262,3 +264,26 @@ void UIElement::updateProgressBar()
}
}
}

void UIElement::initAboutLabel()
{
QLabel* label = new QLabel();
label->setObjectName("aboutLabel");
label->setStyleSheet("\
QLabel#aboutLabel{\
border-image: url(:/images/skin/images/bear.jpg);\
}"\
);
label->setAlignment(Qt::AlignBottom | Qt::AlignRight);

QLabel* labelText = new QLabel(label);
QString text;
text = readFile(":/about/skin/html/about.html");
labelText->setText(text);

QHBoxLayout* layout = new QHBoxLayout();
layout->addStretch();
layout->addWidget(labelText);
label->setLayout(layout);
addWidget(tr("AboutLabel"), QString(""), label);
}
1 change: 1 addition & 0 deletions functionpages/uielement.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ class UIElement : public FTabWidget
void initTableWidget();
void initTreeWidget();
void initProgressBar();
void initAboutLabel();
signals:

public slots:
Expand Down
1 change: 0 additions & 1 deletion main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ int main(int argc, char *argv[])
QApplication::setApplicationName("QFramer");

MainWindow *main = MainWindow::getInstance();
setSkinForApp(QString(":/qss/skin/qss/GB.qss"));
main->setAttribute(Qt::WA_DeleteOnClose);
main->show();
return app.exec();
Expand Down
14 changes: 14 additions & 0 deletions mainwindow/thememenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ ThemeMenu::ThemeMenu(QWidget *parent) :
initData();
initUI();
initConnect();
actionMaps[tr("GB")]->trigger();
}

void ThemeMenu::initData()
Expand All @@ -47,6 +48,7 @@ void ThemeMenu::initUI()
for(int i=0; i< actionNames.length() ; ++i)
{
actions.append(new QAction(actionNames.at(i), this));
actions.at(i)->setCheckable(true);
actionMaps[actionNames.at(i)] = actions.at(i);
}
addActions(actions);
Expand All @@ -59,6 +61,7 @@ void ThemeMenu::initConnect()
connect(actionMaps[tr("GB")], SIGNAL(triggered()), this, SLOT(changeTheme3()));
connect(actionMaps[tr("GG")], SIGNAL(triggered()), this, SLOT(changeTheme4()));
connect(actionMaps[tr("Custom theme")], SIGNAL(triggered()), this, SLOT(changeThemeFromFile()));
connect(this, SIGNAL(triggered(QAction*)), this, SLOT(updateCheckedAction(QAction*)));
}

void ThemeMenu::changeTheme1()
Expand Down Expand Up @@ -90,3 +93,14 @@ void ThemeMenu::changeThemeFromFile()
setSkinForApp(fileName);
}
}

void ThemeMenu::updateCheckedAction(QAction *action)
{
foreach (QAction* actionItem, actions) {
if(actionItem == action){
action->setChecked(true);
}else {
actionItem->setChecked(false);
}
}
}
1 change: 1 addition & 0 deletions mainwindow/thememenu.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ public slots:
void changeTheme3();
void changeTheme4();
void changeThemeFromFile();
void updateCheckedAction(QAction* action);
};

#endif // THEMEMENU_H
21 changes: 21 additions & 0 deletions skin/html/about.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<html>
<header>
<style type="text/css">
body {
color: rgb(33, 50, 70);
}

</style>
</header>
<body>
<div id="QFramaer">
<h1>QFramer</h1>
<h2><span style="padding: 50px;">Faster Easier Stronger Prettier</span></h2>
<h2><span>Lincence: LGPL v2</span></h2>
<h2><span>Author: dragondjf</span></h2>
<h2><span>Version: 0.2.3.0</span></h2>
<h2><span>Copyright 2012-2014 DJF. All rights reserved</span></h2>
</div>
</div>
</body>
</html>
Binary file added skin/images/bear.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 6a1351e

Please sign in to comment.