Skip to content

Commit

Permalink
Various cleaning up.
Browse files Browse the repository at this point in the history
  • Loading branch information
agarny committed Apr 9, 2018
2 parents 463b14e + 5e076df commit aff9ff3
Show file tree
Hide file tree
Showing 35 changed files with 437 additions and 318 deletions.
22 changes: 15 additions & 7 deletions src/checkforupdatesdialog.cpp
Expand Up @@ -95,10 +95,12 @@ void CheckForUpdatesEngine::check()
if (!versionMajor && !versionMinor && !versionPatch) {
versionVersion = versionDate;
} else {
versionVersion = QString("%1.%2").arg(QString::number(versionMajor), QString::number(versionMinor));
versionVersion = QString("%1.%2").arg(versionMajor)
.arg(versionMinor);

if (versionPatch)
versionVersion = QString("%1.%2").arg(versionVersion, QString::number(versionPatch));
versionVersion = QString("%1.%2").arg(versionVersion)
.arg(versionPatch);
}

// Check whether the version is newer and, if so, add it to our
Expand Down Expand Up @@ -272,10 +274,14 @@ void CheckForUpdatesDialog::updateGui()
if (version.isEmpty())
version = mEngine->newerVersions().first();

if (version.contains('-'))
mGui->statusLabel->setText(snapshotInformation.arg(WhatIsNewUrl+"latest", version));
else
mGui->statusLabel->setText(versionInformation.arg(WhatIsNewUrl+version, qAppName(), version));
if (version.contains('-')) {
mGui->statusLabel->setText(snapshotInformation.arg(WhatIsNewUrl+"latest")
.arg(version));
} else {
mGui->statusLabel->setText(versionInformation.arg(WhatIsNewUrl+version)
.arg(qAppName())
.arg(version));
}
} else {
mGui->statusLabel->setText(tr("No newer version or snapshot of %1 is available.").arg(qAppName()));
}
Expand All @@ -293,7 +299,9 @@ void CheckForUpdatesDialog::updateGui()
}
}

mGui->statusLabel->setText(versionInformation.arg(WhatIsNewUrl+version, qAppName(), version));
mGui->statusLabel->setText(versionInformation.arg(WhatIsNewUrl+version)
.arg(qAppName())
.arg(version));
} else {
mGui->statusLabel->setText(tr("No newer version of %1 is available.").arg(qAppName()));
}
Expand Down
15 changes: 8 additions & 7 deletions src/mainwindow.cpp
Expand Up @@ -436,9 +436,9 @@ void MainWindow::registerOpencorUrlScheme()
SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, 0, 0);
#elif defined(Q_OS_LINUX)
if (!exec("which", QStringList() << "xdg-mime")) {
QString iconPath = canonicalFileName(QString("%1/.local/share/%2/%3/%3.png").arg(QDir::homePath(),
qApp->organizationName(),
qApp->applicationName()));
QString iconPath = canonicalFileName(QString("%1/.local/share/%2/%3/%3.png").arg(QDir::homePath())
.arg(qApp->organizationName())
.arg(qApp->applicationName()));

writeResourceToFile(iconPath, ":/app_icon");

Expand All @@ -449,9 +449,9 @@ void MainWindow::registerOpencorUrlScheme()
"Exec=%2 %u\n"
"Icon=%3\n"
"Terminal=false\n"
"MimeType=x-scheme-handler/opencor\n").arg(qApp->applicationName(),
canonicalFileName(qApp->applicationFilePath()),
iconPath));
"MimeType=x-scheme-handler/opencor\n").arg(qApp->applicationName())
.arg(canonicalFileName(qApp->applicationFilePath()))
.arg(iconPath));

exec("xdg-mime", QStringList() << "default" << "opencor.desktop" << "x-scheme-handler/opencor");
}
Expand Down Expand Up @@ -806,7 +806,8 @@ void MainWindow::setLocale(const QString &pRawLocale, bool pForceSetting)
// plugin to work properly...

foreach (Plugin *plugin, mLoadedI18nPlugins)
qobject_cast<I18nInterface *>(plugin->instance())->updateTranslator(QString(":/%1_%2").arg(plugin->name(), newLocale));
qobject_cast<I18nInterface *>(plugin->instance())->updateTranslator(QString(":/%1_%2").arg(plugin->name())
.arg(newLocale));

// Retranslate our various plugins

Expand Down
12 changes: 9 additions & 3 deletions src/misc/cliapplication.cpp
Expand Up @@ -155,12 +155,18 @@ void CliApplication::includePlugins(const QStringList &pPluginNames,
if (pluginInfo->isSelectable()) {
Plugin::setLoad(pluginName, pInclude);

status = QString("%1 the GUI version of OpenCOR").arg(pInclude?"included to":"excluded from");
status = QString("%1 the GUI version of OpenCOR").arg(pInclude?
"included to":
"excluded from");
} else {
status = QString("cannot be directly %1").arg(pInclude?"included":"excluded");
status = QString("cannot be directly %1").arg(pInclude?
"included":
"excluded");
}
} else {
status = QString("plugin information not found%1").arg(errorMessage.isEmpty()?QString():QString(" (%1)").arg(errorMessage));
status = QString("plugin information not found%1").arg(errorMessage.isEmpty()?
QString():
QString(" (%1)").arg(errorMessage));
}
} else {
status = "unknown plugin";
Expand Down
Expand Up @@ -101,9 +101,9 @@ DataStore::DataStoreData * BioSignalMLDataStorePlugin::getData(const QString &pF
biosignalmlDataStoreDialog.name(),
biosignalmlDataStoreDialog.author(),
biosignalmlDataStoreDialog.description(),
tr("Generated by %1 at %2 from %3.").arg(Core::version(),
QDateTime::currentDateTimeUtc().toString(Qt::ISODate),
pDataStore->uri()),
tr("Generated by %1 at %2 from %3.").arg(Core::version())
.arg(QDateTime::currentDateTimeUtc().toString(Qt::ISODate))
.arg(pDataStore->uri()),
pDataStore,
biosignalmlDataStoreDialog.selectedData());
}
Expand Down
11 changes: 6 additions & 5 deletions src/plugins/dataStore/CSVDataStore/src/csvdatastoreexporter.cpp
Expand Up @@ -130,18 +130,19 @@ void CsvDataStoreExporter::execute(QString &pErrorMessage) const
QString header = QString();

if (voi) {
header += Header.arg(voi->uri().replace("/prime", "'").replace('/', " | "),
voi->unit(), QString());
header += Header.arg(voi->uri().replace("/prime", "'").replace('/', " | "))
.arg(voi->unit())
.arg(QString());
}

foreach (DataStore::DataStoreVariable *variable, variables) {
for (int i = 0; i < nbOfRuns; ++i) {
if (!header.isEmpty())
header += ',';

header += Header.arg(variable->uri().replace("/prime", "'").replace('/', " | "),
variable->unit(),
(nbOfRuns == 1)?
header += Header.arg(variable->uri().replace("/prime", "'").replace('/', " | "))
.arg(variable->unit())
.arg((nbOfRuns == 1)?
QString():
RunNb.arg(i+1));
}
Expand Down
Expand Up @@ -181,18 +181,18 @@ CellmlAnnotationViewCellmlElementItem::CellmlAnnotationViewCellmlElementItem(con
case ComponentMapping: {
ObjRef<iface::cellml_api::MapComponents> mapComponents = dynamic_cast<iface::cellml_api::MapComponents *>(pElement);

setText(QString("%1 %2 %3").arg(QString::fromStdWString(mapComponents->firstComponentName()),
QChar(RightArrow),
QString::fromStdWString(mapComponents->secondComponentName())));
setText(QString("%1 %2 %3").arg(QString::fromStdWString(mapComponents->firstComponentName()))
.arg(QChar(RightArrow))
.arg(QString::fromStdWString(mapComponents->secondComponentName())));

break;
}
case VariableMapping: {
ObjRef<iface::cellml_api::MapVariables> mapVariables = dynamic_cast<iface::cellml_api::MapVariables *>(pElement);

setText(QString("%1 %2 %3").arg(QString::fromStdWString(mapVariables->firstVariableName()),
QChar(RightArrow),
QString::fromStdWString(mapVariables->secondVariableName())));
setText(QString("%1 %2 %3").arg(QString::fromStdWString(mapVariables->firstVariableName()))
.arg(QChar(RightArrow))
.arg(QString::fromStdWString(mapVariables->secondVariableName())));

break;
}
Expand Down Expand Up @@ -540,9 +540,9 @@ void CellmlAnnotationViewCellmlListWidget::populateModel()

foreach (const CellMLSupport::CellmlFileIssue &issue, mCellmlFile->issues()) {
mTreeViewModel->invisibleRootItem()->appendRow(new CellmlAnnotationViewCellmlElementItem(issue.type() == CellMLSupport::CellmlFileIssue::Error,
QString("[%1:%2] %3").arg(QString::number(issue.line()),
QString::number(issue.column()),
issue.formattedMessage())));
QString("[%1:%2] %3").arg(issue.line())
.arg(issue.column())
.arg(issue.formattedMessage())));
}

return;
Expand Down
Expand Up @@ -181,9 +181,9 @@ void CellmlAnnotationViewEditingWidget::updateWebViewerWithQualifierDetails(WebV

// Generate the web page containing some information about the qualifier

QByteArray qualifierSvg = pQualifier.startsWith("model:")?
mModelQualifierSvg:
mBiologyQualifierSvg;
QString qualifierSvg = pQualifier.startsWith("model:")?
mModelQualifierSvg:
mBiologyQualifierSvg;
QString shortDescription;
QString longDescription;

Expand Down Expand Up @@ -242,15 +242,18 @@ void CellmlAnnotationViewEditingWidget::updateWebViewerWithQualifierDetails(WebV
shortDescription = tr("Taxon");
longDescription = tr("The biological entity represented by the model element is taxonomically restricted, where the restriction is the subject of the referenced resource (\"Biological Entity B\"). This relation may be used to ascribe a species restriction to a biochemical reaction.");
} else {
qualifierSvg = QByteArray();
qualifierSvg = QString();

shortDescription = tr("Unknown");
longDescription = tr("Unknown");
}

// Show the information

pWebViewer->webView()->setHtml(mQualifierInformationTemplate.arg(pQualifier, qualifierSvg, shortDescription, longDescription));
pWebViewer->webView()->setHtml(mQualifierInformationTemplate.arg(pQualifier)
.arg(qualifierSvg)
.arg(shortDescription)
.arg(longDescription));
}

//==============================================================================
Expand Down
Expand Up @@ -86,8 +86,8 @@ class CellmlAnnotationViewEditingWidget : public Core::SplitterWidget
CellmlAnnotationViewCellmlListWidget *mCellmlList;
CellmlAnnotationViewMetadataDetailsWidget *mMetadataDetails;

QByteArray mModelQualifierSvg;
QByteArray mBiologyQualifierSvg;
QString mModelQualifierSvg;
QString mBiologyQualifierSvg;

QString mQualifierInformationTemplate;

Expand Down
Expand Up @@ -554,8 +554,8 @@ void CellmlAnnotationViewMetadataEditDetailsWidget::updateItemsGui(const CellmlA
if (pItems.count()) {
// Initialise our web view

mOutputOntologicalTerms->webView()->setHtml(mOutputOntologicalTermsTemplate.arg(Core::iconDataUri(":/oxygen/actions/list-add.png", 16, 16),
Core::iconDataUri(":/oxygen/actions/list-add.png", 16, 16, QIcon::Disabled)));
mOutputOntologicalTerms->webView()->setHtml(mOutputOntologicalTermsTemplate.arg(Core::iconDataUri(":/oxygen/actions/list-add.png", 16, 16))
.arg(Core::iconDataUri(":/oxygen/actions/list-add.png", 16, 16, QIcon::Disabled)));

// Add the items

Expand Down
Expand Up @@ -269,8 +269,8 @@ void CellmlAnnotationViewMetadataNormalViewDetailsWidget::addRdfTriple(CellMLSup
// Initialise our web view, if needed

if (!mItemsCount) {
mOutputOntologicalTerms->webView()->setHtml(mOutputOntologicalTermsTemplate.arg(Core::iconDataUri(":/oxygen/actions/list-remove.png", 16, 16),
Core::iconDataUri(":/oxygen/actions/list-remove.png", 16, 16, QIcon::Disabled)));
mOutputOntologicalTerms->webView()->setHtml(mOutputOntologicalTermsTemplate.arg(Core::iconDataUri(":/oxygen/actions/list-remove.png", 16, 16))
.arg(Core::iconDataUri(":/oxygen/actions/list-remove.png", 16, 16, QIcon::Disabled)));
}

// Add the item
Expand Down

0 comments on commit aff9ff3

Please sign in to comment.