diff options
| author | 2016-04-29 23:57:30 +0100 | |
|---|---|---|
| committer | 2016-04-29 23:57:48 +0100 | |
| commit | 690dd7a33ddc90678367d73adf313533536e10f2 (patch) | |
| tree | 2276fe7c384ebbc222b40a19c536d5c3c5606ce8 /src/modules/addon/PackAddonDialog.cpp | |
| parent | Add config for clang-format. (diff) | |
| download | KVIrc-690dd7a33ddc90678367d73adf313533536e10f2.tar.gz KVIrc-690dd7a33ddc90678367d73adf313533536e10f2.tar.bz2 KVIrc-690dd7a33ddc90678367d73adf313533536e10f2.zip | |
Apply clang-format
Diffstat (limited to 'src/modules/addon/PackAddonDialog.cpp')
| -rw-r--r-- | src/modules/addon/PackAddonDialog.cpp | 198 |
1 files changed, 95 insertions, 103 deletions
diff --git a/src/modules/addon/PackAddonDialog.cpp b/src/modules/addon/PackAddonDialog.cpp index 4f0ccd5f6..b56fa3d12 100644 --- a/src/modules/addon/PackAddonDialog.cpp +++ b/src/modules/addon/PackAddonDialog.cpp @@ -42,58 +42,58 @@ #include <QDirIterator> PackAddonDialog::PackAddonDialog(QWidget * pParent) -: QWizard(pParent) + : QWizard(pParent) { - setMinimumSize(400,350); + setMinimumSize(400, 350); setObjectName("addon_package_wizard"); - setOption(QWizard::IndependentPages,true); - setWindowTitle(__tr2qs_ctx("Create Addon Package - KVIrc","addon")); + setOption(QWizard::IndependentPages, true); + setWindowTitle(__tr2qs_ctx("Create Addon Package - KVIrc", "addon")); 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","addon")); + pPage->setTitle(__tr2qs_ctx("Welcome", "addon")); QLabel * pLabel = new QLabel(pPage); pLabel->setWordWrap(true); - pLabel->setText(__tr2qs_ctx("This procedure allows you to export the selected addon to a single package.<br>It is useful when you want to distribute your addon to the public.","addon")); + pLabel->setText(__tr2qs_ctx("This procedure allows you to export the selected addon to a single package.<br>It is useful when you want to distribute your addon to the public.", "addon")); pLayout->addWidget(pLabel); pLabel = new QLabel(pPage); pLabel->setWordWrap(true); QString szText; - szText += __tr2qs_ctx("You will be asked to provide some information like the package name, the version, a description and so on.","addon"); + szText += __tr2qs_ctx("You will be asked to provide some information like the package name, the version, a description and so on.", "addon"); szText += "<br><br>"; - szText += __tr2qs_ctx("Hit the \"Next\" button to begin.","addon"); + szText += __tr2qs_ctx("Hit the \"Next\" button to begin.", "addon"); pLabel->setText(szText); pLayout->addWidget(pLabel); @@ -116,7 +116,6 @@ PackAddonDialog::PackAddonDialog(QWidget * pParent) // Summary info m_pPackAddonSummaryInfoWidget = new PackAddonSummaryInfoWidget(this); addPage(m_pPackAddonSummaryInfoWidget); - } PackAddonDialog::~PackAddonDialog() @@ -146,7 +145,7 @@ bool PackAddonDialog::packAddon() if(info.szSavePath.isEmpty()) { info.szSavePath = QDir::homePath(); - KviQString::ensureLastCharIs(info.szSavePath,QChar(KVI_PATH_SEPARATOR_CHAR)); + KviQString::ensureLastCharIs(info.szSavePath, QChar(KVI_PATH_SEPARATOR_CHAR)); info.szSavePath += m_szName; info.szSavePath += "-"; info.szSavePath += m_szVersion; @@ -156,12 +155,12 @@ bool PackAddonDialog::packAddon() if(QFile::exists(info.szSavePath)) { if(QMessageBox::question( - this, - __tr2qs_ctx("Exporting Addon Confirmation - KVIrc","addon"), - __tr2qs_ctx("File %1 already exists. Do you want to overwrite it?","addon").arg(info.szSavePath), - QMessageBox::Yes, - QMessageBox::No - ) == QMessageBox::No) + this, + __tr2qs_ctx("Exporting Addon Confirmation - KVIrc", "addon"), + __tr2qs_ctx("File %1 already exists. Do you want to overwrite it?", "addon").arg(info.szSavePath), + QMessageBox::Yes, + QMessageBox::No) + == QMessageBox::No) return false; } @@ -176,136 +175,131 @@ bool PackAddonDialog::packAddon() QString szError; - if(!AddonFunctions::pack(info,szError)) + if(!AddonFunctions::pack(info, szError)) { QMessageBox::critical(this, - __tr2qs_ctx("Addon Packaging - KVIrc","addon"), - szError,QMessageBox::Ok,QMessageBox::NoButton,QMessageBox::NoButton - ); + __tr2qs_ctx("Addon Packaging - KVIrc", "addon"), + szError, QMessageBox::Ok, QMessageBox::NoButton, QMessageBox::NoButton); return false; } - QMessageBox::information(this,__tr2qs_ctx("Exporting Addon Completed - KVIrc","addon"),__tr2qs_ctx("The Package was saved successfully in %1","addon").arg(m_szSavePath),QMessageBox::Ok,QMessageBox::NoButton,QMessageBox::NoButton); + QMessageBox::information(this, __tr2qs_ctx("Exporting Addon Completed - KVIrc", "addon"), __tr2qs_ctx("The Package was saved successfully in %1", "addon").arg(m_szSavePath), QMessageBox::Ok, QMessageBox::NoButton, QMessageBox::NoButton); return true; } - PackAddonInfoPackageWidget::PackAddonInfoPackageWidget(PackAddonDialog * pParent) -: QWizardPage(pParent) + : QWizardPage(pParent) { setObjectName("addon_package_info_page"); - setTitle(__tr2qs_ctx("Package Information","addon")); - setSubTitle(__tr2qs_ctx("Here you need to provide information about you (the packager) and a short description of the package you're creating.","addon")); + setTitle(__tr2qs_ctx("Package Information", "addon")); + setSubTitle(__tr2qs_ctx("Here you need to provide information about you (the packager) and a short description of the package you're creating.", "addon")); QGridLayout * pLayout = new QGridLayout(this); QLabel * pLabel = new QLabel(this); - pLabel->setText(__tr2qs_ctx("Package &author:","addon")); - pLayout->addWidget(pLabel,0,0); + pLabel->setText(__tr2qs_ctx("Package &author:", "addon")); + pLayout->addWidget(pLabel, 0, 0); m_pPackageAuthorEdit = new QLineEdit(this); pLabel->setBuddy(m_pPackageAuthorEdit); - pLayout->addWidget(m_pPackageAuthorEdit,0,1); + pLayout->addWidget(m_pPackageAuthorEdit, 0, 1); pLabel = new QLabel(this); - pLabel->setText(__tr2qs_ctx("Package &name:","addon")); - pLayout->addWidget(pLabel,1,0); + pLabel->setText(__tr2qs_ctx("Package &name:", "addon")); + pLayout->addWidget(pLabel, 1, 0); m_pPackageNameEdit = new QLineEdit(this); - m_pPackageNameEdit->setPlaceholderText(__tr2qs_ctx("No spaces allowed","addon")); + m_pPackageNameEdit->setPlaceholderText(__tr2qs_ctx("No spaces allowed", "addon")); pLabel->setBuddy(m_pPackageNameEdit); - pLayout->addWidget(m_pPackageNameEdit,1,1); + pLayout->addWidget(m_pPackageNameEdit, 1, 1); pLabel = new QLabel(this); - pLabel->setText(__tr2qs_ctx("Package &version:","addon")); - pLayout->addWidget(pLabel,2,0); + pLabel->setText(__tr2qs_ctx("Package &version:", "addon")); + pLayout->addWidget(pLabel, 2, 0); m_pPackageVersionEdit = new QLineEdit(this); m_pPackageVersionEdit->setPlaceholderText("1.0"); pLabel->setBuddy(m_pPackageVersionEdit); - pLayout->addWidget(m_pPackageVersionEdit,2,1); + pLayout->addWidget(m_pPackageVersionEdit, 2, 1); pLabel = new QLabel(this); - pLabel->setText(__tr2qs_ctx("Package &description:","addon")); - pLayout->addWidget(pLabel,3,0); + pLabel->setText(__tr2qs_ctx("Package &description:", "addon")); + pLayout->addWidget(pLabel, 3, 0); m_pPackageDescriptionEdit = new QLineEdit(this); m_pPackageDescriptionEdit->setText(QString()); pLabel->setBuddy(m_pPackageDescriptionEdit); - pLayout->addWidget(m_pPackageDescriptionEdit,3,1); + pLayout->addWidget(m_pPackageDescriptionEdit, 3, 1); pLabel = new QLabel(this); - pLabel->setText(__tr2qs_ctx("Minimum &KVIrc version:","addon")); - pLayout->addWidget(pLabel,4,0); + pLabel->setText(__tr2qs_ctx("Minimum &KVIrc version:", "addon")); + pLayout->addWidget(pLabel, 4, 0); m_pPackageMinVersionEdit = new QLineEdit(this); m_pPackageMinVersionEdit->setText(KVI_VERSION); pLabel->setBuddy(m_pPackageMinVersionEdit); - pLayout->addWidget(m_pPackageMinVersionEdit,4,1); + pLayout->addWidget(m_pPackageMinVersionEdit, 4, 1); // Store data in the fields - registerField("packageAuthor*",m_pPackageAuthorEdit); - registerField("packageName*",m_pPackageNameEdit); - registerField("packageVersion*",m_pPackageVersionEdit); - registerField("packageDescription*",m_pPackageDescriptionEdit); - registerField("packageMinVersion",m_pPackageMinVersionEdit); + registerField("packageAuthor*", m_pPackageAuthorEdit); + registerField("packageName*", m_pPackageNameEdit); + registerField("packageVersion*", m_pPackageVersionEdit); + registerField("packageDescription*", m_pPackageDescriptionEdit); + registerField("packageMinVersion", m_pPackageMinVersionEdit); } PackAddonInfoPackageWidget::~PackAddonInfoPackageWidget() { } - PackAddonFileSelectionWidget::PackAddonFileSelectionWidget(PackAddonDialog * pParent) -: QWizardPage(pParent) + : QWizardPage(pParent) { setObjectName("addon_package_file_page"); - setTitle(__tr2qs_ctx("Package Files","addon")); - setSubTitle(__tr2qs_ctx("Here you need to select the directory where the addon files to be packed are located.","addon")); + setTitle(__tr2qs_ctx("Package Files", "addon")); + setSubTitle(__tr2qs_ctx("Here you need to select the directory where the addon files to be packed are located.", "addon")); QVBoxLayout * pLayout = new QVBoxLayout(this); // Select source directory - m_pDirPathSelector = new KviDirectorySelector(this,__tr2qs_ctx("Select the source directory:","addon"),&m_szDirPath,true,KviFileSelector::VerticalLayout); + m_pDirPathSelector = new KviDirectorySelector(this, __tr2qs_ctx("Select the source directory:", "addon"), &m_szDirPath, true, KviFileSelector::VerticalLayout); pLayout->addWidget(m_pDirPathSelector); // Select addon icon - m_pPackageImageEdit = new KviFileSelector(this,__tr2qs_ctx("Select the image file:","addon"),&m_szPackageImage,true,KviFileSelector::VerticalLayout,KVI_FILTER_IMAGE); + m_pPackageImageEdit = new KviFileSelector(this, __tr2qs_ctx("Select the image file:", "addon"), &m_szPackageImage, true, KviFileSelector::VerticalLayout, KVI_FILTER_IMAGE); pLayout->addWidget(m_pPackageImageEdit); // Store data in the fields - registerField("packageDirPath*",m_pDirPathSelector); - registerField("packageImage*",m_pPackageImageEdit); + registerField("packageDirPath*", m_pDirPathSelector); + registerField("packageImage*", m_pPackageImageEdit); } PackAddonFileSelectionWidget::~PackAddonFileSelectionWidget() { } - PackAddonSaveSelectionWidget::PackAddonSaveSelectionWidget(PackAddonDialog * pParent) -: QWizardPage(pParent) + : QWizardPage(pParent) { setObjectName("addon_package_save_page"); - setTitle(__tr2qs_ctx("Save Package","addon")); - setSubTitle(__tr2qs_ctx("Here you need to provide the path where to save the created addon package","addon")); + setTitle(__tr2qs_ctx("Save Package", "addon")); + setSubTitle(__tr2qs_ctx("Here you need to provide the path where to save the created addon package", "addon")); QVBoxLayout * pLayout = new QVBoxLayout(this); // Select save path m_pSavePathSelector = new KviFileSelector( - this, - __tr2qs_ctx("Select save path:","addon"), - &m_szFilePath, - true, - KviFileSelector::ChooseSaveFileName | KviFileSelector::VerticalLayout, - KVI_FILTER_ADDON - ); + this, + __tr2qs_ctx("Select save path:", "addon"), + &m_szFilePath, + true, + KviFileSelector::ChooseSaveFileName | KviFileSelector::VerticalLayout, + KVI_FILTER_ADDON); pLayout->addWidget(m_pSavePathSelector); // Store data in the fields - registerField("packageSavePath*",m_pSavePathSelector); + registerField("packageSavePath*", m_pSavePathSelector); } PackAddonSaveSelectionWidget::~PackAddonSaveSelectionWidget() @@ -320,7 +314,7 @@ void PackAddonSaveSelectionWidget::initializePage() // Create addon name QString szSavePath = QDir::homePath(); - KviQString::ensureLastCharIs(szSavePath,QChar(KVI_PATH_SEPARATOR_CHAR)); + KviQString::ensureLastCharIs(szSavePath, QChar(KVI_PATH_SEPARATOR_CHAR)); szSavePath += szName; szSavePath += "-"; szSavePath += szVersion; @@ -328,13 +322,12 @@ void PackAddonSaveSelectionWidget::initializePage() m_pSavePathSelector->setTmpFile(szSavePath); } - PackAddonSummaryInfoWidget::PackAddonSummaryInfoWidget(PackAddonDialog * pParent) -: QWizardPage(pParent) + : QWizardPage(pParent) { setObjectName("addon_package_summary_info_page"); - setTitle(__tr2qs_ctx("Final Information","addon")); - setSubTitle(__tr2qs_ctx("Here are the details you provided. If this information is correct, hit the \"Finish\" button to complete the packaging operations.","addon")); + setTitle(__tr2qs_ctx("Final Information", "addon")); + setSubTitle(__tr2qs_ctx("Here are the details you provided. If this information is correct, hit the \"Finish\" button to complete the packaging operations.", "addon")); QVBoxLayout * pLayout = new QVBoxLayout(this); m_pLabelInfo = new QLabel(this); @@ -357,56 +350,55 @@ void PackAddonSummaryInfoWidget::initializePage() QString szDirPath = field("packageDirPath").toString(); QString szSavePath = field("packageSavePath").toString(); - QString szText = __tr2qs_ctx("This is what I will check for:","addon"); + QString szText = __tr2qs_ctx("This is what I will check for:", "addon"); szText += "<br><br><b>"; - szText += __tr2qs_ctx("Package author","addon"); + szText += __tr2qs_ctx("Package author", "addon"); szText += ":</b> "; szText += szAuthor; szText += "<br><b>"; - szText += __tr2qs_ctx("Package name","addon"); + szText += __tr2qs_ctx("Package name", "addon"); szText += ":</b> "; szText += szName; szText += "<br><b>"; - szText += __tr2qs_ctx("Package version","addon"); + szText += __tr2qs_ctx("Package version", "addon"); szText += ":</b> "; szText += szVersion; szText += "<br><b>"; - szText += __tr2qs_ctx("Package description","addon"); + szText += __tr2qs_ctx("Package description", "addon"); szText += ":</b> "; szText += szDescription; szText += "<br><b>"; - szText += __tr2qs_ctx("Minimum KVIrc version","addon"); + szText += __tr2qs_ctx("Minimum KVIrc version", "addon"); szText += ":</b> "; szText += szMinVersion; szText += "<br><b>"; - szText += __tr2qs_ctx("Image file","addon"); + szText += __tr2qs_ctx("Image file", "addon"); szText += ":</b> "; szText += szImage; szText += "<br><b>"; - szText += __tr2qs_ctx("Source directory","addon"); + szText += __tr2qs_ctx("Source directory", "addon"); szText += ":</b> "; szText += szDirPath; szText += "<br><b>"; - szText += __tr2qs_ctx("Save path","addon"); + szText += __tr2qs_ctx("Save path", "addon"); szText += ":</b> "; szText += szSavePath; m_pLabelInfo->setText(szText); } - PackAddonSummaryFilesWidget::PackAddonSummaryFilesWidget(PackAddonDialog * pParent) -: QDialog(pParent) + : QDialog(pParent) { setObjectName("addon_package_summary_file_dialog"); - setWindowTitle(__tr2qs_ctx("File Summary Review - KVIrc","addon")); + setWindowTitle(__tr2qs_ctx("File Summary Review - KVIrc", "addon")); setWindowModality(Qt::WindowModal); setModal(true); QVBoxLayout * pLayout = new QVBoxLayout(this); QLabel * pLabel = new QLabel(this); - pLabel->setText(__tr2qs_ctx("Here are the files found in the directories you provided.\nIf the files listed below are correct, hit the \"Finish\" button to complete the packaging operation.","addon")); + pLabel->setText(__tr2qs_ctx("Here are the files found in the directories you provided.\nIf the files listed below are correct, hit the \"Finish\" button to complete the packaging operation.", "addon")); pLayout->addWidget(pLabel); m_pFiles = new QTextEdit(this); @@ -415,12 +407,12 @@ PackAddonSummaryFilesWidget::PackAddonSummaryFilesWidget(PackAddonDialog * pPare KviTalHBox * pBox = new KviTalHBox(this); QPushButton * pCancel = new QPushButton(pBox); - pCancel->setText(__tr2qs_ctx("Cancel","addon")); - connect(pCancel,SIGNAL(clicked()),this,SLOT(reject())); + pCancel->setText(__tr2qs_ctx("Cancel", "addon")); + connect(pCancel, SIGNAL(clicked()), this, SLOT(reject())); QPushButton * pAccept = new QPushButton(pBox); - pAccept->setText(__tr2qs_ctx("Finish","addon")); - connect(pAccept,SIGNAL(clicked()),this,SLOT(accept())); + pAccept->setText(__tr2qs_ctx("Finish", "addon")); + connect(pAccept, SIGNAL(clicked()), this, SLOT(accept())); pLayout->addWidget(pBox); } @@ -442,7 +434,7 @@ void PackAddonSummaryFilesWidget::showEvent(QShowEvent *) { QStringList list; - QDirIterator it(m_szPath,QDir::AllEntries | QDir::NoDotAndDotDot,QDirIterator::Subdirectories); + QDirIterator it(m_szPath, QDir::AllEntries | QDir::NoDotAndDotDot, QDirIterator::Subdirectories); // Iterate through the addon dir and its subdirs while(it.hasNext()) |
