mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-26 15:28:28 -05:00
Moved set of banner pixmap and title format of ConnectFriendWizard to standard stylesheet.
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@8381 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
20c3777d78
commit
b88f4058a8
@ -73,12 +73,8 @@ ConnectFriendWizard::ConnectFriendWizard(QWidget *parent) :
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
/* add stylesheet to title */
|
||||
QList<int> ids = pageIds();
|
||||
for (QList<int>::iterator it = ids.begin(); it != ids.end(); ++it) {
|
||||
QWizardPage *p = page(*it);
|
||||
p->setTitle(QString("<span style=\"font-size:16pt; font-weight:500; color:white;\">%1</span>").arg(p->title()));
|
||||
}
|
||||
mTitleFontSize = 0; // Standard
|
||||
mTitleFontWeight = 0; // Standard
|
||||
|
||||
// this define comes from Qt example. I don't have mac, so it wasn't tested
|
||||
#ifndef Q_WS_MAC
|
||||
@ -95,7 +91,6 @@ ConnectFriendWizard::ConnectFriendWizard(QWidget *parent) :
|
||||
|
||||
// we have no good pictures for watermarks
|
||||
// setPixmap(QWizard::WatermarkPixmap, QPixmap(":/images/connectFriendWatermark.png"));
|
||||
setPixmap(QWizard::BannerPixmap, QPixmap(":/images/connect/connectFriendBanner1.png"));
|
||||
|
||||
/* register global fields */
|
||||
ui->ErrorMessagePage->registerField("errorMessage", ui->messageLabel, "text");
|
||||
@ -109,6 +104,99 @@ ConnectFriendWizard::ConnectFriendWizard(QWidget *parent) :
|
||||
|
||||
connect(ui->acceptNoSignGPGCheckBox,SIGNAL(toggled(bool)), ui->_options_GB,SLOT(setEnabled(bool))) ;
|
||||
connect(ui->addKeyToKeyring_CB,SIGNAL(toggled(bool)), ui->acceptNoSignGPGCheckBox,SLOT(setChecked(bool))) ;
|
||||
|
||||
updateStylesheet();
|
||||
}
|
||||
|
||||
void ConnectFriendWizard::setBannerPixmap(const QString &pixmap)
|
||||
{
|
||||
mBannerPixmap = pixmap;
|
||||
setPixmap(QWizard::BannerPixmap, mBannerPixmap);
|
||||
}
|
||||
|
||||
QString ConnectFriendWizard::bannerPixmap()
|
||||
{
|
||||
return mBannerPixmap;
|
||||
}
|
||||
|
||||
void ConnectFriendWizard::setTitleFontSize(int size)
|
||||
{
|
||||
mTitleFontSize = size;
|
||||
updateStylesheet();
|
||||
}
|
||||
|
||||
int ConnectFriendWizard::titleFontSize()
|
||||
{
|
||||
return mTitleFontSize;
|
||||
}
|
||||
|
||||
void ConnectFriendWizard::setTitleFontWeight(int weight)
|
||||
{
|
||||
mTitleFontWeight = weight;
|
||||
updateStylesheet();
|
||||
}
|
||||
|
||||
int ConnectFriendWizard::titleFontWeight()
|
||||
{
|
||||
return mTitleFontWeight;
|
||||
}
|
||||
|
||||
void ConnectFriendWizard::setTitleColor(const QString &color)
|
||||
{
|
||||
mTitleColor = color;
|
||||
updateStylesheet();
|
||||
}
|
||||
|
||||
QString ConnectFriendWizard::titleColor()
|
||||
{
|
||||
return mTitleColor;
|
||||
}
|
||||
|
||||
void ConnectFriendWizard::setTitleText(QWizardPage *page, const QString &title)
|
||||
{
|
||||
if (!page) {
|
||||
return;
|
||||
}
|
||||
|
||||
page->setTitle(title);
|
||||
|
||||
mTitleString.remove(page);
|
||||
updateStylesheet();
|
||||
}
|
||||
|
||||
void ConnectFriendWizard::updateStylesheet()
|
||||
{
|
||||
/* add stylesheet to title */
|
||||
QList<int> ids = pageIds();
|
||||
for (QList<int>::iterator pageIt = ids.begin(); pageIt != ids.end(); ++pageIt) {
|
||||
QWizardPage *p = page(*pageIt);
|
||||
|
||||
QString title;
|
||||
QMap<QWizardPage*, QString>::iterator it = mTitleString.find(p);
|
||||
if (it == mTitleString.end()) {
|
||||
/* Save title string */
|
||||
title = p->title();
|
||||
mTitleString[p] = title;
|
||||
} else {
|
||||
title = it.value();
|
||||
}
|
||||
|
||||
QString stylesheet = "<span style=\"";
|
||||
|
||||
if (mTitleFontSize) {
|
||||
stylesheet += QString("font-size:%1pt; ").arg(mTitleFontSize);
|
||||
}
|
||||
if (mTitleFontWeight) {
|
||||
stylesheet += QString("font-weight:%1; ").arg(mTitleFontWeight);
|
||||
}
|
||||
if (!mTitleColor.isEmpty()) {
|
||||
stylesheet += QString("color:%1; ").arg(mTitleColor);
|
||||
}
|
||||
|
||||
stylesheet += QString("\">%1</span>").arg(title);
|
||||
|
||||
p->setTitle(stylesheet);
|
||||
}
|
||||
}
|
||||
|
||||
QString ConnectFriendWizard::getErrorString(uint32_t error_code)
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
#include <QWizard>
|
||||
#include <retroshare/rspeers.h>
|
||||
#include <map>
|
||||
#include <QMap>
|
||||
|
||||
class QCheckBox;
|
||||
|
||||
@ -24,6 +24,11 @@ class ConnectFriendWizard : public QWizard
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
Q_PROPERTY(QString bannerPixmap READ bannerPixmap WRITE setBannerPixmap)
|
||||
Q_PROPERTY(int titleFontSize READ titleFontSize WRITE setTitleFontSize)
|
||||
Q_PROPERTY(int titleFontWeight READ titleFontWeight WRITE setTitleFontWeight)
|
||||
Q_PROPERTY(QString titleColor READ titleColor WRITE setTitleColor)
|
||||
|
||||
public:
|
||||
enum Page { Page_Intro, Page_Text, Page_Cert, Page_ErrorMessage, Page_Conclusion, Page_Foff, Page_Rsid, Page_Email, Page_FriendRequest, Page_FriendRecommendations };
|
||||
|
||||
@ -39,6 +44,15 @@ public:
|
||||
|
||||
void setGroup(const std::string &id);
|
||||
|
||||
void setBannerPixmap(const QString &pixmap);
|
||||
QString bannerPixmap();
|
||||
void setTitleFontSize(int size);
|
||||
int titleFontSize();
|
||||
void setTitleFontWeight(int weight);
|
||||
int titleFontWeight();
|
||||
void setTitleColor(const QString &color);
|
||||
QString titleColor();
|
||||
|
||||
protected:
|
||||
void initializePage(int id);
|
||||
|
||||
@ -70,11 +84,21 @@ private slots:
|
||||
private:
|
||||
// returns the translated error string for the error code (to be found in rspeers.h)
|
||||
QString getErrorString(uint32_t) ;
|
||||
void updateStylesheet();
|
||||
void setTitleText(QWizardPage *page, const QString &title);
|
||||
|
||||
private:
|
||||
bool error;
|
||||
RsPeerDetails peerDetails;
|
||||
std::string mCertificate;
|
||||
|
||||
/* Stylesheet */
|
||||
QString mBannerPixmap;
|
||||
int mTitleFontSize;
|
||||
int mTitleFontWeight;
|
||||
QString mTitleColor;
|
||||
QMap<QWizardPage*, QString> mTitleString;
|
||||
|
||||
/* TextPage */
|
||||
QTimer *cleanfriendCertTimer;
|
||||
|
||||
|
@ -65,6 +65,14 @@ GenCertDialog QPushButton#genButton:hover {
|
||||
border-image: url(:/images/btn_blue_hover.png) 4;
|
||||
}
|
||||
|
||||
/* ConnectFriendWizard */
|
||||
|
||||
ConnectFriendWizard {
|
||||
qproperty-bannerPixmap: url(:/images/connect/connectFriendBanner1.png);
|
||||
qproperty-titleFontSize: 16;
|
||||
qproperty-titleFontWeight: 500;
|
||||
qproperty-titleColor: white;
|
||||
}
|
||||
|
||||
/* FriendsDialog */
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user