Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
kumir2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
2
Issues
2
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
kumir
kumir2
Commits
094e0091
Commit
094e0091
authored
Sep 04, 2013
by
Victor Yacovlev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed course manager program handling
parent
70f5cf79
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
339 additions
and
269 deletions
+339
-269
share/kumir2/translations/CoreGUI_ru.ts
share/kumir2/translations/CoreGUI_ru.ts
+50
-42
src/plugins/coregui/CMakeLists.txt
src/plugins/coregui/CMakeLists.txt
+1
-0
src/plugins/coregui/mainwindow.cpp
src/plugins/coregui/mainwindow.cpp
+38
-54
src/plugins/coregui/mainwindow.h
src/plugins/coregui/mainwindow.h
+2
-4
src/plugins/coregui/plugin.cpp
src/plugins/coregui/plugin.cpp
+1
-2
src/plugins/coregui/tabwidgetelement.cpp
src/plugins/coregui/tabwidgetelement.cpp
+112
-0
src/plugins/coregui/tabwidgetelement.h
src/plugins/coregui/tabwidgetelement.h
+7
-89
src/plugins/editor/editor.cpp
src/plugins/editor/editor.cpp
+101
-15
src/plugins/editor/editor.h
src/plugins/editor/editor.h
+9
-0
src/plugins/editor/editorplugin.cpp
src/plugins/editor/editorplugin.cpp
+10
-63
src/shared/interfaces/editor_instanceinterface.h
src/shared/interfaces/editor_instanceinterface.h
+8
-0
No files found.
share/kumir2/translations/CoreGUI_ru.ts
View file @
094e0091
...
...
@@ -423,7 +423,7 @@ Right click to navigate target</source>
<
name
>
CoreGUI
::
MainWindow
<
/name
>
<
message
>
<
location
filename
=
"
../../../src/plugins/coregui/mainwindow.ui
"
line
=
"
14
"
/>
<
location
filename
=
"
../../../src/plugins/coregui/mainwindow.cpp
"
line
=
"
49
7
"
/>
<
location
filename
=
"
../../../src/plugins/coregui/mainwindow.cpp
"
line
=
"
49
8
"
/>
<
source
>
Kumir
<
/source
>
<
translation
>
Кумир
<
/translation
>
<
/message
>
...
...
@@ -506,10 +506,10 @@ Right click to navigate target</source>
<
/message
>
<
message
>
<
location
filename
=
"
../../../src/plugins/coregui/mainwindow.ui
"
line
=
"
147
"
/>
<
location
filename
=
"
../../../src/plugins/coregui/mainwindow.cpp
"
line
=
"
77
8
"
/>
<
location
filename
=
"
../../../src/plugins/coregui/mainwindow.cpp
"
line
=
"
11
69
"
/>
<
location
filename
=
"
../../../src/plugins/coregui/mainwindow.cpp
"
line
=
"
12
69
"
/>
<
location
filename
=
"
../../../src/plugins/coregui/mainwindow.cpp
"
line
=
"
141
1
"
/>
<
location
filename
=
"
../../../src/plugins/coregui/mainwindow.cpp
"
line
=
"
77
9
"
/>
<
location
filename
=
"
../../../src/plugins/coregui/mainwindow.cpp
"
line
=
"
11
75
"
/>
<
location
filename
=
"
../../../src/plugins/coregui/mainwindow.cpp
"
line
=
"
12
75
"
/>
<
location
filename
=
"
../../../src/plugins/coregui/mainwindow.cpp
"
line
=
"
141
7
"
/>
<
source
>
Save
<
/source
>
<
translation
>
Сохранить
программу
<
/translation
>
<
/message
>
...
...
@@ -618,12 +618,12 @@ Right click to navigate target</source>
<
/message
>
<
message
>
<
location
filename
=
"
../../../src/plugins/coregui/mainwindow.ui
"
line
=
"
227
"
/>
<
location
filename
=
"
../../../src/plugins/coregui/mainwindow.cpp
"
line
=
"
11
08
"
/>
<
location
filename
=
"
../../../src/plugins/coregui/mainwindow.cpp
"
line
=
"
11
14
"
/>
<
source
>
Restore
previous
session
<
/source
>
<
translation
>
Восстановить
предыдущий
сеанс
<
/translation
>
<
/message
>
<
message
>
<
location
filename
=
"
../../../src/plugins/coregui/mainwindow.cpp
"
line
=
"
1
19
"
/>
<
location
filename
=
"
../../../src/plugins/coregui/mainwindow.cpp
"
line
=
"
1
20
"
/>
<
source
>
No
actions
for
this
tab
<
/source
>
<
translation
>
Для
этой
вкладки
нет
действий
<
/translation
>
<
/message
>
...
...
@@ -648,91 +648,91 @@ Right click to navigate target</source>
<
translation
type
=
"
obsolete
"
>
Выполнено
шагов
:
%
1
<
/translation
>
<
/message
>
<
message
>
<
location
filename
=
"
../../../src/plugins/coregui/mainwindow.cpp
"
line
=
"
49
2
"
/>
<
location
filename
=
"
../../../src/plugins/coregui/mainwindow.cpp
"
line
=
"
49
3
"
/>
<
source
>
New
Program
<
/source
>
<
translation
>
Новая
программа
<
/translation
>
<
/message
>
<
message
>
<
location
filename
=
"
../../../src/plugins/coregui/mainwindow.cpp
"
line
=
"
49
5
"
/>
<
location
filename
=
"
../../../src/plugins/coregui/mainwindow.cpp
"
line
=
"
49
6
"
/>
<
source
>
New
Text
<
/source
>
<
translation
>
Новый
текст
<
/translation
>
<
/message
>
<
message
>
<
location
filename
=
"
../../../src/plugins/coregui/mainwindow.cpp
"
line
=
"
69
4
"
/>
<
location
filename
=
"
../../../src/plugins/coregui/mainwindow.cpp
"
line
=
"
1
298
"
/>
<
location
filename
=
"
../../../src/plugins/coregui/mainwindow.cpp
"
line
=
"
69
5
"
/>
<
location
filename
=
"
../../../src/plugins/coregui/mainwindow.cpp
"
line
=
"
1
304
"
/>
<
source
>%
1
programs
(
*%
2
)
<
/source
>
<
translation
>
Программы
%
1
(
*%
2
)
<
/translation
>
<
/message
>
<
message
>
<
location
filename
=
"
../../../src/plugins/coregui/mainwindow.cpp
"
line
=
"
69
7
"
/>
<
location
filename
=
"
../../../src/plugins/coregui/mainwindow.cpp
"
line
=
"
130
1
"
/>
<
location
filename
=
"
../../../src/plugins/coregui/mainwindow.cpp
"
line
=
"
69
8
"
/>
<
location
filename
=
"
../../../src/plugins/coregui/mainwindow.cpp
"
line
=
"
130
7
"
/>
<
source
>
Text
files
(
*
.
txt
)
<
/source
>
<
translation
>
Текстовые
файлы
(
*
.
txt
)
<
/translation
>
<
/message
>
<
message
>
<
location
filename
=
"
../../../src/plugins/coregui/mainwindow.cpp
"
line
=
"
699
"
/>
<
location
filename
=
"
../../../src/plugins/coregui/mainwindow.cpp
"
line
=
"
130
3
"
/>
<
location
filename
=
"
../../../src/plugins/coregui/mainwindow.cpp
"
line
=
"
700
"
/>
<
location
filename
=
"
../../../src/plugins/coregui/mainwindow.cpp
"
line
=
"
130
9
"
/>
<
source
>
All
files
(
*
)
<
/source
>
<
translation
>
Все
файлы
(
*
)
<
/translation
>
<
/message
>
<
message
>
<
location
filename
=
"
../../../src/plugins/coregui/mainwindow.cpp
"
line
=
"
70
0
"
/>
<
location
filename
=
"
../../../src/plugins/coregui/mainwindow.cpp
"
line
=
"
70
1
"
/>
<
source
>
Save
file
<
/source
>
<
translation
>
Сохранить
файл
<
/translation
>
<
/message
>
<
message
>
<
location
filename
=
"
../../../src/plugins/coregui/mainwindow.cpp
"
line
=
"
72
7
"
/>
<
location
filename
=
"
../../../src/plugins/coregui/mainwindow.cpp
"
line
=
"
72
8
"
/>
<
source
>
Can
&
apos
;
t
save
file
<
/source
>
<
translation
>
Не
могу
сохранить
файл
<
/translation
>
<
/message
>
<
message
>
<
location
filename
=
"
../../../src/plugins/coregui/mainwindow.cpp
"
line
=
"
77
2
"
/>
<
location
filename
=
"
../../../src/plugins/coregui/mainwindow.cpp
"
line
=
"
77
3
"
/>
<
source
>
Close
editor
<
/source
>
<
translation
>
Закрытие
текста
<
/translation
>
<
/message
>
<
message
>
<
location
filename
=
"
../../../src/plugins/coregui/mainwindow.cpp
"
line
=
"
77
3
"
/>
<
location
filename
=
"
../../../src/plugins/coregui/mainwindow.cpp
"
line
=
"
12
64
"
/>
<
location
filename
=
"
../../../src/plugins/coregui/mainwindow.cpp
"
line
=
"
14
06
"
/>
<
location
filename
=
"
../../../src/plugins/coregui/mainwindow.cpp
"
line
=
"
77
4
"
/>
<
location
filename
=
"
../../../src/plugins/coregui/mainwindow.cpp
"
line
=
"
12
70
"
/>
<
location
filename
=
"
../../../src/plugins/coregui/mainwindow.cpp
"
line
=
"
14
12
"
/>
<
source
>
Save
current
text
?
<
/source
>
<
translation
>
Сохранить
текущий
текст
?
<
/translation
>
<
/message
>
<
message
>
<
location
filename
=
"
../../../src/plugins/coregui/mainwindow.cpp
"
line
=
"
78
0
"
/>
<
location
filename
=
"
../../../src/plugins/coregui/mainwindow.cpp
"
line
=
"
117
1
"
/>
<
location
filename
=
"
../../../src/plugins/coregui/mainwindow.cpp
"
line
=
"
127
1
"
/>
<
location
filename
=
"
../../../src/plugins/coregui/mainwindow.cpp
"
line
=
"
141
3
"
/>
<
location
filename
=
"
../../../src/plugins/coregui/mainwindow.cpp
"
line
=
"
78
1
"
/>
<
location
filename
=
"
../../../src/plugins/coregui/mainwindow.cpp
"
line
=
"
117
7
"
/>
<
location
filename
=
"
../../../src/plugins/coregui/mainwindow.cpp
"
line
=
"
127
7
"
/>
<
location
filename
=
"
../../../src/plugins/coregui/mainwindow.cpp
"
line
=
"
141
9
"
/>
<
source
>
Don
&
apos
;
t
save
<
/source
>
<
translation
>
Не
сохранять
<
/translation
>
<
/message
>
<
message
>
<
location
filename
=
"
../../../src/plugins/coregui/mainwindow.cpp
"
line
=
"
78
2
"
/>
<
location
filename
=
"
../../../src/plugins/coregui/mainwindow.cpp
"
line
=
"
117
3
"
/>
<
location
filename
=
"
../../../src/plugins/coregui/mainwindow.cpp
"
line
=
"
78
3
"
/>
<
location
filename
=
"
../../../src/plugins/coregui/mainwindow.cpp
"
line
=
"
117
9
"
/>
<
source
>
Cancel
closing
<
/source
>
<
translation
>
Отменить
закрытие
<
/translation
>
<
/message
>
<
message
>
<
location
filename
=
"
../../../src/plugins/coregui/mainwindow.cpp
"
line
=
"
82
5
"
/>
<
location
filename
=
"
../../../src/plugins/coregui/mainwindow.cpp
"
line
=
"
82
6
"
/>
<
source
>
Preferences
<
/source
>
<
translation
>
Настройки
<
/translation
>
<
/message
>
<
message
>
<
location
filename
=
"
../../../src/plugins/coregui/mainwindow.cpp
"
line
=
"
11
09
"
/>
<
location
filename
=
"
../../../src/plugins/coregui/mainwindow.cpp
"
line
=
"
11
15
"
/>
<
source
>
Are
you
sure
to
restore
previous
session
?
All
unsaved
changes
will
be
lost
.
<
/source
>
<
translation
>
Вы
уверены
,
что
хотите
восстановить
предыдущий
сеанс
?
Все
открытые
файлы
будут
закрыты
без
сохранения
.
<
/translation
>
<
/message
>
<
message
>
<
location
filename
=
"
../../../src/plugins/coregui/mainwindow.cpp
"
line
=
"
111
3
"
/>
<
location
filename
=
"
../../../src/plugins/coregui/mainwindow.cpp
"
line
=
"
111
9
"
/>
<
source
>
Yes
<
/source
>
<
translation
>
Да
<
/translation
>
<
/message
>
<
message
>
<
location
filename
=
"
../../../src/plugins/coregui/mainwindow.cpp
"
line
=
"
11
14
"
/>
<
location
filename
=
"
../../../src/plugins/coregui/mainwindow.cpp
"
line
=
"
11
20
"
/>
<
source
>
No
<
/source
>
<
translation
>
Нет
<
/translation
>
<
/message
>
<
message
>
<
location
filename
=
"
../../../src/plugins/coregui/mainwindow.cpp
"
line
=
"
116
0
"
/>
<
location
filename
=
"
../../../src/plugins/coregui/mainwindow.cpp
"
line
=
"
116
6
"
/>
<
source
>
The
following
files
have
changes
:
%
1
Save
them
?
<
/source
>
...
...
@@ -741,29 +741,29 @@ Save them?</source>
Сохранить
их
?
<
/translation
>
<
/message
>
<
message
>
<
location
filename
=
"
../../../src/plugins/coregui/mainwindow.cpp
"
line
=
"
116
3
"
/>
<
location
filename
=
"
../../../src/plugins/coregui/mainwindow.cpp
"
line
=
"
116
9
"
/>
<
source
>
Close
Kumir
<
/source
>
<
translation
>
Выход
из
Кумир
<
/translation
>
<
/message
>
<
message
>
<
location
filename
=
"
../../../src/plugins/coregui/mainwindow.cpp
"
line
=
"
126
3
"
/>
<
location
filename
=
"
../../../src/plugins/coregui/mainwindow.cpp
"
line
=
"
14
05
"
/>
<
location
filename
=
"
../../../src/plugins/coregui/mainwindow.cpp
"
line
=
"
126
9
"
/>
<
location
filename
=
"
../../../src/plugins/coregui/mainwindow.cpp
"
line
=
"
14
11
"
/>
<
source
>
Open
another
file
<
/source
>
<
translation
>
Открытие
другого
файла
<
/translation
>
<
/message
>
<
message
>
<
location
filename
=
"
../../../src/plugins/coregui/mainwindow.cpp
"
line
=
"
127
3
"
/>
<
location
filename
=
"
../../../src/plugins/coregui/mainwindow.cpp
"
line
=
"
14
15
"
/>
<
location
filename
=
"
../../../src/plugins/coregui/mainwindow.cpp
"
line
=
"
127
9
"
/>
<
location
filename
=
"
../../../src/plugins/coregui/mainwindow.cpp
"
line
=
"
14
21
"
/>
<
source
>
Cancel
opening
another
file
<
/source
>
<
translation
>
Не
открывать
другой
файл
<
/translation
>
<
/message
>
<
message
>
<
location
filename
=
"
../../../src/plugins/coregui/mainwindow.cpp
"
line
=
"
130
0
"
/>
<
location
filename
=
"
../../../src/plugins/coregui/mainwindow.cpp
"
line
=
"
130
6
"
/>
<
source
>
Web
pages
(
*
.
html
*
.
htm
)
<
/source
>
<
translation
>
Web
-
страницы
(
*
.
html
*
.
htm
)
<
/translation
>
<
/message
>
<
message
>
<
location
filename
=
"
../../../src/plugins/coregui/mainwindow.cpp
"
line
=
"
14
74
"
/>
<
location
filename
=
"
../../../src/plugins/coregui/mainwindow.cpp
"
line
=
"
14
80
"
/>
<
source
>
Can
&
apos
;
t
open
file
<
/source
>
<
translation
>
Не
могу
открыть
файл
<
/translation
>
<
/message
>
...
...
@@ -802,7 +802,7 @@ Using Qt version %2</source>
Использует
Qt
версии
%
2
<
/translation
>
<
/message
>
<
message
>
<
location
filename
=
"
../../../src/plugins/coregui/mainwindow.cpp
"
line
=
"
13
07
"
/>
<
location
filename
=
"
../../../src/plugins/coregui/mainwindow.cpp
"
line
=
"
13
13
"
/>
<
source
>
Load
file
...
<
/source
>
<
translation
>
Загрузить
файл
...
<
/translation
>
<
/message
>
...
...
@@ -829,7 +829,7 @@ Using Qt version %2</source>
<
translation
type
=
"
obsolete
"
>
Область
ввода
/
вывода
<
/translation
>
<
/message
>
<
message
>
<
location
filename
=
"
../../../src/plugins/coregui/plugin.cpp
"
line
=
"
32
4
"
/>
<
location
filename
=
"
../../../src/plugins/coregui/plugin.cpp
"
line
=
"
32
5
"
/>
<
source
>
Variables
<
/source
>
<
translation
>
Значения
величин
<
/translation
>
<
/message
>
...
...
@@ -872,7 +872,7 @@ Using Qt version %2</source>
<
translation
type
=
"
obsolete
"
>
Пауза
<
/translation
>
<
/message
>
<
message
>
<
location
filename
=
"
../../../src/plugins/coregui/plugin.cpp
"
line
=
"
46
3
"
/>
<
location
filename
=
"
../../../src/plugins/coregui/plugin.cpp
"
line
=
"
46
4
"
/>
<
source
>
Start
<
/source
>
<
translation
>
Начало
<
/translation
>
<
/message
>
...
...
@@ -1082,6 +1082,14 @@ p, li { white-space: pre-wrap; }
<
translation
type
=
"
obsolete
"
>
Закрыть
текущую
вкладку
<
/translation
>
<
/message
>
<
/context
>
<
context
>
<
name
>
CoreGUI
::
TabWidgetElement
<
/name
>
<
message
>
<
location
filename
=
"
../../../src/plugins/coregui/tabwidgetelement.cpp
"
line
=
"
96
"
/>
<
source
>%
1
(
Course
)
<
/source
>
<
translation
>%
1
(
Практикум
)
<
/translation
>
<
/message
>
<
/context
>
<
context
>
<
name
>
Terminal
::
OneSession
<
/name
>
<
message
>
...
...
src/plugins/coregui/CMakeLists.txt
View file @
094e0091
...
...
@@ -8,6 +8,7 @@ set(SOURCES
mainwindow.cpp
plugin.cpp
tabwidget.cpp
tabwidgetelement.cpp
kumirprogram.cpp
terminal.cpp
terminal_onesession.cpp
...
...
src/plugins/coregui/mainwindow.cpp
View file @
094e0091
...
...
@@ -70,7 +70,7 @@ MainWindow::MainWindow(Plugin * p) :
setStatusBar
(
statusBar_
);
setMinimumHeight
(
380
);
b_notabs
=
false
;
tabsDisabledFlag_
=
false
;
b_workspaceSwitching
=
false
;
...
...
@@ -283,7 +283,7 @@ bool MainWindow::eventFilter(QObject *o, QEvent *e)
&&
url
.
scheme
()
==
"file"
)
{
static
const
QStringList
validSuffices
=
b_notabs
static
const
QStringList
validSuffices
=
tabsDisabledFlag_
?
(
QStringList
()
<<
"kum"
)
:
(
QStringList
()
<<
"kum"
<<
"txt"
<<
"html"
<<
"htm"
);
...
...
@@ -299,7 +299,7 @@ bool MainWindow::eventFilter(QObject *o, QEvent *e)
}
}
}
const
bool
canAccept
=
b_notabs
const
bool
canAccept
=
tabsDisabledFlag_
?
validUrls
.
size
()
==
1
:
validUrls
.
size
()
>=
1
;
if
(
canAccept
)
{
...
...
@@ -345,7 +345,7 @@ void MainWindow::lockActions()
ui
->
actionPreferences
->
setEnabled
(
false
);
if
(
b_notabs
)
{
if
(
tabsDisabledFlag_
)
{
ui
->
actionNewProgram
->
setEnabled
(
false
);
ui
->
actionOpen
->
setEnabled
(
false
);
ui
->
actionRecent_files
->
setEnabled
(
false
);
...
...
@@ -371,7 +371,7 @@ void MainWindow::unlockActions()
ui
->
actionPreferences
->
setEnabled
(
true
);
if
(
b_notabs
)
{
if
(
tabsDisabledFlag_
)
{
ui
->
actionNewProgram
->
setEnabled
(
true
);
ui
->
actionOpen
->
setEnabled
(
true
);
ui
->
actionRecent_files
->
setEnabled
(
true
);
...
...
@@ -856,7 +856,7 @@ void MainWindow::newProgram()
{
using
namespace
ExtensionSystem
;
using
namespace
Shared
;
if
(
b_notabs
&&
!
closeTab
(
tabWidget_
->
currentIndex
()))
{
if
(
tabsDisabledFlag_
&&
!
closeTab
(
tabWidget_
->
currentIndex
()))
{
return
;
}
AnalizerInterface
*
analizer
=
...
...
@@ -872,15 +872,12 @@ void MainWindow::newProgram()
this
,
SLOT
(
showAlgorithmHelp
(
QString
)));
QString
fileName
=
suggestNewFileName
(
suffix
,
editor
->
analizer
());
vc
->
setProperty
(
"title"
,
QFileInfo
(
fileName
).
fileName
());
vc
->
setProperty
(
"fileName"
,
QDir
::
current
().
absoluteFilePath
(
fileName
));
TabWidgetElement
*
e
=
addCentralComponent
(
fileName
,
vc
,
editor
->
toolBarActions
(),
editor
->
menus
(),
type
,
true
);
type
);
e
->
editorInstance
=
editor
;
tabWidget_
->
setCurrentWidget
(
e
);
e
->
setFocus
();
...
...
@@ -913,8 +910,7 @@ void MainWindow::newText(const QString &fileName, const QString & text)
vc
,
editor
->
toolBarActions
(),
editor
->
menus
(),
Text
,
true
);
Text
);
e
->
editorInstance
=
editor
;
tabWidget_
->
setCurrentWidget
(
e
);
if
(
!
text
.
isEmpty
())
{
...
...
@@ -957,37 +953,23 @@ TabWidgetElement * MainWindow::addCentralComponent(
,
QWidget
*
c
,
const
QList
<
QAction
*>
&
toolbarActions
,
const
QList
<
QMenu
*>
&
menus
// , const QList<QWidget*> & statusbarWidgets
,
DocumentType
type
,
bool
enableToolBar
)
,
DocumentType
type
)
{
class
KumirProgram
*
kumir
=
0
;
class
PascalProgram
*
pascal
=
0
;
if
(
type
==
Program
)
{
kumir
=
m_plugin
->
kumirProgram_
;
}
TabWidgetElement
*
element
=
new
TabWidgetElement
(
c
,
enableToolBar
,
toolbarActions
,
menus
,
// statusbarWidgets,
type
,
gr_fileActions
,
gr_otherActions
,
kumir
,
pascal
);
TabWidgetElement
*
element
=
new
TabWidgetElement
(
c
,
type
!=
WWW
,
toolbarActions
,
menus
,
type
,
gr_fileActions
,
gr_otherActions
,
kumir
);
connect
(
element
,
SIGNAL
(
documentCleanChanged
(
bool
)),
this
,
SLOT
(
handleDocumentCleanChanged
(
bool
)));
createTopLevelMenus
(
menus
,
true
);
tabWidget_
->
addTab
(
element
,
title
);
return
element
;
}
void
MainWindow
::
createTopLevelMenus
(
const
QList
<
QMenu
*>
&
c
,
bool
tabDependent
)
{
QList
<
QMenu
*>
menus
;
...
...
@@ -1041,7 +1023,7 @@ void MainWindow::setupContentForTab()
void
MainWindow
::
disableTabs
()
{
tabWidget_
->
disableTabs
();
b_notabs
=
true
;
tabsDisabledFlag_
=
true
;
ui
->
actionClose
->
setVisible
(
false
);
ui
->
actionClose
->
setEnabled
(
false
);
ui
->
actionNewText
->
setVisible
(
false
);
...
...
@@ -1154,7 +1136,7 @@ void MainWindow::closeEvent(QCloseEvent *e)
{
// saveSettings();
// m_plugin->saveSession();
if
(
m_plugin
->
sessionsDisableFlag_
&&
b_notabs
)
{
if
(
m_plugin
->
sessionsDisableFlag_
&&
tabsDisabledFlag_
)
{
TabWidgetElement
*
twe
=
qobject_cast
<
TabWidgetElement
*>
(
tabWidget_
->
currentWidget
());
if
(
twe
->
editorInstance
)
{
bool
notSaved
=
twe
->
editorInstance
->
isModified
();
...
...
@@ -1277,7 +1259,7 @@ void MainWindow::fileOpen()
{
using
namespace
ExtensionSystem
;
using
namespace
Shared
;
if
(
b_notabs
)
{
if
(
tabsDisabledFlag_
)
{
TabWidgetElement
*
twe
=
qobject_cast
<
TabWidgetElement
*>
(
tabWidget_
->
currentWidget
());
if
(
twe
->
editorInstance
&&
twe
->
editorInstance
->
isModified
())
{
...
...
@@ -1320,7 +1302,7 @@ void MainWindow::fileOpen()
const
QString
languageName
=
analizer
->
languageName
();
const
QString
fileNameSuffix
=
analizer
->
defaultDocumentFileNameSuffix
();
filters
<<
tr
(
"%1 programs (*%2)"
).
arg
(
languageName
).
arg
(
fileNameSuffix
);
if
(
!
b_notabs
)
{
if
(
!
tabsDisabledFlag_
)
{
filters
<<
tr
(
"Web pages (*.html *.htm)"
);
filters
<<
tr
(
"Text files (*.txt)"
);
}
...
...
@@ -1419,7 +1401,7 @@ void MainWindow::addToRecent(const QString &fileName)
void
MainWindow
::
loadRecentFile
(
const
QString
&
fullPath
)
{
if
(
b_notabs
)
{
if
(
tabsDisabledFlag_
)
{
TabWidgetElement
*
twe
=
qobject_cast
<
TabWidgetElement
*>
(
tabWidget_
->
currentWidget
());
if
(
twe
->
editorInstance
&&
twe
->
editorInstance
->
isModified
())
{
...
...
@@ -1504,10 +1486,7 @@ TabWidgetElement * MainWindow::loadFromUrl(const QUrl & url, bool addToRecentFil
connect
(
vc
,
SIGNAL
(
requestHelpForAlgorithm
(
QString
)),
this
,
SLOT
(
showAlgorithmHelp
(
QString
)));
QString
fileName
=
QFileInfo
(
url
.
toLocalFile
()).
fileName
();
vc
->
setProperty
(
"fileName"
,
url
.
toLocalFile
());
vc
->
setProperty
(
"realFileName"
,
url
.
toLocalFile
());
vc
->
setProperty
(
"title"
,
fileName
);
if
(
b_notabs
)
{
if
(
tabsDisabledFlag_
)
{
while
(
tabWidget_
->
count
())
tabWidget_
->
removeTab
(
0
);
}
result
=
addCentralComponent
(
...
...
@@ -1515,8 +1494,7 @@ TabWidgetElement * MainWindow::loadFromUrl(const QUrl & url, bool addToRecentFil
vc
,
editor
->
toolBarActions
(),
editor
->
menus
(),
type
,
true
);
type
);
result
->
editorInstance
=
editor
;
tabWidget_
->
setCurrentIndex
(
tabWidget_
->
count
()
-
1
);
tabWidget_
->
currentWidget
()
->
setFocus
();
...
...
@@ -1527,7 +1505,7 @@ TabWidgetElement * MainWindow::loadFromUrl(const QUrl & url, bool addToRecentFil
Shared
::
Browser
::
InstanceInterface
*
browser
=
m_plugin
->
plugin_browser
->
createBrowser
(
url
,
m_plugin
->
m_browserObjects
);
browser
->
setTitleChangeHandler
(
this
,
SLOT
(
updateBrowserTitle
(
QString
,
const
Shared
::
Browser
::
InstanceInterface
*
)));
if
(
b_notabs
)
{
if
(
tabsDisabledFlag_
)
{
while
(
tabWidget_
->
count
())
tabWidget_
->
removeTab
(
0
);
}
result
=
addCentralComponent
(
...
...
@@ -1535,8 +1513,7 @@ TabWidgetElement * MainWindow::loadFromUrl(const QUrl & url, bool addToRecentFil
browser
->
widget
(),
QList
<
QAction
*>
(),
QList
<
QMenu
*>
(),
WWW
,
true
);
WWW
);
result
->
browserInstance
=
browser
;
tabWidget_
->
setCurrentIndex
(
tabWidget_
->
count
()
-
1
);
tabWidget_
->
currentWidget
()
->
setFocus
();
...
...
@@ -1560,28 +1537,35 @@ TabWidgetElement* MainWindow::loadFromCourseManager(
break
;
}
}
if
(
tabsDisabledFlag_
)
{
courseManagerTab
=
qobject_cast
<
TabWidgetElement
*>
(
tabWidget_
->
widget
(
0
));
Q_CHECK_PTR
(
courseManagerTab
);
}
if
(
data
.
language
==
ST
::
Kumir
)
{
QWidget
*
vc
=
nullptr
;
Shared
::
Editor
::
InstanceInterface
*
editor
=
m_plugin
->
plugin_editor
->
loadDocument
(
data
.
content
);
KumFile
::
Data
src
=
data
.
content
;
src
.
canonicalSourceLanguageName
=
"kum"
;
if
(
courseManagerTab
)
{
// Reuse opened course manager tab
QObject
*
oldEditor
=
dynamic_cast
<
QObject
*>
(
courseManagerTab
->
editorInstance
);
oldEditor
->
deleteLater
();
courseManagerTab
->
editorInstance
=
editor
;
// Reuse existing tab
Shared
::
Editor
::
InstanceInterface
*
editor
=
courseManagerTab
->
editorInstance
;
}
else
{
Shared
::
Editor
::
InstanceInterface
*
editor
=
m_plugin
->
plugin_editor
->
loadDocument
(
src
);
// Create new course manager tab
courseManagerTab
=
addCentralComponent
(
data
.
title
,
editor
->
widget
(),
editor
->
toolBarActions
(),
editor
->
menus
(),
Program
,
true
Program
);
courseManagerTab
->
editorInstance
=
editor
;
courseManagerTab
->
setCourseManagerTab
(
true
);
courseManagerTab
->
setCourseTitle
(
data
.
title
);
}
}
tabWidget_
->
setCurrentWidget
(
courseManagerTab
);
return
courseManagerTab
;
...
...
src/plugins/coregui/mainwindow.h
View file @
094e0091
...
...
@@ -38,9 +38,7 @@ public:
,
QWidget
*
c
,
const
QList
<
QAction
*>
&
toolbarActions
,
const
QList
<
QMenu
*>
&
menus
// , const QList<QWidget*> & statusbarWidgets
,
DocumentType
type
,
bool
enableToolBar
);
,
DocumentType
type
);
~
MainWindow
();
...
...
@@ -131,7 +129,7 @@ private:
QActionGroup
*
gr_fileActions
;
QActionGroup
*
gr_otherActions
;
bool
b_notabs
;
bool
tabsDisabledFlag_
;
// static QString StatusbarWidgetCSS;
...
...
src/plugins/coregui/plugin.cpp
View file @
094e0091
...
...
@@ -465,8 +465,7 @@ void Plugin::restoreSession()
startPage_
->
widget
(),
QList
<
QAction
*>
(),
QList
<
QMenu
*>
(),
MainWindow
::
WWW
,
false
MainWindow
::
WWW
);
twe
->
browserInstance
=
startPage_
;
}
...
...
src/plugins/coregui/tabwidgetelement.cpp
0 → 100644
View file @
094e0091
#include "tabwidgetelement.h"
namespace
CoreGUI
{
TabWidgetElement
::
TabWidgetElement
(
QWidget
*
w
,
bool
enableToolBar
,
QList
<
QAction
*>
toolbarActions
,
QList
<
QMenu
*>
ms
// , QList<QWidget*> sws
,
MainWindow
::
DocumentType
t
,
QActionGroup
*
gr_fileActions
,
QActionGroup
*
gr_otherActions
,
class
KumirProgram
*
kumir
)
:
QWidget
()
,
component
(
w
)
,
menus
(
ms
)
// , statusbarWidgets(sws)
,
type
(
t
)
,
editorInstance
(
nullptr
)
,
browserInstance
(
nullptr
)
,
kumirProgram_
(
kumir
)
,
courseManagerTab_
(
false
)
{
kumirProgram_
=
nullptr
;
Q_CHECK_PTR
(
w
);
Q_ASSERT
(
!
QString
::
fromAscii
(
w
->
metaObject
()
->
className
()).
isEmpty
());
setProperty
(
"uncloseable"
,
w
->
property
(
"uncloseable"
));
if
(
type
==
MainWindow
::
WWW
)
{
connect
(
w
,
SIGNAL
(
titleChanged
(
QString
)),
this
,
SIGNAL
(
changeTitle
(
QString
)));
}
else
{
connect
(
w
,
SIGNAL
(
documentCleanChanged
(
bool
)),
this
,
SIGNAL
(
documentCleanChanged
(
bool
)));
connect
(
w
,
SIGNAL
(
documentCleanChanged
(
bool
)),
this
,
SLOT
(
setDocumentChangesClean
(
bool
)));
}
QVBoxLayout
*
l
=
new
QVBoxLayout
;
l
->
setContentsMargins
(
0
,
0
,
0
,
0
);
l
->
setSpacing
(
0
);
setLayout
(
l
);
if
(
enableToolBar
)
{
if
(
!
toolbarActions
.
isEmpty
())
{
QToolBar
*
tb
=
new
QToolBar
(
this
);
tb
->
setIconSize
(
QSize
(
22
,
22
));
#ifdef Q_OS_MAC
static
const
char
*
css
=
""
"QToolBar {"
" border: 0px;"
" background-color: $windowColor;"
" padding: 8px;"
"}"
"QToolButton {"
" border: 0px;"
"}"
""
;
#else
static
const
char
*
css
=
""
"QToolBar { border: 0px }"
;
#endif
tb
->
setStyleSheet
(
QString
::
fromAscii
(
css
).
replace
(
"$windowColor"
,
palette
().
brush
(
QPalette
::
Window
).
color
().
name
()));
l
->
addWidget
(
tb
);
if
(
type
!=
MainWindow
::
WWW
)
{
tb
->
addActions
(
gr_fileActions
->
actions
());
}
tb
->
addSeparator
();
foreach
(
QAction
*
a
,
toolbarActions
)
tb
->
addAction
(
a
);
if
(
type
==
MainWindow
::
Program
)
{
tb
->
addSeparator
();
QList
<
QAction
*>
acts
=
kumir
->
actions
()
->
actions
();