Commit 0aaff70f authored by Alexander Semke's avatar Alexander Semke
Browse files

Redesigned settings widget for Octave.

parent 30bd1389
......@@ -8,6 +8,8 @@ set( OctaveBackend_SRCS
octavecompletionobject.cpp
octavesyntaxhelpobject.cpp
octavevariablemodel.cpp
octavesettingswidget.cpp
../backendsettingswidget.cpp
)
add_subdirectory(scripts)
......@@ -19,36 +21,32 @@ if (WITH_EPS)
else (WITH_EPS)
set(DEFAULT_PLOT_FORMAT "png")
endif (WITH_EPS)
configure_file(octavebackend.kcfg.in ${CMAKE_CURRENT_BINARY_DIR}/octavebackend.kcfg)
configure_file(settings.ui.in ${CMAKE_CURRENT_BINARY_DIR}/settings.ui)
kconfig_add_kcfg_files(OctaveBackend_SRCS settings.kcfgc)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/octavebackend.kcfg DESTINATION ${KDE_INSTALL_KCFGDIR})
install(FILES octavebackend.kcfg DESTINATION ${KDE_INSTALL_KCFGDIR})
ki18n_wrap_ui(OctaveBackend_SRCS ${CMAKE_CURRENT_BINARY_DIR}/settings.ui)
ki18n_wrap_ui(OctaveBackend_SRCS settings.ui)
add_backend(octavebackend ${OctaveBackend_SRCS})
target_link_libraries(cantor_octavebackend
target_link_libraries(cantor_octavebackend cantor_help
KF5::KIOCore
KF5::ConfigCore
KF5::ConfigGui
KF5::SyntaxHighlighting
)
if(BUILD_TESTING)
add_executable( testoctave testoctave.cpp ${OctaveBackend_SRCS})
add_test(NAME testoctave COMMAND testoctave)
ecm_mark_as_test(testoctave)
target_link_libraries( testoctave
Qt5::Test
KF5::SyntaxHighlighting
cantorlibs
cantortest
cantor_help
)
endif(BUILD_TESTING)
endif()
install(FILES cantor_octave.knsrc DESTINATION ${KDE_INSTALL_CONFDIR} )
install(FILES graphic_packages.xml DESTINATION ${KDE_INSTALL_DATADIR}/cantor/octave)
......@@ -16,14 +16,14 @@
---
Copyright (C) 2010 Miha Čančula <miha.cancula@gmail.com>
Copyright (C) 2019 Alexander Semke <alexander.semke@web.de>
Copyright (C) 2019-2020 Alexander Semke <alexander.semke@web.de>
*/
#include "octavebackend.h"
#include "octaveextensions.h"
#include "octavesession.h"
#include "octavesettingswidget.h"
#include "settings.h"
#include "ui_settings.h"
OctaveBackend::OctaveBackend(QObject* parent, const QList<QVariant>& args): Backend(parent, args)
{
......@@ -87,10 +87,7 @@ QString OctaveBackend::description() const
QWidget* OctaveBackend::settingsWidget(QWidget* parent) const
{
QWidget* widget = new QWidget(parent);
Ui::OctaveSettingsBase ui;
ui.setupUi(widget);
return widget;
return new OctaveSettingsWidget(parent, id());
}
KConfigSkeleton* OctaveBackend::config() const
......
/*
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, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
---
Copyright (C) 2020 Alexander Semke <alexander.semke@web.de>
*/
#include "octavesettingswidget.h"
OctaveSettingsWidget::OctaveSettingsWidget(QWidget* parent, const QString& id) : BackendSettingsWidget(parent, id)
{
setupUi(this);
m_tabWidget = tabWidget;
m_tabDocumentation = tabDocumentation;
connect(tabWidget, &QTabWidget::currentChanged, this, &BackendSettingsWidget::tabChanged);
}
/*
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, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
---
Copyright (C) 2020 Alexander Semke <alexander.semke@web.de>
*/
#ifndef OCTAVESETTINGSWIDGET_H
#define OCTAVESETTINGSWIDGET_H
#include "ui_settings.h"
#include "../backendsettingswidget.h"
class OctaveSettingsWidget : public BackendSettingsWidget, public Ui::OctaveSettingsBase
{
Q_OBJECT
public:
explicit OctaveSettingsWidget(QWidget* parent = nullptr, const QString& id = QString());
};
#endif /* OCTAVESETTINGSWIDGET_H */
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>OctaveSettingsBase</class>
<widget class="QWidget" name="OctaveSettingsBase">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>420</width>
<height>302</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="tabGeneral">
<attribute name="title">
<string>General</string>
</attribute>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Executable:</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="KUrlRequester" name="kcfg_Path"/>
</item>
<item row="1" column="0" colspan="2">
<widget class="QLabel" name="label2">
<property name="text">
<string>Documentation:</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="KUrlRequester" name="kcfg_localDoc">
<property name="toolTip">
<string>If empty, the &quot;Show help&quot; action will show the default online documentation. Otherwise, the specified URL will be opened.</string>
</property>
</widget>
</item>
<item row="2" column="0" colspan="2">
<widget class="QLabel" name="lPlotIntegration">
<property name="text">
<string>Plot Integration:</string>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QCheckBox" name="kcfg_integratePlots">
<property name="toolTip">
<string>If enabled, plots will be shown inside of the worksheet. Otherwise, plots will be shown in an external window.</string>
</property>
<property name="text">
<string>Enabled</string>
</property>
</widget>
</item>
<item row="3" column="0" colspan="2">
<widget class="QLabel" name="lVariableManagement">
<property name="text">
<string>Variable Management:</string>
</property>
</widget>
</item>
<item row="3" column="2">
<widget class="QCheckBox" name="kcfg_variableManagement">
<property name="toolTip">
<string>Monitor the creation and destruction of variables and show the existing variables in the variable panel.</string>
</property>
<property name="text">
<string>Enabled</string>
</property>
</widget>
</item>
<item row="4" column="0" colspan="2">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Internal Plot Format:</string>
</property>
</widget>
</item>
<item row="4" column="2">
<widget class="QComboBox" name="kcfg_inlinePlotFormat">
<item>
<property name="text">
<string notr="true">png</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">svg</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">jpeg</string>
</property>
</item>
</widget>
</item>
<item row="5" column="1">
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>44</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<widget class="QWidget" name="tabAutorun">
<attribute name="title">
<string>Autorun</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="lAutorun">
<property name="text">
<string>Commands to autorun</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="KEditListWidget" name="kcfg_autorunScripts"/>
</item>
</layout>
</widget>
<widget class="QWidget" name="tabDocumentation">
<attribute name="title">
<string>Documentation</string>
</attribute>
</widget>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>KUrlRequester</class>
<extends>QWidget</extends>
<header>kurlrequester.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>KEditListWidget</class>
<extends>QWidget</extends>
<header>keditlistwidget.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>OctaveSettingsBase</class>
<widget class="QWidget" name="OctaveSettingsBase">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>416</width>
<height>499</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0" colspan="2">
<widget class="QLabel" name="label">
<property name="text">
<string>Executable:</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="KUrlRequester" name="kcfg_Path"/>
</item>
<item row="1" column="0" colspan="2">
<widget class="QLabel" name="label2">
<property name="text">
<string>Documentation:</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="KUrlRequester" name="kcfg_localDoc">
<property name="toolTip">
<string>If empty, the &quot;Show help&quot; action will show the default online documentation. Otherwise, the specified URL will be opened.</string>
</property>
</widget>
</item>
<item row="2" column="0" colspan="2">
<widget class="QLabel" name="lPlotIntegration">
<property name="text">
<string>Plot Integration:</string>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QCheckBox" name="kcfg_integratePlots">
<property name="toolTip">
<string>If enabled, plots will be shown inside of the worksheet. Otherwise, plots will be shown in an external window.</string>
</property>
<property name="text">
<string>Enabled</string>
</property>
</widget>
</item>
<item row="3" column="0" colspan="2">
<widget class="QLabel" name="lVariableManagement">
<property name="text">
<string>Variable Management:</string>
</property>
</widget>
</item>
<item row="3" column="2">
<widget class="QCheckBox" name="kcfg_variableManagement">
<property name="toolTip">
<string>Monitor the creation and destruction of variables and show the existing variables in the variable panel.</string>
</property>
<property name="text">
<string>Enabled</string>
</property>
</widget>
</item>
<item row="4" column="0" colspan="2">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Internal Plot Format:</string>
</property>
</widget>
</item>
<item row="4" column="2">
<widget class="QComboBox" name="kcfg_inlinePlotFormat">
<item>
<property name="text">
<string notr="true">png</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">svg</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">jpeg</string>
</property>
</item>
</widget>
</item>
<item row="5" column="1">
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="6" column="0" colspan="3">
<widget class="QGroupBox" name="groupBox">
<property name="toolTip">
<string>Commands to automatically run on start. They can be useful for loading needed modules, changing environment, etc.</string>
</property>
<property name="title">
<string>Commands to autorun</string>
</property>
<layout class="QVBoxLayout" name="verticalLayoutScripts">
<item>
<widget class="KEditListWidget" name="kcfg_autorunScripts"/>
</item>
</layout>
</widget>
</item>
<item row="7" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>KUrlRequester</class>
<extends>QWidget</extends>
<header>kurlrequester.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>KEditListWidget</class>
<extends>QWidget</extends>
<header>keditlistwidget.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment