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
bc83609f
Commit
bc83609f
authored
Feb 14, 2021
by
Alexander Semke
Browse files
When switching between the different worksheets, update the status bar
to properly show the status of the current worksheet.
parent
c71ffbcb
Pipeline
#50948
passed with stage
in 25 minutes and 31 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/cantor.cpp
View file @
bc83609f
...
...
@@ -18,6 +18,7 @@
Copyright (C) 2009 Alexander Rieder <alexanderrieder@gmail.com>
*/
#include "cantor.h"
#include "lib/session.h"
#include <cassert>
...
...
@@ -40,6 +41,7 @@
#include <QFileDialog>
#include <QPushButton>
#include <QRegularExpression>
#include <QStatusBar>
#include <QGraphicsView>
#include "lib/backend.h"
...
...
@@ -69,8 +71,8 @@ CantorShell::CantorShell() : KParts::MainWindow(), m_part(nullptr), m_panelHandl
m_tabWidget
->
setDocumentMode
(
true
);
setCentralWidget
(
m_tabWidget
);
connect
(
m_tabWidget
,
SIGNAL
(
currentChanged
(
int
))
,
this
,
SLOT
(
activateWorksheet
(
int
))
);
connect
(
m_tabWidget
,
SIGNAL
(
tabCloseRequested
(
int
))
,
this
,
SLOT
(
closeTab
(
int
))
);
connect
(
m_tabWidget
,
&
QTabWidget
::
currentChanged
,
this
,
&
CantorShell
::
activateWorksheet
);
connect
(
m_tabWidget
,
&
QTabWidget
::
tabCloseRequested
,
this
,
&
CantorShell
::
closeTab
);
// apply the saved mainwindow settings, if any, and ask the mainwindow
// to automatically save settings if changed: window size, toolbar
...
...
@@ -431,18 +433,39 @@ void CantorShell::activateWorksheet(int index)
m_pluginsStates
[
m_part
]
=
states
;
}
m_part
=
findPart
(
m_tabWidget
->
widget
(
index
));
if
(
m_part
)
if
(
index
!=
-
1
)
{
createGUI
(
m_part
);
m_part
=
findPart
(
m_tabWidget
->
widget
(
index
));
if
(
m_part
)
{
createGUI
(
m_part
);
updateWindowTitle
(
m_part
->
url
().
fileName
());
updatePanel
();
}
else
qDebug
()
<<
"selected part doesn't exist"
;
//update the status bar
auto
*
wa
=
m_part
->
findChild
<
Cantor
::
WorksheetAccessInterface
*>
(
Cantor
::
WorksheetAccessInterface
::
Name
);
if
(
wa
->
session
())
{
auto
status
=
wa
->
session
()
->
status
();
switch
(
status
)
{
case
Cantor
::
Session
::
Running
:
statusBar
()
->
showMessage
(
i18n
(
"Calculating..."
));
break
;
case
Cantor
::
Session
::
Done
:
statusBar
()
->
showMessage
(
i18n
(
"Ready"
));
break
;
case
Cantor
::
Session
::
Disable
:
statusBar
()
->
showMessage
(
QString
());
break
;
}
}
updateWindowTitle
(
m_part
->
url
().
fileName
());
updatePanel
();
}
else
qDebug
()
<<
"selected part doesn't exist"
;
m_tabWidget
->
setCurrentIndex
(
index
);
m_tabWidget
->
setCurrentIndex
(
index
);
}
}
void
CantorShell
::
setTabCaption
(
const
QString
&
caption
,
const
QIcon
&
icon
)
...
...
Write
Preview
Supports
Markdown
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