Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Education
Cantor
Commits
80e03223
Commit
80e03223
authored
Aug 15, 2020
by
Shubham .
Browse files
Remove qt help file widget code from maxima backend
parent
76d4a5dc
Changes
5
Hide whitespace changes
Inline
Side-by-side
src/backends/maxima/CMakeLists.txt
View file @
80e03223
...
...
@@ -13,7 +13,7 @@ set( MaximaBackend_SRCS
kconfig_add_kcfg_files
(
MaximaBackend_SRCS settings.kcfgc
)
install
(
FILES maximabackend.kcfg DESTINATION
${
KDE_INSTALL_KCFGDIR
}
)
ki18n_wrap_ui
(
MaximaBackend_SRCS settings.ui
qthelpconfigeditdialog.ui
)
ki18n_wrap_ui
(
MaximaBackend_SRCS settings.ui
)
add_backend
(
maximabackend
${
MaximaBackend_SRCS
}
)
...
...
src/backends/maxima/maximabackend.cpp
View file @
80e03223
...
...
@@ -25,23 +25,6 @@
#include "maximasession.h"
#include "settings.h"
#include <QDialog>
#include <QHelpEngineCore>
#include <QPointer>
#include <QToolButton>
#include <QTreeWidgetItem>
#include <KMessageBox>
enum
Column
{
NameColumn
,
PathColumn
,
IconColumn
,
GhnsColumn
,
ConfigColumn
};
MaximaBackend
::
MaximaBackend
(
QObject
*
parent
,
const
QList
<
QVariant
>
args
)
:
Cantor
::
Backend
(
parent
,
args
)
{
//initialize the supported extensions
...
...
@@ -109,15 +92,8 @@ QUrl MaximaBackend::helpUrl() const
QWidget
*
MaximaBackend
::
settingsWidget
(
QWidget
*
parent
)
const
{
QWidget
*
widget
=
new
QWidget
(
parent
);
m_settings
=
new
Ui
::
MaximaSettingsBase
;
m_settings
->
setupUi
(
widget
);
// KNewStuff button (Get New Documentation)
/*auto* knsButton = new KNS3::Button(i18nc("@action:button Allow user to get some API documentation with GHNS", "Get New Documentation"), QStringLiteral("cantor_maxima.knsrc"), m_settings->groupBox2);
m_settings->horizontalLayout_2->insertWidget(1, knsButton);
connect(knsButton, &KNS3::Button::dialogFinished, this, &MaximaBackend::knsUpdate);*/
connect
(
m_settings
->
add
,
&
QPushButton
::
clicked
,
this
,
&
MaximaBackend
::
add
);
Ui
::
MaximaSettingsBase
s
;
s
.
setupUi
(
widget
);
return
widget
;
}
...
...
@@ -136,96 +112,5 @@ QString MaximaBackend::description() const
"floating point numbers. Maxima can plot functions and data in two and three dimensions."
);
}
void
MaximaBackend
::
add
()
{
QPointer
<
QtHelpConfigEditDialog
>
dialog
=
new
QtHelpConfigEditDialog
(
nullptr
);
if
(
dialog
->
exec
())
{
QTreeWidgetItem
*
item
=
addTableItem
(
dialog
->
qchIcon
->
icon
(),
dialog
->
qchName
->
text
(),
dialog
->
qchRequester
->
text
(),
QStringLiteral
(
"0"
));
m_settings
->
qchTable
->
setCurrentItem
(
item
);
}
delete
dialog
;
}
void
MaximaBackend
::
remove
(
QTreeWidgetItem
*
)
{
}
void
MaximaBackend
::
modify
(
QTreeWidgetItem
*
item
)
{
}
void
MaximaBackend
::
knsUpdate
(
const
KNS3
::
Entry
::
List
&
list
)
{
Q_UNUSED
(
list
)
}
bool
MaximaBackend
::
checkNamespace
(
const
QString
&
filename
,
QTreeWidgetItem
*
modifiedItem
)
{
QString
qtHelpNamespace
=
QHelpEngineCore
::
namespaceName
(
filename
);
if
(
qtHelpNamespace
.
isEmpty
())
{
// Open error message (not valid Qt Compressed Help file)
KMessageBox
::
error
(
nullptr
,
i18n
(
"Qt Compressed Help file is not valid."
));
return
false
;
}
// verify if it's the namespace it's not already in the list
for
(
int
i
=
0
;
i
<
m_settings
->
qchTable
->
topLevelItemCount
();
i
++
)
{
const
QTreeWidgetItem
*
item
=
m_settings
->
qchTable
->
topLevelItem
(
i
);
if
(
item
!=
modifiedItem
){
if
(
qtHelpNamespace
==
QHelpEngineCore
::
namespaceName
(
item
->
text
(
PathColumn
)))
{
// Open error message, documentation already imported
KMessageBox
::
error
(
nullptr
,
i18n
(
"Documentation already imported"
));
return
false
;
}
}
}
return
true
;
}
QTreeWidgetItem
*
MaximaBackend
::
addTableItem
(
const
QString
&
icon
,
const
QString
&
name
,
const
QString
&
path
,
const
QString
&
ghnsStatus
)
{
auto
*
item
=
new
QTreeWidgetItem
(
m_settings
->
qchTable
);
item
->
setIcon
(
NameColumn
,
QIcon
::
fromTheme
(
icon
));
item
->
setText
(
NameColumn
,
name
);
item
->
setToolTip
(
NameColumn
,
name
);
item
->
setText
(
PathColumn
,
path
);
item
->
setToolTip
(
PathColumn
,
path
);
item
->
setText
(
IconColumn
,
icon
);
item
->
setText
(
GhnsColumn
,
ghnsStatus
);
auto
*
ctrlWidget
=
new
QWidget
(
item
->
treeWidget
());
ctrlWidget
->
setLayout
(
new
QHBoxLayout
(
ctrlWidget
));
auto
*
modifyBtn
=
new
QToolButton
(
item
->
treeWidget
());
modifyBtn
->
setIcon
(
QIcon
::
fromTheme
(
QStringLiteral
(
"document-edit"
)));
modifyBtn
->
setToolTip
(
i18nc
(
"@info:tooltip"
,
"Modify"
));
connect
(
modifyBtn
,
&
QPushButton
::
clicked
,
this
,
[
=
](){
modify
(
item
);
});
auto
*
removeBtn
=
new
QToolButton
(
item
->
treeWidget
());
removeBtn
->
setIcon
(
QIcon
::
fromTheme
(
QStringLiteral
(
"entry-delete"
)));
removeBtn
->
setToolTip
(
i18nc
(
"@info:tooltip"
,
"Delete"
));
if
(
item
->
text
(
GhnsColumn
)
!=
QLatin1String
(
"0"
))
{
// KNS3 currently does not provide API to uninstall entries
// just removing the files results in wrong installed states in the KNS3 dialog
// TODO: add API to KNS to remove files without UI interaction
removeBtn
->
setEnabled
(
false
);
removeBtn
->
setToolTip
(
i18nc
(
"@info:tooltip"
,
"Please uninstall this via GHNS."
));
}
else
{
connect
(
removeBtn
,
&
QPushButton
::
clicked
,
this
,
[
=
](){
remove
(
item
);
});
}
ctrlWidget
->
layout
()
->
addWidget
(
modifyBtn
);
ctrlWidget
->
layout
()
->
addWidget
(
removeBtn
);
m_settings
->
qchTable
->
setItemWidget
(
item
,
ConfigColumn
,
ctrlWidget
);
return
item
;
}
K_PLUGIN_FACTORY_WITH_JSON
(
maximabackend
,
"maximabackend.json"
,
registerPlugin
<
MaximaBackend
>
();)
#include "maximabackend.moc"
src/backends/maxima/maximabackend.h
View file @
80e03223
...
...
@@ -49,49 +49,6 @@ class MaximaBackend : public Cantor::Backend
KConfigSkeleton
*
config
()
const
override
;
QString
description
()
const
override
;
private
Q_SLOTS
:
void
add
();
void
remove
(
QTreeWidgetItem
*
);
void
modify
(
QTreeWidgetItem
*
);
void
knsUpdate
(
const
KNS3
::
Entry
::
List
&
);
private:
void
modify
();
QTreeWidgetItem
*
addTableItem
(
const
QString
&
,
const
QString
&
,
const
QString
&
,
const
QString
&
);
bool
checkNamespace
(
const
QString
&
,
QTreeWidgetItem
*
);
private:
mutable
Ui
::
MaximaSettingsBase
*
m_settings
;
};
// class for qt help file installation
class
QtHelpConfigEditDialog
:
public
QDialog
,
public
Ui_QtHelpConfigEditDialog
{
Q_OBJECT
public:
explicit
QtHelpConfigEditDialog
(
QTreeWidgetItem
*
modifiedItem
)
:
m_modifiedItem
(
modifiedItem
)
{
setupUi
(
this
);
if
(
modifiedItem
)
{
setWindowTitle
(
i18nc
(
"@title:window"
,
"Modify Entry"
));
}
else
{
setWindowTitle
(
i18nc
(
"@title:window"
,
"Add New Entry"
));
}
qchIcon
->
setIcon
(
QStringLiteral
(
"maximabackend"
));
}
bool
checkQtHelpFile
();
//void accept() override;
private:
QTreeWidgetItem
*
m_modifiedItem
;
};
#endif
/* _MAXIMABACKEND_H */
src/backends/maxima/qthelpconfigeditdialog.ui
deleted
100644 → 0
View file @
76d4a5dc
<?xml version="1.0" encoding="UTF-8"?>
<ui
version=
"4.0"
>
<class>
QtHelpConfigEditDialog
</class>
<widget
class=
"QDialog"
name=
"QtHelpConfigEditDialog"
>
<property
name=
"geometry"
>
<rect>
<x>
0
</x>
<y>
0
</y>
<width>
400
</width>
<height>
125
</height>
</rect>
</property>
<layout
class=
"QFormLayout"
name=
"formLayout"
>
<item
row=
"0"
column=
"0"
>
<widget
class=
"QLabel"
name=
"label_3"
>
<property
name=
"text"
>
<string
comment=
"@label:chooser"
>
Icon:
</string>
</property>
</widget>
</item>
<item
row=
"0"
column=
"1"
>
<widget
class=
"KIconButton"
name=
"qchIcon"
>
<property
name=
"toolTip"
>
<string
comment=
"@info:tooltip"
>
Select an icon
</string>
</property>
<property
name=
"iconSize"
>
<number>
16
</number>
</property>
<property
name=
"strictIconSize"
>
<bool>
true
</bool>
</property>
</widget>
</item>
<item
row=
"1"
column=
"0"
>
<widget
class=
"QLabel"
name=
"label"
>
<property
name=
"text"
>
<string
comment=
"@label:textbox"
>
Name:
</string>
</property>
</widget>
</item>
<item
row=
"1"
column=
"1"
>
<widget
class=
"QLineEdit"
name=
"qchName"
>
<property
name=
"toolTip"
>
<string
comment=
"@info:tooltip"
>
Enter a name
</string>
</property>
<property
name=
"placeholderText"
>
<string
comment=
"@info:placeholder"
>
Select a name...
</string>
</property>
</widget>
</item>
<item
row=
"2"
column=
"0"
>
<widget
class=
"QLabel"
name=
"label_2"
>
<property
name=
"text"
>
<string
comment=
"@label:textbox"
>
Path:
</string>
</property>
</widget>
</item>
<item
row=
"2"
column=
"1"
>
<widget
class=
"KUrlRequester"
name=
"qchRequester"
>
<property
name=
"sizePolicy"
>
<sizepolicy
hsizetype=
"Expanding"
vsizetype=
"Preferred"
>
<horstretch>
0
</horstretch>
<verstretch>
0
</verstretch>
</sizepolicy>
</property>
<property
name=
"toolTip"
>
<string
comment=
"@info:tooltip"
>
Select a Qt Help file...
</string>
</property>
<property
name=
"filter"
>
<string
notr=
"true"
>
*.qch|Qt Compressed Help (.qch)
</string>
</property>
<property
name=
"placeholderText"
>
<string
comment=
"@info:placeholder"
>
Select a Qt Help file...
</string>
</property>
</widget>
</item>
<item
row=
"3"
column=
"0"
colspan=
"2"
>
<widget
class=
"QDialogButtonBox"
name=
"buttonBox"
>
<property
name=
"orientation"
>
<enum>
Qt::Horizontal
</enum>
</property>
<property
name=
"standardButtons"
>
<set>
QDialogButtonBox::Cancel|QDialogButtonBox::Ok
</set>
</property>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>
KIconButton
</class>
<extends>
QPushButton
</extends>
<header>
KIconButton
</header>
</customwidget>
<customwidget>
<class>
KUrlRequester
</class>
<extends>
QWidget
</extends>
<header>
KUrlRequester
</header>
</customwidget>
</customwidgets>
<resources/>
<connections>
<connection>
<sender>
buttonBox
</sender>
<signal>
accepted()
</signal>
<receiver>
QtHelpConfigEditDialog
</receiver>
<slot>
accept()
</slot>
<hints>
<hint
type=
"sourcelabel"
>
<x>
248
</x>
<y>
254
</y>
</hint>
<hint
type=
"destinationlabel"
>
<x>
157
</x>
<y>
274
</y>
</hint>
</hints>
</connection>
<connection>
<sender>
buttonBox
</sender>
<signal>
rejected()
</signal>
<receiver>
QtHelpConfigEditDialog
</receiver>
<slot>
reject()
</slot>
<hints>
<hint
type=
"sourcelabel"
>
<x>
316
</x>
<y>
260
</y>
</hint>
<hint
type=
"destinationlabel"
>
<x>
286
</x>
<y>
274
</y>
</hint>
</hints>
</connection>
</connections>
</ui>
src/backends/maxima/settings.ui
View file @
80e03223
...
...
@@ -11,21 +11,19 @@
</rect>
</property>
<layout
class=
"QGridLayout"
name=
"gridLayout_2"
>
<item
row=
"
0
"
column=
"0"
>
<widget
class=
"Q
Label"
name=
"label
"
>
<property
name=
"t
ext
"
>
<string>
Executable:
</string>
<item
row=
"
4
"
column=
"0"
colspan=
"2"
>
<widget
class=
"Q
GroupBox"
name=
"groupBox
"
>
<property
name=
"t
oolTip
"
>
<string>
Commands to automatically run on start. They can be useful for loading needed modules, changing environment, etc.
</string>
</property>
</widget>
</item>
<item
row=
"0"
column=
"1"
>
<widget
class=
"KUrlRequester"
name=
"kcfg_Path"
/>
</item>
<item
row=
"1"
column=
"0"
>
<widget
class=
"QLabel"
name=
"label2"
>
<property
name=
"text"
>
<string>
Documentation:
</string>
<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=
"1"
column=
"1"
>
...
...
@@ -35,6 +33,9 @@
</property>
</widget>
</item>
<item
row=
"0"
column=
"1"
>
<widget
class=
"KUrlRequester"
name=
"kcfg_Path"
/>
</item>
<item
row=
"2"
column=
"0"
>
<widget
class=
"QLabel"
name=
"lPlotIntegration"
>
<property
name=
"text"
>
...
...
@@ -42,6 +43,13 @@
</property>
</widget>
</item>
<item
row=
"0"
column=
"0"
>
<widget
class=
"QLabel"
name=
"label"
>
<property
name=
"text"
>
<string>
Executable:
</string>
</property>
</widget>
</item>
<item
row=
"2"
column=
"1"
>
<widget
class=
"QCheckBox"
name=
"kcfg_integratePlots"
>
<property
name=
"toolTip"
>
...
...
@@ -52,13 +60,6 @@
</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=
"3"
column=
"1"
>
<widget
class=
"QCheckBox"
name=
"kcfg_variableManagement"
>
<property
name=
"toolTip"
>
...
...
@@ -69,67 +70,21 @@
</property>
</widget>
</item>
<item
row=
"4"
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>
<item
row=
"1"
column=
"0"
>
<widget
class=
"QLabel"
name=
"label2"
>
<property
name=
"text"
>
<string>
Documentation:
</string>
</property>
<layout
class=
"QVBoxLayout"
name=
"verticalLayoutScripts"
>
<item>
<widget
class=
"KEditListWidget"
name=
"kcfg_autorunScripts"
/>
</item>
</layout>
</widget>
</item>
<item
row=
"5"
column=
"0"
colspan=
"2"
>
<widget
class=
"QGroupBox"
name=
"groupBox_2"
>
<property
name=
"toolTip"
>
<string>
Install locally available documentation files or download new ones from KDE store
</string>
</property>
<property
name=
"title"
>
<string>
Documentation Files
</string>
<item
row=
"3"
column=
"0"
>
<widget
class=
"QLabel"
name=
"lVariableManagement"
>
<property
name=
"text"
>
<string>
Variable Management:
</string>
</property>
<layout
class=
"QGridLayout"
name=
"gridLayout"
>
<item
row=
"1"
column=
"1"
>
<spacer
name=
"verticalSpacer_2"
>
<property
name=
"orientation"
>
<enum>
Qt::Vertical
</enum>
</property>
<property
name=
"sizeHint"
stdset=
"0"
>
<size>
<width>
20
</width>
<height>
145
</height>
</size>
</property>
</spacer>
</item>
<item
row=
"0"
column=
"1"
>
<widget
class=
"QPushButton"
name=
"add"
>
<property
name=
"text"
>
<string>
Add
</string>
</property>
<property
name=
"icon"
>
<iconset
theme=
"list-add"
>
<normaloff>
.
</normaloff>
.
</iconset>
</property>
</widget>
</item>
<item
row=
"0"
column=
"0"
rowspan=
"2"
>
<widget
class=
"QTreeWidget"
name=
"qchTable"
>
<column>
<property
name=
"text"
>
<string
notr=
"true"
>
1
</string>
</property>
</column>
</widget>
</item>
</layout>
</widget>
</item>
<item
row=
"
6
"
column=
"0"
>
<item
row=
"
5
"
column=
"0"
>
<spacer
name=
"verticalSpacer"
>
<property
name=
"orientation"
>
<enum>
Qt::Vertical
</enum>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment