本文整理汇总了C++中KviThemeInfo::setVersion方法的典型用法代码示例。如果您正苦于以下问题:C++ KviThemeInfo::setVersion方法的具体用法?C++ KviThemeInfo::setVersion怎么用?C++ KviThemeInfo::setVersion使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KviThemeInfo
的用法示例。
在下文中一共展示了KviThemeInfo::setVersion方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: saveTheme
bool SaveThemeDialog::saveTheme()
{
m_pImageSelector->commit();
KviThemeInfo sto;
sto.setName(m_pThemeNameEdit->text());
if(sto.name().isEmpty())
{
QMessageBox::critical(this,__tr2qs_ctx("Save Current Theme - KVIrc","theme"),__tr2qs_ctx("You must choose a theme name!","theme"),QMessageBox::Ok,
QMessageBox::NoButton,QMessageBox::NoButton);
return false;
}
sto.setAuthor(m_pAuthorNameEdit->text());
sto.setDescription(m_pThemeDescriptionEdit->toPlainText());
// this is the equivalent to an empty date.toString() call, but it's needed
// to ensure qt4 will use the default() locale and not the system() one
sto.setDate(QLocale().toString(QDateTime::currentDateTime(), "ddd MMM d hh:mm:ss yyyy"));
sto.setVersion(m_pThemeVersionEdit->text());
sto.setApplication("KVIrc " KVI_VERSION "." KVI_SOURCES_DATE);
if(sto.version().isEmpty())
sto.setVersion("1.0.0");
QString szSubdir = sto.name() + QString("-") + sto.version();
szSubdir.replace(QRegExp("[^a-zA-Z0-9_\\-.][^a-zA-Z0-9_\\-.]*"),"_");
sto.setDirectoryAndLocation(szSubdir,KviThemeInfo::User);
QString szAbsDir = sto.directory();
if(!KviFileUtils::makeDir(szAbsDir))
{
QMessageBox::critical(this,__tr2qs_ctx("Save Current Theme - KVIrc","theme"),__tr2qs_ctx("Unable to create theme directory.","theme"),
QMessageBox::Ok,QMessageBox::NoButton,QMessageBox::NoButton);
return false;
}
if(!KviTheme::save(sto))
{
QString szErr = sto.lastError();
QString szMsg2 = QString(__tr2qs_ctx("Unable to save theme: %1","theme")).arg(szErr);
QMessageBox::critical(this,__tr2qs_ctx("Save Current Theme - KVIrc","theme"),szMsg2,
QMessageBox::Ok,QMessageBox::NoButton,QMessageBox::NoButton);
return false;
}
// write down the screenshot, if needed
if(!m_szScreenshotPath.isEmpty())
{
if(!KviTheme::saveScreenshots(sto,m_szScreenshotPath))
{
QMessageBox::critical(this,__tr2qs_ctx("Save Current Theme - KVIrc","theme"),__tr2qs_ctx("Failed to load the selected screenshot image: please fix it","theme"),
QMessageBox::Ok,QMessageBox::NoButton,QMessageBox::NoButton);
setCurrentPage(m_pImageSelectionPage);
return false;
}
}
QString szMsg = __tr2qs_ctx("Theme saved successfully to %1","theme").arg(szAbsDir);
QMessageBox::information(this,__tr2qs_ctx("Save Theme - KVIrc","theme"),szMsg,QMessageBox::Ok,
QMessageBox::NoButton,QMessageBox::NoButton);
return true;
}