Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SofaGuiQt] Add new about window UI and url redirect #1801

Merged
merged 5 commits into from
Feb 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions modules/SofaGuiQt/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ endif()
set(SRC_ROOT src/sofa/gui/qt)

set(MOC_HEADER_FILES
${SRC_ROOT}/AboutSOFADialog.h
${SRC_ROOT}/AddObject.h
${SRC_ROOT}/DataFilenameWidget.h
${SRC_ROOT}/DataWidget.h
Expand Down Expand Up @@ -124,6 +125,7 @@ set(HEADER_FILES
${SRC_ROOT}/GenericWidget.h
)
set(SOURCE_FILES
${SRC_ROOT}/AboutSOFADialog.cpp
${SRC_ROOT}/AddObject.cpp
${SRC_ROOT}/DataFilenameWidget.cpp
${SRC_ROOT}/DataWidget.cpp
Expand Down Expand Up @@ -161,6 +163,7 @@ set(SOURCE_FILES
${SRC_ROOT}/viewer/VisualModelPolicy.cpp
)
set(UI_FILES
${SRC_ROOT}/AboutDialog.ui
${SRC_ROOT}/BaseGenGraphForm.ui
${SRC_ROOT}/DialogAddObject.ui
${SRC_ROOT}/GUI.ui
Expand Down
209 changes: 209 additions & 0 deletions modules/SofaGuiQt/src/sofa/gui/qt/AboutDialog.ui
Original file line number Diff line number Diff line change
@@ -0,0 +1,209 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>AboutDialog</class>
<widget class="QDialog" name="AboutDialog">
<property name="enabled">
<bool>true</bool>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>464</width>
<height>543</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Ignored" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle">
<string>About</string>
</property>
<property name="sizeGripEnabled">
<bool>false</bool>
</property>
<property name="modal">
<bool>false</bool>
</property>
<layout class="QGridLayout">
<property name="sizeConstraint">
<enum>QLayout::SetFixedSize</enum>
</property>
<item row="1" column="0" rowspan="2">
<widget class="QGroupBox" name="buttonGroup">
<property name="title">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="flat">
<bool>false</bool>
</property>
<layout class="QGridLayout">
<item row="1" column="0">
<widget class="QLabel" name="label">
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="accessibleDescription">
<string/>
</property>
<property name="text">
<string>SOFA is an open-source framework for interactive physics simulation, with an emphasis on soft body dynamics. After years of research and development, the project remains open-source under the LGPL v2.1 license, fostering both research and development.</string>
</property>
<property name="scaledContents">
<bool>false</bool>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Open-source is kept thriving thanks to partners supporting us: be part of the community and get involved your own way!</string>
</property>
<property name="textFormat">
<enum>Qt::AutoText</enum>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_2">
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="accessibleDescription">
<string/>
</property>
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="text">
<string/>
</property>
<property name="textFormat">
<enum>Qt::PlainText</enum>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="wordWrap">
<bool>false</bool>
</property>
<property name="margin">
<number>0</number>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="5" column="0">
<layout class="QHBoxLayout">
<item>
<spacer name="Horizontal Spacing2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="buttonOk">
<property name="minimumSize">
<size>
<width>150</width>
<height>40</height>
</size>
</property>
<property name="text">
<string>Support us</string>
</property>
<property name="autoRepeat">
<bool>false</bool>
</property>
<property name="autoDefault">
<bool>true</bool>
</property>
<property name="default">
<bool>true</bool>
</property>
<property name="flat">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>SOFA, Simulation Open-Framework Architecture (c) 2006 INRIA, USTL, UJF, CNRS, MGH</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
<layoutdefault spacing="6" margin="11"/>
<resources/>
<connections>
<connection>
<sender>buttonOk</sender>
<signal>clicked()</signal>
<receiver>AboutDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>223</x>
<y>226</y>
</hint>
<hint type="destinationlabel">
<x>20</x>
<y>20</y>
</hint>
</hints>
</connection>
</connections>
</ui>
57 changes: 57 additions & 0 deletions modules/SofaGuiQt/src/sofa/gui/qt/AboutSOFADialog.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/******************************************************************************
* SOFA, Simulation Open-Framework Architecture *
* (c) 2006 INRIA, USTL, UJF, CNRS, MGH *
* *
* This program 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 2 of the License, or (at your option) *
* any later version. *
* *
* This program 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/>. *
*******************************************************************************
* Authors: The SOFA Team and external contributors (see Authors.txt) *
* *
* Contact information: contact@sofa-framework.org *
******************************************************************************/
#include "AboutSOFADialog.h"
#include <sofa/gui/BaseGUI.h>

#include <QPushButton>
#include <QDesktopServices>
#include <QUrl>

#include <sofa/helper/system/FileRepository.h>
using sofa::helper::system::DataRepository;

namespace sofa::gui::qt
{

AboutSOFADialog::AboutSOFADialog(QWidget *parent)
: QDialog(parent)
{
setupUi(this);
// SLOTS CONNECTION
this->connect(buttonOk, SIGNAL(clicked() ), this, SLOT( clickSupportUs() ));

std::string file = "icons/AboutSOFA.png";
if (DataRepository.findFile(file))
{
QPixmap pix(QPixmap::fromImage(QImage(DataRepository.getFile ( file ).c_str())));
label_2->setPixmap(pix);
}
}


void AboutSOFADialog::clickSupportUs()
{
QDesktopServices::openUrl(QUrl("https://www.sofa-framework.org/consortium/support-us/"));
}


} // namespace sofa::gui::qt
41 changes: 41 additions & 0 deletions modules/SofaGuiQt/src/sofa/gui/qt/AboutSOFADialog.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/******************************************************************************
* SOFA, Simulation Open-Framework Architecture *
* (c) 2006 INRIA, USTL, UJF, CNRS, MGH *
* *
* This program 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 2 of the License, or (at your option) *
* any later version. *
* *
* This program 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/>. *
*******************************************************************************
* Authors: The SOFA Team and external contributors (see Authors.txt) *
* *
* Contact information: contact@sofa-framework.org *
******************************************************************************/
#pragma once
#include <ui_AboutDialog.h>
#include <sofa/gui/qt/config.h>


namespace sofa::gui::qt
{

class SOFA_SOFAGUIQT_API AboutSOFADialog: public QDialog, public Ui_AboutDialog
{
Q_OBJECT
public:
AboutSOFADialog(QWidget *parent);

public slots:
void clickSupportUs();
};


} // namespace sofa::gui::qt
35 changes: 19 additions & 16 deletions modules/SofaGuiQt/src/sofa/gui/qt/GUI.ui
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
<x>0</x>
<y>0</y>
<width>800</width>
<height>21</height>
<height>22</height>
</rect>
</property>
<widget class="QMenu" name="fileMenu">
Expand Down Expand Up @@ -710,7 +710,7 @@
</action>
<action name="helpAboutAction">
<property name="enabled">
<bool>false</bool>
<bool>true</bool>
</property>
<property name="text">
<string>&amp;About</string>
Expand All @@ -721,6 +721,9 @@
<property name="shortcut">
<string/>
</property>
<property name="iconVisibleInMenu">
<bool>false</bool>
</property>
<property name="name" stdset="0">
<cstring>helpAboutAction</cstring>
</property>
Expand Down Expand Up @@ -978,20 +981,20 @@
</hints>
</connection>
<connection>
<sender>DataGraphAction</sender>
<signal>triggered()</signal>
<receiver>GUI</receiver>
<slot>showWindowDataGraph()</slot>
<hints>
<hint type="sourcelabel">
<x>-1</x>
<y>-1</y>
</hint>
<hint type="destinationlabel">
<x>20</x>
<y>20</y>
</hint>
</hints>
<sender>DataGraphAction</sender>
<signal>triggered()</signal>
<receiver>GUI</receiver>
<slot>showWindowDataGraph()</slot>
<hints>
<hint type="sourcelabel">
<x>-1</x>
<y>-1</y>
</hint>
<hint type="destinationlabel">
<x>20</x>
<y>20</y>
</hint>
</hints>
</connection>
<connection>
<sender>editGnuplotDirectoryAction</sender>
Expand Down
Loading