Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OpenBoard
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lifo
Nicolas Ollinger
OpenBoard
Commits
ab828a18
Commit
ab828a18
authored
11 years ago
by
Ilia Ryabokon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Document autosave facility
parent
c53320d6
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
76 additions
and
4 deletions
+76
-4
UBBoardController.cpp
src/board/UBBoardController.cpp
+54
-0
UBBoardController.h
src/board/UBBoardController.h
+17
-0
UBApplication.cpp
src/core/UBApplication.cpp
+2
-1
UBDownloadThread.cpp
src/core/UBDownloadThread.cpp
+0
-3
UBSettings.cpp
src/core/UBSettings.cpp
+1
-0
UBSettings.h
src/core/UBSettings.h
+2
-0
No files found.
src/board/UBBoardController.cpp
View file @
ab828a18
...
...
@@ -108,6 +108,7 @@ UBBoardController::UBBoardController(UBMainWindow* mainWindow)
,
mMovingSceneIndex
(
-
1
)
,
mActionGroupText
(
tr
(
"Group"
))
,
mActionUngroupText
(
tr
(
"Ungroup"
))
,
mAutosaveTimer
(
0
)
{
mZoomFactor
=
UBSettings
::
settings
()
->
boardZoomFactor
->
get
().
toDouble
();
...
...
@@ -395,6 +396,21 @@ void UBBoardController::stopScript()
freezeW3CWidgets
(
true
);
}
void
UBBoardController
::
saveData
(
SaveFlags
fls
)
{
bool
verbose
=
fls
|
sf_showProgress
;
if
(
verbose
)
{
UBApplication
::
showMessage
(
"Saving document..."
);
}
if
(
mActiveScene
&&
mActiveScene
->
isModified
())
{
persistCurrentScene
();
}
if
(
verbose
)
{
UBApplication
::
showMessage
(
"Document has just been saved..."
);
}
}
void
UBBoardController
::
initToolbarTexts
()
{
QList
<
QAction
*>
allToolbarActions
;
...
...
@@ -1647,6 +1663,14 @@ void UBBoardController::adjustDisplayViews()
}
int
UBBoardController
::
autosaveTimeoutFromSettings
()
{
int
value
=
UBSettings
::
settings
()
->
timerInterval
->
get
().
toInt
();
int
minute
=
60
*
1000
;
return
value
*
minute
;
}
void
UBBoardController
::
changeBackground
(
bool
isDark
,
bool
isCrossed
)
{
bool
currentIsDark
=
mActiveScene
->
isDarkBackground
();
...
...
@@ -1768,6 +1792,36 @@ void UBBoardController::documentSceneChanged(UBDocumentProxy* pDocumentProxy, in
}
}
void
UBBoardController
::
autosaveTimeout
()
{
if
(
UBApplication
::
applicationController
->
displayMode
()
!=
UBApplicationController
::
Board
)
{
//perform autosave only in board mode
return
;
}
saveData
(
sf_showProgress
);
}
void
UBBoardController
::
appMainModeChanged
(
UBApplicationController
::
MainMode
md
)
{
// int timerInterval = autosaveTimeoutFromSettings();
int
timerInterval
=
50000
;
if
(
!
timerInterval
)
{
return
;
}
if
(
!
mAutosaveTimer
)
{
mAutosaveTimer
=
new
QTimer
(
this
);
connect
(
mAutosaveTimer
,
SIGNAL
(
timeout
()),
this
,
SLOT
(
autosaveTimeout
()));
}
if
(
md
==
UBApplicationController
::
Board
)
{
mAutosaveTimer
->
start
(
timerInterval
);
}
else
if
(
mAutosaveTimer
->
isActive
())
{
mAutosaveTimer
->
stop
();
}
}
void
UBBoardController
::
closing
()
{
mIsClosing
=
true
;
...
...
This diff is collapsed.
Click to expand it.
src/board/UBBoardController.h
View file @
ab828a18
...
...
@@ -32,6 +32,7 @@
#include <QObject>
#include "document/UBDocumentContainer.h"
#include "core/UBApplicationController.h"
class
UBMainWindow
;
class
UBApplication
;
...
...
@@ -59,6 +60,13 @@ class UBBoardController : public UBDocumentContainer
{
Q_OBJECT
public
:
enum
SaveFlag
{
sf_none
=
0x0
,
sf_showProgress
=
0x1
};
Q_DECLARE_FLAGS
(
SaveFlags
,
SaveFlag
)
public
:
UBBoardController
(
UBMainWindow
*
mainWindow
);
virtual
~
UBBoardController
();
...
...
@@ -240,6 +248,8 @@ class UBBoardController : public UBDocumentContainer
void
startScript
();
void
stopScript
();
void
saveData
(
SaveFlags
fls
=
sf_none
);
signals
:
void
newPageAdded
();
void
activeSceneChanged
();
...
...
@@ -267,10 +277,15 @@ class UBBoardController : public UBDocumentContainer
void
undoRedoStateChange
(
bool
canUndo
);
void
documentSceneChanged
(
UBDocumentProxy
*
proxy
,
int
pIndex
);
private
slots
:
void
autosaveTimeout
();
void
appMainModeChanged
(
UBApplicationController
::
MainMode
);
private
:
void
updatePageSizeState
();
void
saveViewState
();
void
adjustDisplayViews
();
int
autosaveTimeoutFromSettings
();
UBMainWindow
*
mMainWindow
;
UBGraphicsScene
*
mActiveScene
;
...
...
@@ -298,6 +313,8 @@ class UBBoardController : public UBDocumentContainer
QString
mActionGroupText
;
QString
mActionUngroupText
;
QTimer
*
mAutosaveTimer
;
private
slots
:
void
stylusToolDoubleClicked
(
int
tool
);
void
boardViewResized
(
QResizeEvent
*
event
);
...
...
This diff is collapsed.
Click to expand it.
src/core/UBApplication.cpp
View file @
ab828a18
...
...
@@ -339,7 +339,8 @@ int UBApplication::exec(const QString& pFileToImport)
connect
(
applicationController
,
SIGNAL
(
desktopMode
(
bool
)),
boardController
->
paletteManager
(),
SLOT
(
slot_changeDesktopMode
(
bool
)));
connect
(
applicationController
,
SIGNAL
(
mainModeChanged
(
UBApplicationController
::
MainMode
))
,
boardController
,
SLOT
(
appMainModeChanged
(
UBApplicationController
::
MainMode
)));
connect
(
mainWindow
->
actionDesktop
,
SIGNAL
(
triggered
(
bool
)),
applicationController
,
SLOT
(
showDesktop
(
bool
)));
connect
(
mainWindow
->
actionDesktop
,
SIGNAL
(
triggered
(
bool
)),
this
,
SLOT
(
stopScript
()));
...
...
This diff is collapsed.
Click to expand it.
src/core/UBDownloadThread.cpp
View file @
ab828a18
...
...
@@ -22,9 +22,6 @@
* along with OpenBoard. If not, see <http://www.gnu.org/licenses/>.
*/
#include <QDebug>
#include <QNetworkProxy>
#include <QNetworkDiskCache>
...
...
This diff is collapsed.
Click to expand it.
src/core/UBSettings.cpp
View file @
ab828a18
...
...
@@ -352,6 +352,7 @@ void UBSettings::init()
boardShowToolsPalette
=
new
UBSetting
(
this
,
"Board"
,
"ShowToolsPalette"
,
"false"
);
magnifierDrawingMode
=
new
UBSetting
(
this
,
"Board"
,
"MagnifierDrawingMode"
,
"0"
);
timerInterval
=
new
UBSetting
(
this
,
"Board"
,
"Timer interval"
,
"5"
);
svgViewBoxMargin
=
new
UBSetting
(
this
,
"SVG"
,
"ViewBoxMargin"
,
"50"
);
...
...
This diff is collapsed.
Click to expand it.
src/core/UBSettings.h
View file @
ab828a18
...
...
@@ -373,6 +373,8 @@ class UBSettings : public QObject
UBSetting
*
libIconSize
;
UBSetting
*
magnifierDrawingMode
;
UBSetting
*
timerInterval
;
public
slots
:
void
setPenWidthIndex
(
int
index
);
...
...
This diff is collapsed.
Click to expand it.
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