aboutsummaryrefslogtreecommitdiffstats
path: root/src/modules/theme/PackThemeDialog.cpp
diff options
context:
space:
mode:
authorGravatar Alexey Sokolov2016-04-29 23:57:30 +0100
committerGravatar Alexey Sokolov2016-04-29 23:57:48 +0100
commit690dd7a33ddc90678367d73adf313533536e10f2 (patch)
tree2276fe7c384ebbc222b40a19c536d5c3c5606ce8 /src/modules/theme/PackThemeDialog.cpp
parentAdd config for clang-format. (diff)
downloadKVIrc-690dd7a33ddc90678367d73adf313533536e10f2.tar.gz
KVIrc-690dd7a33ddc90678367d73adf313533536e10f2.tar.bz2
KVIrc-690dd7a33ddc90678367d73adf313533536e10f2.zip
Apply clang-format
Diffstat (limited to 'src/modules/theme/PackThemeDialog.cpp')
-rw-r--r--src/modules/theme/PackThemeDialog.cpp216
1 files changed, 105 insertions, 111 deletions
diff --git a/src/modules/theme/PackThemeDialog.cpp b/src/modules/theme/PackThemeDialog.cpp
index 838684003..65c56984b 100644
--- a/src/modules/theme/PackThemeDialog.cpp
+++ b/src/modules/theme/PackThemeDialog.cpp
@@ -54,56 +54,54 @@
//#include <QToolTip>
//#include <QPushButton>
-
-
PackThemeDialog::PackThemeDialog(QWidget * pParent, KviPointerList<KviThemeInfo> * pThemeInfoList)
-: QWizard(pParent)
+ : QWizard(pParent)
{
- setWindowTitle(__tr2qs_ctx("Export Theme - KVIrc","theme"));
- setMinimumSize(400,350);
- setDefaultProperty("QTextEdit","plainText",SIGNAL(textChanged()));
+ setWindowTitle(__tr2qs_ctx("Export Theme - KVIrc", "theme"));
+ setMinimumSize(400, 350);
+ setDefaultProperty("QTextEdit", "plainText", SIGNAL(textChanged()));
m_pThemeInfoList = pThemeInfoList;
QPixmap * pSide = g_pIconManager->getBigIcon("kvi_setup_label.png");
QPixmap * pLogo = g_pIconManager->getBigIcon("kvi_bigicon_addons.png");
#if defined(COMPILE_ON_WINDOWS) || defined(COMPILE_ON_MINGW)
- #if (_WIN32_WINNT >= 0x0600)
- // We are on a Windows Vista / Seven
- // It will fallback to XP if alpha compositing is disabled
- setWizardStyle(QWizard::AeroStyle);
- #else
- // Windows XP
- setWizardStyle(QWizard::ModernStyle);
- setPixmap(QWizard::WatermarkPixmap,*pSide);
- setPixmap(QWizard::LogoPixmap,*pLogo);
- #endif
+#if(_WIN32_WINNT >= 0x0600)
+ // We are on a Windows Vista / Seven
+ // It will fallback to XP if alpha compositing is disabled
+ setWizardStyle(QWizard::AeroStyle);
+#else
+ // Windows XP
+ setWizardStyle(QWizard::ModernStyle);
+ setPixmap(QWizard::WatermarkPixmap, *pSide);
+ setPixmap(QWizard::LogoPixmap, *pLogo);
+#endif
#elif defined(COMPILE_ON_MAC)
setWizardStyle(QWizard::MacStyle);
- setPixmap(QWizard::BackgroundPixmap,*pSide);
+ setPixmap(QWizard::BackgroundPixmap, *pSide);
#else
// All other systems
setWizardStyle(QWizard::ClassicStyle);
- setPixmap(QWizard::WatermarkPixmap,*pSide);
- setPixmap(QWizard::LogoPixmap,*pLogo);
+ setPixmap(QWizard::WatermarkPixmap, *pSide);
+ setPixmap(QWizard::LogoPixmap, *pLogo);
#endif
// Add a default property for file selectors
- setDefaultProperty("KviFileSelector","tmpFile",SIGNAL(selectionChanged(const QString &)));
+ setDefaultProperty("KviFileSelector", "tmpFile", SIGNAL(selectionChanged(const QString &)));
// Welcome page
QWizardPage * pPage = new QWizardPage(this);
QVBoxLayout * pLayout = new QVBoxLayout(pPage);
pPage->setLayout(pLayout);
- pPage->setTitle(__tr2qs_ctx("Welcome","theme"));
+ pPage->setTitle(__tr2qs_ctx("Welcome", "theme"));
QString szText = "<p>";
- szText += __tr2qs_ctx("This procedure allows you to export the selected themes to a single package. It is useful when you want to distribute your themes to the public.","theme");
+ szText += __tr2qs_ctx("This procedure allows you to export the selected themes to a single package. It is useful when you want to distribute your themes to the public.", "theme");
szText += "</p><p>";
- szText += __tr2qs_ctx("You will be asked to provide a package name, a description and, if you want, an icon/screenshot.","theme");
+ szText += __tr2qs_ctx("You will be asked to provide a package name, a description and, if you want, an icon/screenshot.", "theme");
szText += "</p><p>";
- szText += __tr2qs_ctx("Hit the \"Next\" button to begin.","theme");
+ szText += __tr2qs_ctx("Hit the \"Next\" button to begin.", "theme");
szText += "<p>";
QLabel * pLabel = new QLabel(pPage);
@@ -133,11 +131,11 @@ PackThemeDialog::PackThemeDialog(QWidget * pParent, KviPointerList<KviThemeInfo>
}
PackThemeDataWidget::PackThemeDataWidget(PackThemeDialog * pParent)
-: QWizardPage(pParent)
+ : QWizardPage(pParent)
{
setObjectName("theme_package_data_page");
- setTitle(__tr2qs_ctx("Theme Data","theme"));
- setSubTitle(__tr2qs_ctx("This is the information list for the themes you're packaging. If it looks OK press \"Next\" to continue, otherwise press \"Cancel\" and review your themes first.","theme"));
+ setTitle(__tr2qs_ctx("Theme Data", "theme"));
+ setSubTitle(__tr2qs_ctx("This is the information list for the themes you're packaging. If it looks OK press \"Next\" to continue, otherwise press \"Cancel\" and review your themes first.", "theme"));
}
void PackThemeDataWidget::parseThemes(KviPointerList<KviThemeInfo> * pThemeInfoList)
@@ -149,17 +147,18 @@ void PackThemeDataWidget::parseThemes(KviPointerList<KviThemeInfo> * pThemeInfoL
KviThemeInfo * pThemeInfo = 0;
bool bPackagePathSet = false;
-
QString szPackagePath = QDir::homePath();
- KviQString::ensureLastCharIs(szPackagePath,QChar(KVI_PATH_SEPARATOR_CHAR));
+ KviQString::ensureLastCharIs(szPackagePath, QChar(KVI_PATH_SEPARATOR_CHAR));
if(pThemeInfoList->count() > 1)
{
szPackageName = "MyThemes";
- szPackageAuthor = __tr2qs_ctx("Your name here","theme");
+ szPackageAuthor = __tr2qs_ctx("Your name here", "theme");
szPackageVersion = "1.0.0";
- szPackageDescription = __tr2qs_ctx("Enter a package description here...","theme");
- } else {
+ szPackageDescription = __tr2qs_ctx("Enter a package description here...", "theme");
+ }
+ else
+ {
if(pThemeInfoList->count() > 0)
{
pThemeInfo = pThemeInfoList->first();
@@ -208,18 +207,17 @@ void PackThemeDataWidget::parseThemes(KviPointerList<KviThemeInfo> * pThemeInfoL
}
ThemeFunctions::getThemeHtmlDescription(
- szThemeDescription,
- pThemeInfo->name(),
- pThemeInfo->version(),
- pThemeInfo->description(),
- pThemeInfo->subdirectory(),
- pThemeInfo->application(),
- pThemeInfo->author(),
- pThemeInfo->date(),
- pThemeInfo->themeEngineVersion(),
- pThemeInfo->smallScreenshot(),
- iIdx
- );
+ szThemeDescription,
+ pThemeInfo->name(),
+ pThemeInfo->version(),
+ pThemeInfo->description(),
+ pThemeInfo->subdirectory(),
+ pThemeInfo->application(),
+ pThemeInfo->author(),
+ pThemeInfo->date(),
+ pThemeInfo->themeEngineVersion(),
+ pThemeInfo->smallScreenshot(),
+ iIdx);
if(iIdx > 0)
szThemesDescription += "<hr>";
@@ -237,10 +235,10 @@ void PackThemeDataWidget::parseThemes(KviPointerList<KviThemeInfo> * pThemeInfoL
pTextEdit->setDocument(pDoc);
pLayout->addWidget(pTextEdit);
- setField("packageName",QVariant(szPackageName));
- setField("packageVersion",szPackageVersion);
- setField("packageDescription",szPackageDescription);
- setField("packageAuthor",szPackageAuthor);
+ setField("packageName", QVariant(szPackageName));
+ setField("packageVersion", szPackageVersion);
+ setField("packageDescription", szPackageDescription);
+ setField("packageAuthor", szPackageAuthor);
}
PackThemeDataWidget::~PackThemeDataWidget()
@@ -248,60 +246,58 @@ PackThemeDataWidget::~PackThemeDataWidget()
}
PackThemeInfoWidget::PackThemeInfoWidget(PackThemeDialog * pParent)
-: QWizardPage(pParent)
+ : QWizardPage(pParent)
{
setObjectName("theme_package_info_page");
- setTitle(__tr2qs_ctx("Package Information","theme"));
- setSubTitle(__tr2qs_ctx("Here you need to provide information about you (the packager) and a short description of the package you're creating.","theme"));
-
+ setTitle(__tr2qs_ctx("Package Information", "theme"));
+ setSubTitle(__tr2qs_ctx("Here you need to provide information about you (the packager) and a short description of the package you're creating.", "theme"));
QGridLayout * pLayout = new QGridLayout(this);
QLabel * pLabel = new QLabel(this);
- pLabel->setText(__tr2qs_ctx("Package name:","theme"));
- pLayout->addWidget(pLabel,1,0);
+ pLabel->setText(__tr2qs_ctx("Package name:", "theme"));
+ pLayout->addWidget(pLabel, 1, 0);
m_pPackageNameEdit = new QLineEdit(this);
pLabel->setBuddy(m_pPackageNameEdit);
- pLayout->addWidget(m_pPackageNameEdit,1,1);
+ pLayout->addWidget(m_pPackageNameEdit, 1, 1);
pLabel = new QLabel(this);
- pLabel->setText(__tr2qs_ctx("Version:","theme"));
- pLayout->addWidget(pLabel,2,0);
+ pLabel->setText(__tr2qs_ctx("Version:", "theme"));
+ pLayout->addWidget(pLabel, 2, 0);
m_pPackageVersionEdit = new QLineEdit(this);
pLabel->setBuddy(m_pPackageVersionEdit);
- pLayout->addWidget(m_pPackageVersionEdit,2,1);
+ pLayout->addWidget(m_pPackageVersionEdit, 2, 1);
pLabel = new QLabel(this);
- pLabel->setText(__tr2qs_ctx("Description:","theme"));
- pLayout->addWidget(pLabel,3,0);
+ pLabel->setText(__tr2qs_ctx("Description:", "theme"));
+ pLayout->addWidget(pLabel, 3, 0);
m_pPackageDescriptionEdit = new QTextEdit(this);
pLabel->setBuddy(m_pPackageDescriptionEdit);
- pLayout->addWidget(m_pPackageDescriptionEdit,3,1);
+ pLayout->addWidget(m_pPackageDescriptionEdit, 3, 1);
pLabel = new QLabel(this);
- pLabel->setText(__tr2qs_ctx("Package author:","theme"));
- pLayout->addWidget(pLabel,4,0);
+ pLabel->setText(__tr2qs_ctx("Package author:", "theme"));
+ pLayout->addWidget(pLabel, 4, 0);
m_pPackageAuthorEdit = new QLineEdit(this);
pLabel->setBuddy(m_pPackageAuthorEdit);
- pLayout->addWidget(m_pPackageAuthorEdit,4,1);
+ pLayout->addWidget(m_pPackageAuthorEdit, 4, 1);
- pLayout->setRowStretch(3,1);
- pLayout->setColumnStretch(1,1);
+ pLayout->setRowStretch(3, 1);
+ pLayout->setColumnStretch(1, 1);
// Store data in the fields
- registerField("packageName*",m_pPackageNameEdit);
- registerField("packageVersion*",m_pPackageVersionEdit);
- registerField("packageDescription*",m_pPackageDescriptionEdit);
- registerField("packageAuthor*",m_pPackageAuthorEdit);
-
+ registerField("packageName*", m_pPackageNameEdit);
+ registerField("packageVersion*", m_pPackageVersionEdit);
+ registerField("packageDescription*", m_pPackageDescriptionEdit);
+ registerField("packageAuthor*", m_pPackageAuthorEdit);
}
void PackThemeInfoWidget::initializePage()
{
@@ -320,25 +316,25 @@ PackThemeInfoWidget::~PackThemeInfoWidget()
}
PackThemeImageWidget::PackThemeImageWidget(PackThemeDialog * pParent)
-: QWizardPage(pParent)
+ : QWizardPage(pParent)
{
setObjectName("theme_package_image_page");
- setTitle(__tr2qs_ctx("Icon/Screenshot","theme"));
- setSubTitle(__tr2qs_ctx("Here you can choose the image that will appear in the installation dialog for your theme package. It can be an icon, a logo or a screenshot and it should be not larger than 300x225. If you don't provide an image a simple default icon will be used at installation stage.","theme"));
+ setTitle(__tr2qs_ctx("Icon/Screenshot", "theme"));
+ setSubTitle(__tr2qs_ctx("Here you can choose the image that will appear in the installation dialog for your theme package. It can be an icon, a logo or a screenshot and it should be not larger than 300x225. If you don't provide an image a simple default icon will be used at installation stage.", "theme"));
QVBoxLayout * pLayout = new QVBoxLayout(this);
m_pImageLabel = new QLabel(this);
m_pImageLabel->setFrameStyle(QFrame::Sunken | QFrame::Panel);
- m_pImageLabel->setMinimumSize(300,225);
+ m_pImageLabel->setMinimumSize(300, 225);
m_pImageLabel->setAlignment(Qt::AlignCenter | Qt::AlignVCenter);
pLayout->addWidget(m_pImageLabel);
- m_pImageSelector = new KviFileSelector(this,"",&m_szImagePath,true,0,KVI_FILTER_IMAGE);
- connect(m_pImageSelector,SIGNAL(selectionChanged(const QString &)),this,SLOT(imageSelectionChanged(const QString &)));
+ m_pImageSelector = new KviFileSelector(this, "", &m_szImagePath, true, 0, KVI_FILTER_IMAGE);
+ connect(m_pImageSelector, SIGNAL(selectionChanged(const QString &)), this, SLOT(imageSelectionChanged(const QString &)));
pLayout->addWidget(m_pImageSelector);
// Store data in the fields
- registerField("packageImagePath*",m_pImageSelector);
+ registerField("packageImagePath*", m_pImageSelector);
//m_pImageSelectionPage = pPage;
}
@@ -355,43 +351,45 @@ void PackThemeImageWidget::imageSelectionChanged(const QString & szImagePath)
QPixmap out;
if(pix.width() > 300 || pix.height() > 225)
{
- pix=pix.scaled(300,225,Qt::KeepAspectRatio,Qt::SmoothTransformation);
- out=out.fromImage(pix);
- } else {
- out=out.fromImage(pix);
+ pix = pix.scaled(300, 225, Qt::KeepAspectRatio, Qt::SmoothTransformation);
+ out = out.fromImage(pix);
+ }
+ else
+ {
+ out = out.fromImage(pix);
}
m_pImageLabel->setPixmap(out);
return;
}
- QMessageBox::critical(this,__tr2qs_ctx("Export Theme - KVIrc","theme"),__tr2qs_ctx("Failed to load the selected image!","theme"),
- QMessageBox::Ok,QMessageBox::NoButton,QMessageBox::NoButton);
+ QMessageBox::critical(this, __tr2qs_ctx("Export Theme - KVIrc", "theme"), __tr2qs_ctx("Failed to load the selected image!", "theme"),
+ QMessageBox::Ok, QMessageBox::NoButton, QMessageBox::NoButton);
m_pImageSelector->setSelection("");
m_pImageLabel->setPixmap(QPixmap());
}
PackThemeSaveWidget::PackThemeSaveWidget(PackThemeDialog * pParent)
-: QWizardPage(pParent)
+ : QWizardPage(pParent)
{
setObjectName("theme_package_save_page");
- setTitle(__tr2qs_ctx("Package Path","theme"));
- setSubTitle(__tr2qs_ctx("Here you must choose the file name for the theme package. It should have a *%1 extension.","theme").arg(KVI_FILEEXTENSION_THEMEPACKAGE));
+ setTitle(__tr2qs_ctx("Package Path", "theme"));
+ setSubTitle(__tr2qs_ctx("Here you must choose the file name for the theme package. It should have a *%1 extension.", "theme").arg(KVI_FILEEXTENSION_THEMEPACKAGE));
QVBoxLayout * pLayout = new QVBoxLayout(this);
QString szFilter = "*";
szFilter += KVI_FILEEXTENSION_THEMEPACKAGE;
- m_pSavePathSelector = new KviFileSelector(this,"",&m_szPackagePath,true,KviFileSelector::ChooseSaveFileName,szFilter);
+ m_pSavePathSelector = new KviFileSelector(this, "", &m_szPackagePath, true, KviFileSelector::ChooseSaveFileName, szFilter);
pLayout->addWidget(m_pSavePathSelector);
QLabel * pLabel = new QLabel(this);
pLabel->setWordWrap(true);
- pLabel->setText(__tr2qs_ctx("Finally hit the \"Finish\" button to complete the packaging operation.","theme"));
+ pLabel->setText(__tr2qs_ctx("Finally hit the \"Finish\" button to complete the packaging operation.", "theme"));
pLayout->addWidget(pLabel);
// Store data in the fields
- registerField("packageSavePath*",m_pSavePathSelector);
+ registerField("packageSavePath*", m_pSavePathSelector);
}
PackThemeSaveWidget::~PackThemeSaveWidget()
@@ -417,7 +415,8 @@ PackThemeDialog::~PackThemeDialog()
void PackThemeDialog::accept()
{
- if(!packTheme()) return;
+ if(!packTheme())
+ return;
QWizard::accept();
}
@@ -436,32 +435,27 @@ bool PackThemeDialog::packTheme()
QString szError;
- if(!
- ThemeFunctions::packageThemes(
- m_szPackagePath,
- m_szName,
- m_szVersion,
- m_szDescription,
- m_szAuthor,
- m_szImagePath,
- *m_pThemeInfoList,
- szError
- )
- )
+ if(!ThemeFunctions::packageThemes(
+ m_szPackagePath,
+ m_szName,
+ m_szVersion,
+ m_szDescription,
+ m_szAuthor,
+ m_szImagePath,
+ *m_pThemeInfoList,
+ szError))
{
QMessageBox::critical(this,
- __tr2qs_ctx("Export Theme - KVIrc","theme"),
- szError,
- QMessageBox::Ok,QMessageBox::NoButton,QMessageBox::NoButton
- );
+ __tr2qs_ctx("Export Theme - KVIrc", "theme"),
+ szError,
+ QMessageBox::Ok, QMessageBox::NoButton, QMessageBox::NoButton);
return false;
}
QMessageBox::information(this,
- __tr2qs_ctx("Exporting Theme - KVIrc","theme"),
- __tr2qs("Theme package saved successfully."),
- QMessageBox::Ok,QMessageBox::NoButton,QMessageBox::NoButton
- );
+ __tr2qs_ctx("Exporting Theme - KVIrc", "theme"),
+ __tr2qs("Theme package saved successfully."),
+ QMessageBox::Ok, QMessageBox::NoButton, QMessageBox::NoButton);
return true;
}