Skip to content

Commit

Permalink
Merge d26cc90 into 9e64a28
Browse files Browse the repository at this point in the history
  • Loading branch information
agarny committed Aug 13, 2018
2 parents 9e64a28 + d26cc90 commit a9138d0
Show file tree
Hide file tree
Showing 12 changed files with 348 additions and 72 deletions.
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -587,6 +587,7 @@ configure_file(${CMAKE_SOURCE_DIR}/res/i18n.qrc.in

set(SOURCES
src/checkforupdatesdialog.cpp
src/generalpreferenceswidget.cpp
src/main.cpp
src/mainwindow.cpp
src/pluginsdialog.cpp
Expand Down Expand Up @@ -617,6 +618,7 @@ set(SOURCES

set(HEADERS_MOC
src/checkforupdatesdialog.h
src/generalpreferenceswidget.h
src/mainwindow.h
src/pluginsdialog.h
src/preferencesdialog.h
Expand All @@ -635,6 +637,7 @@ set(HEADERS_MOC

set(UIS
src/checkforupdatesdialog.ui
src/generalpreferenceswidget.ui
src/mainwindow.ui
src/pluginsdialog.ui
src/preferencesdialog.ui
Expand Down Expand Up @@ -690,6 +693,7 @@ endif()
# Core CLI/GUI utilities)...

include_directories(
src
src/misc
src/plugins
src/plugins/miscellaneous/Core/src
Expand Down
2 changes: 1 addition & 1 deletion doc/downloads/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ var jsonData = { "versions": [
}
],
"changes": [
{ "change": "<strong>General:</strong> Clang code model related cleaning up (see issue <a href=\"https://github.com/opencor/opencor/issues/1747\">#1747</a>)." },
{ "change": "<strong>General:</strong> Clang code model related cleaning up (see issue <a href=\"https://github.com/opencor/opencor/issues/1747\">#1747</a>). Allow the use of another Qt style (see issue <a href=\"https://github.com/opencor/opencor/issues/1761\">#1761</a>)." },
{ "change": "<strong>Core plugin:</strong> fixed a problem with the menu items for recently opened files potentially appearing as disabled on macOS (see issue <a href=\"https://github.com/opencor/opencor/issues/1633\">#1633</a>)." },
{ "change": "<strong>Third-party libraries:</strong> upgraded the <a href=\"http://computation.llnl.gov/projects/sundials\">SUNDIALS</a> library to version 3.1.2 (see issue <a href=\"https://github.com/opencor/opencor/issues/1743\">#1743</a>). Upgraded <a href=\"https://www.openssl.org/\">OpenSSL</a> to version 1.1.0h (see issue <a href=\"https://github.com/opencor/opencor/issues/1751\">#1751</a>). Renamed our BioSignalML plugin to libBioSignalML (see issue <a href=\"https://github.com/opencor/opencor/issues/1754\">#1754</a>)." }
]
Expand Down
31 changes: 21 additions & 10 deletions i18n/OpenCOR_fr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@
<translation>Inclure les snapshots</translation>
</message>
</context>
<context>
<name>GeneralPreferencesWidget</name>
<message>
<source>Style</source>
<translation></translation>
</message>
</context>
<context>
<name>MainWindow</name>
<message>
Expand Down Expand Up @@ -142,14 +149,6 @@
<source>Show/hide all the recent/current docked windows</source>
<translation>Montrer/cacher toutes les fenêtres ancrées récentes/actuelles</translation>
</message>
<message>
<source>Check For Updates...</source>
<translation>Vérifier Pour Des Mises À Jour...</translation>
</message>
<message>
<source>Check for updates</source>
<translation>Vérifier pour des mises à jour</translation>
</message>
<message>
<source>&amp;Preferences...</source>
<translation>&amp;Préférences...</translation>
Expand All @@ -162,6 +161,14 @@
<source>Preferences for OpenCOR and its plugins</source>
<translation>Préférences pour OpenCOR et ses extensions</translation>
</message>
<message>
<source>Check For Updates...</source>
<translation>Vérifier Pour Des Mises À Jour...</translation>
</message>
<message>
<source>Check for updates</source>
<translation>Vérifier pour des mises à jour</translation>
</message>
</context>
<context>
<name>OpenCOR::CheckForUpdatesDialog</name>
Expand Down Expand Up @@ -314,13 +321,17 @@
</context>
<context>
<name>OpenCOR::PreferencesDialog</name>
<message>
<source>Reset</source>
<translation>Réinitialiser</translation>
</message>
<message>
<source>Reset All</source>
<translation>Tout Réinitialiser</translation>
</message>
<message>
<source>Reset Plugin</source>
<translation>Réinitialiser Extension</translation>
<source>General</source>
<translation>Général</translation>
</message>
<message>
<source>%1.</source>
Expand Down
111 changes: 111 additions & 0 deletions src/generalpreferenceswidget.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
/*******************************************************************************
Copyright (C) The University of Auckland
OpenCOR is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenCOR is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*******************************************************************************/

//==============================================================================
// General preferences widget
//==============================================================================

#include "generalpreferenceswidget.h"

//==============================================================================

#include "ui_generalpreferenceswidget.h"

//==============================================================================

#include <QApplication>
#include <QSettings>
#include <QStyleFactory>

//==============================================================================

namespace OpenCOR {

//==============================================================================

GeneralPreferencesWidget::GeneralPreferencesWidget(QWidget *pParent) :
Preferences::PreferencesWidget(Preferences::GeneralPreferences, pParent),
mGui(new Ui::GeneralPreferencesWidget)
{
// Set up the GUI

mGui->setupUi(this);

QStringList styles = QStyleFactory::keys();

styles.sort();

mGui->styleValue->addItems(styles);

mStyle = mSettings->value(SettingsPreferencesStyle, SettingsPreferencesStyleDefault).toString();

mGui->styleValue->setCurrentText(mStyle);

setFocusProxy(mGui->styleValue);
}

//==============================================================================

GeneralPreferencesWidget::~GeneralPreferencesWidget()
{
// Delete the GUI

delete mGui;
}

//==============================================================================

bool GeneralPreferencesWidget::preferencesChanged() const
{
// Return whether our preferences have changed

return mGui->styleValue->currentText().compare(mStyle);
}

//==============================================================================

void GeneralPreferencesWidget::resetPreferences()
{
// Reset our preferences

mGui->styleValue->setCurrentText(SettingsPreferencesStyleDefault);
}

//==============================================================================

void GeneralPreferencesWidget::savePreferences()
{
// Save our preferences

QString style = mGui->styleValue->currentText();

mSettings->setValue(SettingsPreferencesStyle, style);

// Update our style

QApplication::setStyle(style);
}

//==============================================================================

} // namespace OpenCOR

//==============================================================================
// End of file
//==============================================================================
83 changes: 83 additions & 0 deletions src/generalpreferenceswidget.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
/*******************************************************************************
Copyright (C) The University of Auckland
OpenCOR is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenCOR is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*******************************************************************************/

//==============================================================================
// General preferences widget
//==============================================================================

#pragma once

//==============================================================================

#include "preferencesinterface.h"

//==============================================================================

namespace Ui {
class GeneralPreferencesWidget;
} // namespace Ui

//==============================================================================

namespace OpenCOR {

//==============================================================================

static const auto SettingsPreferencesStyle = QStringLiteral("Style");

//==============================================================================

#if defined(Q_OS_WIN)
static const auto SettingsPreferencesStyleDefault = QStringLiteral("WindowsVista");
#elif defined(Q_OS_LINUX)
static const auto SettingsPreferencesStyleDefault = QStringLiteral("Fusion");
#elif defined(Q_OS_MAC)
static const auto SettingsPreferencesStyleDefault = QStringLiteral("Macintosh");
#else
#error Unsupported platform
#endif

//==============================================================================

class GeneralPreferencesWidget : public Preferences::PreferencesWidget
{
Q_OBJECT

public:
explicit GeneralPreferencesWidget(QWidget *pParent);
~GeneralPreferencesWidget() override;

bool preferencesChanged() const override;

void resetPreferences() override;
void savePreferences() override;

private:
Ui::GeneralPreferencesWidget *mGui;

QString mStyle;
};

//==============================================================================

} // namespace OpenCOR

//==============================================================================
// End of file
//==============================================================================
48 changes: 48 additions & 0 deletions src/generalpreferenceswidget.ui
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>GeneralPreferencesWidget</class>
<widget class="QWidget" name="GeneralPreferencesWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<layout class="QVBoxLayout" name="layout" stretch="0">
<item>
<layout class="QFormLayout" name="formLayout">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::ExpandingFieldsGrow</enum>
</property>
<item row="0" column="0">
<widget class="QLabel" name="styleLabel">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Style</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="styleValue">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>
8 changes: 8 additions & 0 deletions src/misc/guiapplication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// GUI application
//==============================================================================

#include "generalpreferenceswidget.h"
#include "guiapplication.h"
#include "preferencesinterface.h"

//==============================================================================

Expand All @@ -40,6 +42,12 @@ GuiApplication::GuiApplication(int &pArgC, char **pArgV) :
mCanEmitFileOpenRequestSignal(false),
mFileNamesOrOpencorUrls(QStringList())
{
// Set our style

QApplication::setStyle(PreferencesInterface::preference(Preferences::GeneralPreferences,
SettingsPreferencesStyle,
SettingsPreferencesStyleDefault).toString());

// Filter out OpenSSL warning messages

QLoggingCategory::setFilterRules("qt.network.ssl.warning=false");
Expand Down

0 comments on commit a9138d0

Please sign in to comment.