Commit c5ed784d authored by Alexander Semke's avatar Alexander Semke
Browse files

Redesigned settings widgets for R and Julia.

parent 125bca5f
......@@ -21,7 +21,7 @@ set(cantor_HELP
ki18n_wrap_ui(cantor_HELP qthelpconfig.ui)
ki18n_wrap_ui(cantor_HELP qthelpconfigeditdialog.ui)
add_library(cantor_help STATIC ${cantor_HELP} backendsettingswidget.cpp)
add_library(cantor_help STATIC ${cantor_HELP})
target_link_libraries(cantor_help KF5::SyntaxHighlighting KF5::I18n KF5::IconThemes KF5::NewStuff KF5::KIOWidgets Qt5::Help)
if(NOT WIN32)
......
......@@ -13,6 +13,7 @@ set( RBackend_SRCS
rkeywords.cpp
rsettingswidget.cpp
rvariablemodel.cpp
../backendsettingswidget.cpp
)
kconfig_add_kcfg_files(RBackend_SRCS rserver/settings.kcfgc)
......@@ -25,7 +26,7 @@ ki18n_wrap_ui(RBackend_SRCS settings.ui)
add_backend(rbackend ${RBackend_SRCS})
set_target_properties( cantor_rbackend PROPERTIES INSTALL_RPATH_USE_LINK_PATH false)
target_link_libraries( cantor_rbackend ${R_USED_LIBS} KF5::SyntaxHighlighting)
target_link_libraries( cantor_rbackend cantor_help ${R_USED_LIBS} KF5::SyntaxHighlighting)
if(BUILD_TESTING)
add_executable( testr testr.cpp)
......
......@@ -76,7 +76,7 @@ bool RBackend::requirementsFullfilled(QString* const reason) const
QWidget* RBackend::settingsWidget(QWidget* parent) const
{
return new RSettingsWidget(parent);
return new RSettingsWidget(parent, id());
}
KConfigSkeleton* RBackend::config() const
......
......@@ -16,18 +16,24 @@
---
Copyright (C) 2010 Oleksiy Protas <elfy.ua@gmail.com>
Copyright (C) 2020 Alexander Semke <alexander.semke@web.de>
*/
#include "rsettingswidget.h"
#include <QGroupBox>
#include <KLineEdit>
#include <QFileDialog>
#include <KLocalizedString>
#include <QLineEdit>
#include <QMouseEvent>
#include <KLocalizedString>
RSettingsWidget::RSettingsWidget(QWidget *parent) : QWidget(parent)
RSettingsWidget::RSettingsWidget(QWidget *parent, const QString& id) : BackendSettingsWidget(parent, id)
{
setupUi(this);
m_tabWidget = tabWidget;
m_tabDocumentation = tabDocumentation;
connect(tabWidget, &QTabWidget::currentChanged, this, &BackendSettingsWidget::tabChanged);
kcfg_autorunScripts->lineEdit()->setReadOnly(true);
kcfg_autorunScripts->lineEdit()->installEventFilter(this);
kcfg_autorunScripts->lineEdit()->setToolTip(i18n("Double click to open file selection dialog"));
......
......@@ -16,19 +16,21 @@
---
Copyright (C) 2010 Oleksiy Protas <elfy.ua@gmail.com>
Copyright (C) 2020 Alexander Semke <alexander.semke@web.de>
*/
#ifndef _RSETTINGSWIDGET_H
#define _RSETTINGSWIDGET_H
#include "ui_settings.h"
#include "../backendsettingswidget.h"
class RSettingsWidget : public QWidget,public Ui::RSettingsBase
class RSettingsWidget : public BackendSettingsWidget, public Ui::RSettingsBase
{
Q_OBJECT
public:
explicit RSettingsWidget(QWidget *parent = nullptr);
explicit RSettingsWidget(QWidget* parent = nullptr, const QString& id = QString());
bool eventFilter(QObject*, QEvent*) override;
public Q_SLOTS:
......
......@@ -6,91 +6,115 @@
<rect>
<x>0</x>
<y>0</y>
<width>416</width>
<height>380</height>
<width>435</width>
<height>302</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="label2">
<property name="toolTip">
<string/>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
<number>0</number>
</property>
<property name="text">
<string>Documentation:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<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="1" column="0">
<widget class="QLabel" name="lPlotIntegration">
<property name="text">
<string>Plot Integration:</string>
</property>
</widget>
</item>
<item row="1" column="1" rowspan="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>Integrate Plots in Worksheet</string>
</property>
</widget>
</item>
<item row="2" column="0" rowspan="2">
<widget class="QLabel" name="lVariableManagement">
<property name="text">
<string>Variable Management:</string>
</property>
</widget>
</item>
<item row="3" column="1">
<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>Enable Variable Management</string>
</property>
</widget>
</item>
<item row="4" column="0">
<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="5" column="0" colspan="2">
<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 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="label2">
<property name="toolTip">
<string/>
</property>
<property name="text">
<string>Documentation:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<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="1" column="0">
<widget class="QLabel" name="lPlotIntegration">
<property name="text">
<string>Plot Integration:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<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>Integrate Plots in Worksheet</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="lVariableManagement">
<property name="text">
<string>Variable Management:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<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>Enable Variable Management</string>
</property>
</widget>
</item>
<item row="3" column="0">
<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>130</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>
......
......@@ -11,6 +11,8 @@ set(JuliaBackend_SRCS
juliahighlighter.cpp
juliaextensions.cpp
juliacompletionobject.cpp
juliasettingswidget.cpp
../backendsettingswidget.cpp
)
kconfig_add_kcfg_files(JuliaBackend_SRCS settings.kcfgc)
......@@ -18,7 +20,7 @@ ki18n_wrap_ui(JuliaBackend_SRCS settings.ui)
add_backend(juliabackend ${JuliaBackend_SRCS})
target_link_libraries(cantor_juliabackend
target_link_libraries(cantor_juliabackend cantor_help
${JULIA_LIBRARY}
Qt5::DBus
KF5::SyntaxHighlighting
......
......@@ -16,14 +16,14 @@
---
Copyright (C) 2016 Ivan Lakhtanov <ivan.lakhtanov@gmail.com>
Copyright (C) 2019 Alexander Semke <alexander.semke@web.de>
Copyright (C) 2019-2020 Alexander Semke <alexander.semke@web.de>
*/
#include "juliabackend.h"
#include "juliaextensions.h"
#include "juliasession.h"
#include "juliasettingswidget.h"
#include "settings.h"
#include "ui_settings.h"
#include <QProcess>
......@@ -149,10 +149,7 @@ bool JuliaBackend::requirementsFullfilled(QString* const reason) const
QWidget* JuliaBackend::settingsWidget(QWidget *parent) const
{
QWidget* widget = new QWidget(parent);
Ui::JuliaSettingsBase s;
s.setupUi(widget);
return widget;
return new JuliaSettingsWidget(parent, id());
}
KConfigSkeleton* JuliaBackend::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 "juliasettingswidget.h"
JuliaSettingsWidget::JuliaSettingsWidget(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 JULIASETTINGSWIDGET_H
#define JULIASETTINGSWIDGET_H
#include "ui_settings.h"
#include "../backendsettingswidget.h"
class JuliaSettingsWidget : public BackendSettingsWidget, public Ui::JuliaSettingsBase
{
Q_OBJECT
public:
explicit JuliaSettingsWidget(QWidget* parent = nullptr, const QString& id = QString());
};
#endif /* JULIASETTINGSWIDGET_H */
......@@ -6,132 +6,171 @@
<rect>
<x>0</x>
<y>0</y>
<width>609</width>
<height>227</height>
<width>485</width>
<height>302</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0" rowspan="2">
<widget class="QLabel" name="label">
<property name="text">
<string>Path to Julia:</string>
<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>Path to Julia:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="KUrlRequester" name="kcfg_replPath"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="lPlotIntegration">
<property name="text">
<string>Plot Integration:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<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="2" column="0">
<widget class="QLabel" name="lVariableManagement">
<property name="text">
<string>Variable Management:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<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="3" column="0">
<widget class="QLabel" name="label2">
<property name="text">
<string>Internal Plot Format:</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QComboBox" name="kcfg_inlinePlotFormat">
<property name="toolTip">
<string>Inner format of plots, if plots embedding is enabled.</string>
</property>
<item>
<property name="text">
<string notr="true">svg</string>
</property>
</item>
<item>
<property name="text">
<string notr="true">png</string>
</property>
</item>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label3">
<property name="toolTip">
<string>Graphic package, which code will be used for plotting via &quot;Plot&quot; Cantor menu.</string>
</property>
<property name="text">
<string>Graphic Package for &quot;Plot&quot;-assistant</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="KComboBox" name="kcfg_plotExtenstionGraphicPackage">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<item>
<property name="text">
<string>GR</string>
</property>
</item>
<item>
<property name="text">
<string>Plots</string>
</property>
</item>
<item>
<property name="text">
<string>PyPlot</string>
</property>
</item>
<item>
<property name="text">
<string>Gadfly</string>
</property>
</item>
</widget>
</item>
<item row="5" column="0">
<spacer name="verticalSpacer1">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>46</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>
<item row="2" column="0">
<widget class="QLabel" name="lPlotIntegration">
<property name="text">
<string>Plot Integration:</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="lVariableManagement">
<property name="text">
<string>Variable Management:</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label2">
<property name="text">
<string>Internal Plot Format:</string>
</property>
</widget>
</item>
<item row="5" column="0" colspan="2">
<widget class="QLabel" name="label3">
<property name="toolTip">
<string>Graphic package, which code will be used for plotting via &quot;Plot&quot; Cantor menu.</string>
</property>
<property name="text">
<string>Graphic Package for &quot;Plot&quot;-assistant</string>
</property>
</widget>
</item>
<item row="5" column="2">
<widget class="KComboBox" name="kcfg_plotExtenstionGraphicPackage">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">