Skip to content

Commit

Permalink
Some minor cleaning up.
Browse files Browse the repository at this point in the history
  • Loading branch information
agarny committed Feb 4, 2020
1 parent ab8b775 commit 23d4c2f
Show file tree
Hide file tree
Showing 126 changed files with 483 additions and 501 deletions.
2 changes: 1 addition & 1 deletion src/checkforupdatesdialog.cpp
Expand Up @@ -65,7 +65,7 @@ void CheckForUpdatesEngine::check()
mNewerVersions.clear();

if (readFile("https://opencor.ws/downloads/index.js", fileVersionsContents, &errorMessage)) {
QJsonParseError jsonParseError = QJsonParseError();
QJsonParseError jsonParseError;
QJsonDocument versions = QJsonDocument::fromJson(fileVersionsContents.mid(15, fileVersionsContents.length()-17), &jsonParseError);

if (jsonParseError.error == QJsonParseError::NoError) {
Expand Down
6 changes: 1 addition & 5 deletions src/main.cpp
Expand Up @@ -84,11 +84,7 @@ int main(int pArgC, char *pArgV[])
// and that some macOS specific menu items are not shown

#ifdef Q_OS_MAC
QProcess::execute("defaults",
QStringList() << "write"
<< "ws.opencor"
<< "ApplePersistenceIgnoreState"
<< "NO");
QProcess::execute("defaults", { "write", "ws.opencor", "ApplePersistenceIgnoreState", "NO" });

OpenCOR::removeMacosSpecificMenuItems();
#endif
Expand Down
6 changes: 3 additions & 3 deletions src/mainwindow.cpp
Expand Up @@ -474,7 +474,7 @@ void MainWindow::registerOpencorUrlScheme()

SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, nullptr, nullptr);
#elif defined(Q_OS_LINUX)
if (exec("which", QStringList() << "xdg-mime") == 0) {
if (exec("which", { "xdg-mime" }) == 0) {
QString iconPath = canonicalFileName(QString("%1/.local/share/%2/%3/%3.png").arg(QDir::homePath(),
qApp->organizationName(),
qApp->applicationName()));
Expand All @@ -492,7 +492,7 @@ void MainWindow::registerOpencorUrlScheme()
canonicalFileName(qApp->applicationFilePath()),
iconPath));

exec("xdg-mime", QStringList() << "default" << "opencor.desktop" << "x-scheme-handler/opencor");
exec("xdg-mime", { "default", "opencor.desktop", "x-scheme-handler/opencor" });
}
#else
#pragma clang diagnostic push
Expand Down Expand Up @@ -1031,7 +1031,7 @@ void MainWindow::handleArguments(const QStringList &pArguments)

static QString Opencor = "opencor";

QStringList arguments = QStringList();
QStringList arguments;

for (const auto &argument : pArguments) {
QUrl url = argument;
Expand Down
8 changes: 4 additions & 4 deletions src/misc/cliapplication.cpp
Expand Up @@ -137,7 +137,7 @@ void CliApplication::includePlugins(const QStringList &pPluginNames,

QString pluginsDir = QCoreApplication::libraryPaths().first()+"/"+qAppName();
QFileInfoList fileInfoList = QDir(pluginsDir).entryInfoList(QStringList("*"+PluginExtension), QDir::Files);
QStringList availablePluginNames = QStringList();
QStringList availablePluginNames;

for (const auto &fileInfo : fileInfoList) {
availablePluginNames << Plugin::name(fileInfo.canonicalFilePath());
Expand Down Expand Up @@ -345,7 +345,7 @@ void CliApplication::plugins() const

// First, we retrieve all the CLI plugins information

QStringList pluginsInfo = QStringList();
QStringList pluginsInfo;

for (auto plugin : mLoadedCliPlugins) {
// Retrieve the CLI plugin and its default description
Expand Down Expand Up @@ -403,7 +403,7 @@ void CliApplication::status() const

// First, we retrieve all the plugins information

QStringList pluginsInfo = QStringList();
QStringList pluginsInfo;

for (auto plugin : mPluginManager->plugins()) {
// Retrieve the plugin and its status
Expand Down Expand Up @@ -521,7 +521,7 @@ bool CliApplication::run(int &pRes)
Option option = NoOption;

QStringList appArguments = qApp->arguments();
QStringList arguments = QStringList();
QStringList arguments;

appArguments.removeFirst();
// Note: we remove the first argument since it corresponds to the full path
Expand Down
15 changes: 13 additions & 2 deletions src/misc/cliutils.cpp.inl
Expand Up @@ -202,7 +202,7 @@ QStringList canonicalFileNames(const QStringList &pFileNames)
// names themselves, if the canonical version of the given file names is
// empty (i.e. the files don't exist (anymore?))

QStringList res = QStringList();
QStringList res;

for (const auto &fileName : pFileNames) {
res << canonicalFileName(fileName);
Expand Down Expand Up @@ -657,7 +657,18 @@ QString nonDiacriticString(const QString &pString)
// http://stackoverflow.com/questions/14009522/how-to-remove-accents-diacritic-marks-from-a-string-in-qt

static QString diacriticLetters = QString::fromUtf8("ŠŒŽšœžŸ¥µÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýÿ");
static QStringList nonDiacriticLetters = QStringList() << "S" << "OE" << "Z" << "s" << "oe" << "z" << "Y" << "Y" << "u" << "A" << "A" << "A" << "A" << "A" << "A" << "AE" << "C" << "E" << "E" << "E" << "E" << "I" << "I" << "I" << "I" << "D" << "N" << "O" << "O" << "O" << "O" << "O" << "O" << "U" << "U" << "U" << "U" << "Y" << "s" << "a" << "a" << "a" << "a" << "a" << "a" << "ae" << "c" << "e" << "e" << "e" << "e" << "i" << "i" << "i" << "i" << "o" << "n" << "o" << "o" << "o" << "o" << "o" << "o" << "u" << "u" << "u" << "u" << "y" << "y";
static QStringList nonDiacriticLetters = { "S", "OE", "Z", "s", "oe", "z",
"Y", "Y", "u", "A", "A", "A",
"A", "A", "A", "AE", "C", "E",
"E", "E", "E", "I", "I", "I",
"I", "D", "N", "O", "O", "O",
"O", "O", "O", "U", "U", "U",
"U", "Y", "s", "a", "a", "a",
"a", "a", "a", "ae", "c", "e",
"e", "e", "e", "i", "i", "i",
"i", "o", "n", "o", "o", "o",
"o", "o", "o", "u", "u", "u",
"u", "y", "y" };

QString res;

Expand Down
4 changes: 2 additions & 2 deletions src/misc/furtherinitialize.cpp.inl
Expand Up @@ -72,7 +72,7 @@ QString Simulation::furtherInitialize() const
&& (QString::fromStdString(nlaSolverNode.getName()) == SEDMLSupport::NlaSolver)) {
#ifdef GUI_SUPPORT
SimulationExperimentViewInformationSolversWidgetData *nlaSolverData = solversWidget->nlaSolverData();
Core::Properties nlaSolverProperties = Core::Properties();
Core::Properties nlaSolverProperties;

#else
mustHaveNlaSolver = true;
Expand Down Expand Up @@ -171,7 +171,7 @@ QString Simulation::furtherInitialize() const

// Customise our graph panel and graphs

QIntList graphPanelsWidgetSizes = QIntList();
QIntList graphPanelsWidgetSizes;

for (int i = 0; i < newNbOfGraphPanels; ++i) {
// Customise our graph panel
Expand Down
2 changes: 1 addition & 1 deletion src/misc/initializesolver.cpp.inl
Expand Up @@ -12,7 +12,7 @@ QString Simulation::initializeSolver(const libsedml::SedListOfAlgorithmParameter

SolverInterface *solverInterface = nullptr;
#ifdef GUI_SUPPORT
Core::Properties solverProperties = Core::Properties();
Core::Properties solverProperties;
#endif

for (auto coreSolverInterface : Core::solverInterfaces()) {
Expand Down
Expand Up @@ -55,7 +55,7 @@ PLUGININFO_FUNC BioSignalMLDataStorePluginInfo()
descriptions.insert("fr", QString::fromUtf8("une extension de magasin de données spécifique à BioSignalML."));

return new PluginInfo(PluginInfo::Category::DataStore, true, false,
QStringList() << "DataStore" << "libBioSignalML",
{ "DataStore", "libBioSignalML" },
descriptions);
}

Expand Down Expand Up @@ -126,7 +126,7 @@ DataStore::DataStoreExportData * BioSignalMLDataStorePlugin::getExportData(const
// Now that we have the information we need, we can ask for the name of
// the BioSignalML file where to do the export

QStringList biosignalmlFilters = Core::filters(FileTypeInterfaces() << fileTypeInterface());
QStringList biosignalmlFilters = Core::filters({ fileTypeInterface() });
QString firstBiosignalmlFilter = biosignalmlFilters.first();
QString fileName = Core::getSaveFileName(tr("Export To BioSignalML"),
Core::newFileName(pFileName, tr("Data"), false, BiosignalmlFileExtension),
Expand Down
Expand Up @@ -76,15 +76,15 @@ void CsvDataStoreExporterWorker::run()
// is much faster than preventing ourselves from adding
// duplicates in the first place...

QList<DataStore::DataStoreVariables> variablesRuns = QList<DataStore::DataStoreVariables>();
QList<DataStore::DataStoreVariables> variablesRuns;

for (int i = 0, iMax = variables.count(); i < iMax; ++i) {
variablesRuns << DataStore::DataStoreVariables();
}

int nbOfRuns = dataStore->runsCount();
QList<quint64> runsIndex = QList<quint64>();
QDoubleList voiValues = QDoubleList();
QList<quint64> runsIndex;
QDoubleList voiValues;

for (int i = 0; i < nbOfRuns; ++i) {
// Original index for the current run
Expand Down Expand Up @@ -163,7 +163,7 @@ void CsvDataStoreExporterWorker::run()
}

bool firstRowData = true;
QBoolList updateRunsIndex = QBoolList();
QBoolList updateRunsIndex;

for (int j = 0; j < nbOfRuns; ++j) {
updateRunsIndex << false;
Expand Down
Expand Up @@ -50,7 +50,7 @@ PLUGININFO_FUNC CSVDataStorePluginInfo()
descriptions.insert("fr", QString::fromUtf8("une extension de magasin de données spécifique à CSV."));

return new PluginInfo(PluginInfo::Category::DataStore, true, false,
QStringList() << "DataStore",
{ "DataStore" },
descriptions);
}

Expand Down
4 changes: 2 additions & 2 deletions src/plugins/dataStore/DataStore/src/datastoredialog.cpp
Expand Up @@ -236,7 +236,7 @@ DataStoreVariables DataStoreDialog::selectedData(QStandardItem *pItem) const
{
// Return the selected data for the given item

DataStoreVariables res = DataStoreVariables();
DataStoreVariables res;

if (pItem->hasChildren()) {
for (int i = 0, iMax = pItem->rowCount(); i < iMax; ++i) {
Expand All @@ -255,7 +255,7 @@ DataStoreVariables DataStoreDialog::selectedData() const
{
// Return our selected data

DataStoreVariables res = DataStoreVariables();
DataStoreVariables res;

for (int i = 0, iMax = mModel->invisibleRootItem()->rowCount(); i < iMax; ++i) {
res << selectedData(mModel->invisibleRootItem()->child(i));
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/dataStore/DataStore/src/datastoreplugin.cpp
Expand Up @@ -39,7 +39,7 @@ PLUGININFO_FUNC DataStorePluginInfo()
descriptions.insert("fr", QString::fromUtf8("une extension qui fournit les fonctionalités de base d'un magasin de données."));

return new PluginInfo(PluginInfo::Category::DataStore, false, false,
QStringList() << "Core" << "PythonQtSupport",
{ "Core", "PythonQtSupport" },
descriptions);
}

Expand Down
10 changes: 5 additions & 5 deletions src/plugins/datastoreinterface.cpp
Expand Up @@ -908,13 +908,13 @@ DataStoreVariables DataStore::voiAndVariables()
// Return our VOI, if any, and all our variables, after making sure that
// they are sorted

DataStoreVariables res = DataStoreVariables();
DataStoreVariables variables;

res << mVoi << mVariables;
variables << mVoi << mVariables;

std::sort(res.begin(), res.end(), DataStoreVariable::compare);
std::sort(variables.begin(), variables.end(), DataStoreVariable::compare);

return res;
return variables;
}

//==============================================================================
Expand All @@ -923,7 +923,7 @@ DataStoreVariables DataStore::addVariables(double *pValues, int pCount)
{
// Add some variables to our data store

DataStoreVariables variables = DataStoreVariables();
DataStoreVariables variables;

for (int i = 0; i < pCount; ++i, ++pValues) {
variables << new DataStoreVariable(pValues);
Expand Down
Expand Up @@ -974,7 +974,7 @@ void CellmlAnnotationViewMetadataEditDetailsWidget::termLookedUp(QNetworkReply *
if (pNetworkReply->error() == QNetworkReply::NoError) {
// Parse the JSON data

QJsonParseError jsonParseError = QJsonParseError();
QJsonParseError jsonParseError;
QJsonDocument jsonDocument = QJsonDocument::fromJson(pNetworkReply->readAll(), &jsonParseError);

if (jsonParseError.error == QJsonParseError::NoError) {
Expand Down
Expand Up @@ -48,7 +48,7 @@ PLUGININFO_FUNC CellMLAnnotationViewPluginInfo()
descriptions.insert("fr", QString::fromUtf8(R"(une extension pour annoter des fichiers <a href="https://cellml.org/">CellML</a>.)"));

return new PluginInfo(PluginInfo::Category::Editing, true, false,
QStringList() << "CellMLSupport" << "WebViewerWidget",
{ "CellMLSupport", "WebViewerWidget" },
descriptions);
}

Expand Down Expand Up @@ -257,7 +257,7 @@ QStringList CellMLAnnotationViewPlugin::viewMimeTypes() const
{
// Return the MIME types we support

return QStringList() << CellMLSupport::CellmlMimeType;
return { CellMLSupport::CellmlMimeType };
}

//==============================================================================
Expand Down Expand Up @@ -329,7 +329,7 @@ QIcon CellMLAnnotationViewPlugin::fileTabIcon(const QString &pFileName) const

// We don't handle this interface...

static const QIcon NoIcon = QIcon();
static const QIcon NoIcon;

return NoIcon;
}
Expand Down
Expand Up @@ -68,11 +68,11 @@ void CellmlAnnotationViewWidget::loadSettings(QSettings &pSettings)
static const QRect AvailableGeometry = qApp->primaryScreen()->availableGeometry();
static const int AvailableGeometryWidth = AvailableGeometry.width();
static const int AvailableGeometryHeight = AvailableGeometry.height();
static const QVariantList DefaultEditingWidgetSizes = QVariantList() << 0.25*AvailableGeometryWidth
<< 0.75*AvailableGeometryWidth;
static const QVariantList DefaultMetadataDetailsWidgetSizes = QVariantList() << 0.25*AvailableGeometryHeight
<< 0.25*AvailableGeometryHeight
<< 0.50*AvailableGeometryHeight;
static const QVariantList DefaultEditingWidgetSizes = { 0.25*AvailableGeometryWidth,
0.75*AvailableGeometryWidth };
static const QVariantList DefaultMetadataDetailsWidgetSizes = { 0.25*AvailableGeometryHeight,
0.25*AvailableGeometryHeight,
0.50*AvailableGeometryHeight };

mEditingWidgetSizes = qVariantListToIntList(pSettings.value(SettingsCellmlAnnotationViewEditingWidgetSizes, DefaultEditingWidgetSizes).toList());
mMetadataDetailsWidgetSizes = qVariantListToIntList(pSettings.value(SettingsCellmlAnnotationViewMetadataDetailsWidgetSizes, DefaultMetadataDetailsWidgetSizes).toList());
Expand Down
Expand Up @@ -50,7 +50,7 @@ PLUGININFO_FUNC CellMLEditingViewPluginInfo()
descriptions.insert("fr", QString::fromUtf8(R"(une extension qui fournit les fonctionalités de base d'une vue d'édition <a href="https://cellml.org/">CellML</a>.)"));

return new PluginInfo(PluginInfo::Category::Editing, false, false,
QStringList() << "CellMLSupport" << "EditingView" << "MathMLViewerWidget",
{ "CellMLSupport", "EditingView", "MathMLViewerWidget" },
descriptions);
}

Expand Down
Expand Up @@ -113,9 +113,9 @@ void CellmlEditingViewWidget::loadSettings(QSettings &pSettings)
// Retrieve and set our sizes

static const int AvailableGeometryHeight = qApp->primaryScreen()->availableGeometry().height();
static const QVariantList DefaultEditingWidgetSizes = QVariantList() << 0.15*AvailableGeometryHeight
<< 0.76*AvailableGeometryHeight
<< 0.09*AvailableGeometryHeight;
static const QVariantList DefaultEditingWidgetSizes = { 0.15*AvailableGeometryHeight,
0.76*AvailableGeometryHeight,
0.09*AvailableGeometryHeight };

mEditingWidgetSizes = qVariantListToIntList(pSettings.value(SettingsCellmlEditingViewWidgetSizes, DefaultEditingWidgetSizes).toList());

Expand Down

0 comments on commit 23d4c2f

Please sign in to comment.