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
023fddb6
Commit
023fddb6
authored
Oct 20, 2011
by
Ivan Ilin
Browse files
Options
Browse Files
Download
Plain Diff
resolved merge conflict
parents
6174a783
50062d9d
Changes
17
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
432 additions
and
106 deletions
+432
-106
teacher_close.png
resources/images/teacher_close.png
+0
-0
teacher_close_disabled.png
resources/images/teacher_close_disabled.png
+0
-0
teacher_open.png
resources/images/teacher_open.png
+0
-0
teacher_open_disabled.png
resources/images/teacher_open_disabled.png
+0
-0
sankore.qrc
resources/sankore.qrc
+2
-0
UBBoardPaletteManager.cpp
src/board/UBBoardPaletteManager.cpp
+105
-23
UBBoardPaletteManager.h
src/board/UBBoardPaletteManager.h
+10
-1
UBApplication.cpp
src/core/UBApplication.cpp
+9
-0
UBApplicationController.cpp
src/core/UBApplicationController.cpp
+0
-15
UBPersistenceManager.cpp
src/core/UBPersistenceManager.cpp
+86
-0
UBPersistenceManager.h
src/core/UBPersistenceManager.h
+18
-0
UBCachePropertiesWidget.cpp
src/gui/UBCachePropertiesWidget.cpp
+48
-27
UBDockPalette.cpp
src/gui/UBDockPalette.cpp
+30
-31
UBDockPalette.h
src/gui/UBDockPalette.h
+5
-3
UBDockPaletteWidget.h
src/gui/UBDockPaletteWidget.h
+4
-3
UBTeacherBarWidget.cpp
src/gui/UBTeacherBarWidget.cpp
+105
-3
UBTeacherBarWidget.h
src/gui/UBTeacherBarWidget.h
+10
-0
No files found.
resources/images/teacher_close.png
View replaced file @
6174a783
View file @
023fddb6
855 Bytes
|
W:
|
H:
1.02 KB
|
W:
|
H:
2-up
Swipe
Onion skin
resources/images/teacher_close_disabled.png
0 → 100644
View file @
023fddb6
1.02 KB
resources/images/teacher_open.png
View replaced file @
6174a783
View file @
023fddb6
842 Bytes
|
W:
|
H:
1.01 KB
|
W:
|
H:
2-up
Swipe
Onion skin
resources/images/teacher_open_disabled.png
0 → 100644
View file @
023fddb6
1.01 KB
resources/sankore.qrc
View file @
023fddb6
...
@@ -332,5 +332,7 @@
...
@@ -332,5 +332,7 @@
<file>images/moveUpDisabled.svg</file>
<file>images/moveUpDisabled.svg</file>
<file>images/teacher_close.png</file>
<file>images/teacher_close.png</file>
<file>images/teacher_open.png</file>
<file>images/teacher_open.png</file>
<file>images/teacher_close_disabled.png</file>
<file>images/teacher_open_disabled.png</file>
</qresource>
</qresource>
</RCC>
</RCC>
src/board/UBBoardPaletteManager.cpp
View file @
023fddb6
...
@@ -19,6 +19,7 @@
...
@@ -19,6 +19,7 @@
#include "frameworks/UBFileSystemUtils.h"
#include "frameworks/UBFileSystemUtils.h"
#include "core/UBApplication.h"
#include "core/UBApplication.h"
#include "core/UBApplicationController.h"
#include "core/UBSettings.h"
#include "core/UBSettings.h"
#include "core/UBSetting.h"
#include "core/UBSetting.h"
#include "core/UBDisplayManager.h"
#include "core/UBDisplayManager.h"
...
@@ -162,21 +163,20 @@ void UBBoardPaletteManager::setupDockPaletteWidgets()
...
@@ -162,21 +163,20 @@ void UBBoardPaletteManager::setupDockPaletteWidgets()
mpPageNavigWidget
=
new
UBPageNavigationWidget
();
mpPageNavigWidget
=
new
UBPageNavigationWidget
();
mpPageNavigWidget
->
registerMode
(
eUBDockPaletteWidget_BOARD
);
mpPageNavigWidget
->
registerMode
(
eUBDockPaletteWidget_BOARD
);
connect
(
this
,
SIGNAL
(
signal_changeMode
(
eUBDockPaletteWidgetMode
)),
mpPageNavigWidget
,
SLOT
(
slot_changeMode
(
eUBDockPaletteWidgetMode
)));
// connect(this, SIGNAL(signal_changeMode(eUBDockPaletteWidgetMode)), mpPageNavigWidget, SLOT(slot_changeMode(eUBDockPaletteWidgetMode)));
mpLibWidget
=
new
UBLibWidget
();
mpLibWidget
=
new
UBLibWidget
();
mpLibWidget
->
registerMode
(
eUBDockPaletteWidget_BOARD
);
mpLibWidget
->
registerMode
(
eUBDockPaletteWidget_BOARD
);
mpLibWidget
->
registerMode
(
eUBDockPaletteWidget_DESKTOP
);
mpLibWidget
->
registerMode
(
eUBDockPaletteWidget_DESKTOP
);
// connect(this, SIGNAL(signal_changeMode(eUBDockPaletteWidgetMode)), mpLibWidget, SLOT(slot_changeMode(eUBDockPaletteWidgetMode)));
connect
(
this
,
SIGNAL
(
signal_changeMode
(
eUBDockPaletteWidgetMode
)),
mpLibWidget
,
SLOT
(
slot_changeMode
(
eUBDockPaletteWidgetMode
)));
mpCachePropWidget
=
new
UBCachePropertiesWidget
();
mpCachePropWidget
->
registerMode
(
eUBDockPaletteWidget_BOARD
);
// mpCachePropWidget = new UBCachePropertiesWidget();
// connect(this, SIGNAL(signal_changeMode(eUBDockPaletteWidgetMode)), mpCachePropWidget, SLOT(slot_changeMode(eUBDockPaletteWidgetMode)));
// mpCachePropWidget->registerMode(eUBDockPaletteWidget_BOARD);
// connect(this, SIGNAL(signal_changeMode(eUBDockPaletteWidgetMode)), mpCachePropWidget, SLOT(slot_changeMode(eUBDockPaletteWidgetMode)));
mpTeacherBarWidget
=
new
UBTeacherBarWidget
();
mpTeacherBarWidget
=
new
UBTeacherBarWidget
();
mpTeacherBarWidget
->
registerMode
(
eUBDockPaletteWidget_BOARD
);
mpTeacherBarWidget
->
registerMode
(
eUBDockPaletteWidget_BOARD
);
connect
(
this
,
SIGNAL
(
signal_changeMode
(
eUBDockPaletteWidgetMode
)),
mpTeacherBarWidget
,
SLOT
(
slot_changeMode
(
eUBDockPaletteWidgetMode
)));
// connect(this, SIGNAL(signal_changeMode(eUBDockPaletteWidgetMode)), mpTeacherBarWidget, SLOT(slot_changeMode(eUBDockPaletteWidgetMode)));
//------------------------------------------------//
//------------------------------------------------//
// Add the dock palettes
// Add the dock palettes
...
@@ -184,7 +184,7 @@ void UBBoardPaletteManager::setupDockPaletteWidgets()
...
@@ -184,7 +184,7 @@ void UBBoardPaletteManager::setupDockPaletteWidgets()
// LEFT palette widgets
// LEFT palette widgets
mLeftPalette
->
registerWidget
(
mpPageNavigWidget
);
mLeftPalette
->
registerWidget
(
mpPageNavigWidget
);
mLeftPalette
->
addTab
Widget
(
mpPageNavigWidget
);
mLeftPalette
->
addTab
(
mpPageNavigWidget
);
mLeftPalette
->
connectSignals
();
mLeftPalette
->
connectSignals
();
...
@@ -194,24 +194,62 @@ void UBBoardPaletteManager::setupDockPaletteWidgets()
...
@@ -194,24 +194,62 @@ void UBBoardPaletteManager::setupDockPaletteWidgets()
// RIGHT palette widgets
// RIGHT palette widgets
mRightPalette
->
registerWidget
(
mpLibWidget
);
mRightPalette
->
registerWidget
(
mpLibWidget
);
mRightPalette
->
addTab
Widget
(
mpLibWidget
);
mRightPalette
->
addTab
(
mpLibWidget
);
//
// ???
// ???
//
mRightPalette->registerWidget(mpCachePropWidget);
mRightPalette
->
registerWidget
(
mpCachePropWidget
);
//
mRightPalette->addTabWidget
(mpCachePropWidget);
//
mRightPalette->addTab
(mpCachePropWidget);
//
// ???
// ???
mRightPalette
->
registerWidget
(
mpTeacherBarWidget
);
mRightPalette
->
registerWidget
(
mpTeacherBarWidget
);
mRightPalette
->
addTabWidget
(
mpTeacherBarWidget
);
mRightPalette
->
addTab
(
mpTeacherBarWidget
);
mRightPalette
->
connectSignals
();
mRightPalette
->
connectSignals
();
//------------------------------------------------//
//------------------------------------------------//
mLeftPalette
->
showTabWidget
(
0
);
changeMode
(
eUBDockPaletteWidget_BOARD
,
true
);
mRightPalette
->
showTabWidget
(
0
);
//------------------------------------------------//
//------------------------------------------------//
// mLeftPalette->showTabWidget(0);
// mRightPalette->showTabWidget(0);
//
// //------------------------------------------------//
}
void
UBBoardPaletteManager
::
slot_changeMainMode
(
UBApplicationController
::
MainMode
mainMode
)
{
switch
(
mainMode
)
{
case
UBApplicationController
:
:
Board
:
// call changeMode only when switch NOT from desktop mode
if
(
!
UBApplication
::
applicationController
->
isShowingDesktop
())
changeMode
(
eUBDockPaletteWidget_BOARD
);
break
;
default
:
break
;
}
}
void
UBBoardPaletteManager
::
slot_changeDesktopMode
(
bool
isDesktop
)
{
UBApplicationController
::
MainMode
currMode
=
UBApplication
::
applicationController
->
displayMode
();
if
(
!
isDesktop
)
{
switch
(
currMode
)
{
case
UBApplicationController
:
:
Board
:
changeMode
(
eUBDockPaletteWidget_BOARD
);
break
;
default
:
break
;
}
}
else
changeMode
(
eUBDockPaletteWidget_DESKTOP
);
}
}
void
UBBoardPaletteManager
::
setupPalettes
()
void
UBBoardPaletteManager
::
setupPalettes
()
...
@@ -444,6 +482,8 @@ void UBBoardPaletteManager::connectPalettes()
...
@@ -444,6 +482,8 @@ void UBBoardPaletteManager::connectPalettes()
}
}
void
UBBoardPaletteManager
::
containerResized
()
void
UBBoardPaletteManager
::
containerResized
()
{
{
int
innerMargin
=
UBSettings
::
boardMargin
;
int
innerMargin
=
UBSettings
::
boardMargin
;
...
@@ -604,8 +644,39 @@ void UBBoardPaletteManager::addItem(const QUrl& pUrl)
...
@@ -604,8 +644,39 @@ void UBBoardPaletteManager::addItem(const QUrl& pUrl)
}
}
void
UBBoardPaletteManager
::
changeMode
(
eUBDockPaletteWidgetMode
newM
ode
)
void
UBBoardPaletteManager
::
processPalettersWidget
(
UBDockPalette
*
paletter
,
eUBDockPaletteWidgetMode
m
ode
)
{
{
//-------------------------------//
// get full right palette widgets list, parse it, show all widgets for BOARD mode, and hide all other
QVector
<
UBDockPaletteWidget
*>
widgetsList
=
paletter
->
GetWidgetsList
();
for
(
int
i
=
0
;
i
<
widgetsList
.
size
();
i
++
)
{
UBDockPaletteWidget
*
pNextWidget
=
widgetsList
.
at
(
i
);
if
(
pNextWidget
!=
NULL
)
{
if
(
pNextWidget
->
GetRegisteredModes
().
contains
(
mode
)
)
{
paletter
->
addTab
(
pNextWidget
);
}
else
{
paletter
->
removeTab
(
pNextWidget
->
name
());
}
}
}
//-------------------------------//
if
(
widgetsList
.
size
()
>
0
)
paletter
->
showTabWidget
(
0
);
paletter
->
update
();
}
void
UBBoardPaletteManager
::
changeMode
(
eUBDockPaletteWidgetMode
newMode
,
bool
isInit
)
{
processPalettersWidget
(
mRightPalette
,
newMode
);
processPalettersWidget
(
mLeftPalette
,
newMode
);
switch
(
newMode
)
switch
(
newMode
)
{
{
case
eUBDockPaletteWidget_BOARD
:
case
eUBDockPaletteWidget_BOARD
:
...
@@ -616,7 +687,8 @@ void UBBoardPaletteManager::changeMode(eUBDockPaletteWidgetMode newMode)
...
@@ -616,7 +687,8 @@ void UBBoardPaletteManager::changeMode(eUBDockPaletteWidgetMode newMode)
mLeftPalette
->
setVisible
(
true
);
mLeftPalette
->
setVisible
(
true
);
mRightPalette
->
setVisible
(
true
);
mRightPalette
->
setVisible
(
true
);
containerResized
();
if
(
!
isInit
)
containerResized
();
}
}
break
;
break
;
...
@@ -628,7 +700,8 @@ void UBBoardPaletteManager::changeMode(eUBDockPaletteWidgetMode newMode)
...
@@ -628,7 +700,8 @@ void UBBoardPaletteManager::changeMode(eUBDockPaletteWidgetMode newMode)
mLeftPalette
->
setVisible
(
false
);
mLeftPalette
->
setVisible
(
false
);
mRightPalette
->
setVisible
(
true
);
mRightPalette
->
setVisible
(
true
);
UBApplication
::
applicationController
->
uninotesController
()
->
TransparentWidgetResized
();
if
(
!
isInit
)
UBApplication
::
applicationController
->
uninotesController
()
->
TransparentWidgetResized
();
}
}
break
;
break
;
...
@@ -642,6 +715,9 @@ void UBBoardPaletteManager::changeMode(eUBDockPaletteWidgetMode newMode)
...
@@ -642,6 +715,9 @@ void UBBoardPaletteManager::changeMode(eUBDockPaletteWidgetMode newMode)
break
;
break
;
}
}
if
(
!
isInit
)
UBApplication
::
boardController
->
notifyPageChanged
();
emit
signal_changeMode
(
newMode
);
emit
signal_changeMode
(
newMode
);
}
}
...
@@ -818,3 +894,9 @@ void UBBoardPaletteManager::connectToDocumentController()
...
@@ -818,3 +894,9 @@ void UBBoardPaletteManager::connectToDocumentController()
{
{
emit
connectToDocController
();
emit
connectToDocController
();
}
}
void
UBBoardPaletteManager
::
refreshPalettes
()
{
mRightPalette
->
update
();
mLeftPalette
->
update
();
}
\ No newline at end of file
src/board/UBBoardPaletteManager.h
View file @
023fddb6
...
@@ -27,6 +27,9 @@
...
@@ -27,6 +27,9 @@
#include "gui/UBCachePropertiesWidget.h"
#include "gui/UBCachePropertiesWidget.h"
#include "gui/UBTeacherBarWidget.h"
#include "gui/UBTeacherBarWidget.h"
#include "core/UBApplicationController.h"
class
UBStylusPalette
;
class
UBStylusPalette
;
class
UBClockPalette
;
class
UBClockPalette
;
class
UBPageNumberPalette
;
class
UBPageNumberPalette
;
...
@@ -37,6 +40,7 @@ class UBFloatingPalette;
...
@@ -37,6 +40,7 @@ class UBFloatingPalette;
class
UBServerXMLHttpRequest
;
class
UBServerXMLHttpRequest
;
class
UBKeyboardPalette
;
class
UBKeyboardPalette
;
class
UBMainWindow
;
class
UBMainWindow
;
class
UBApplicationController
;
class
UBBoardPaletteManager
:
public
QObject
class
UBBoardPaletteManager
:
public
QObject
{
{
...
@@ -52,11 +56,14 @@ class UBBoardPaletteManager : public QObject
...
@@ -52,11 +56,14 @@ class UBBoardPaletteManager : public QObject
void
showVirtualKeyboard
(
bool
show
=
true
);
void
showVirtualKeyboard
(
bool
show
=
true
);
void
initPalettesPosAtStartup
();
void
initPalettesPosAtStartup
();
void
connectToDocumentController
();
void
connectToDocumentController
();
void
refreshPalettes
();
UBKeyboardPalette
*
mKeyboardPalette
;
UBKeyboardPalette
*
mKeyboardPalette
;
// UBRightPalette* createDesktopRightPalette(QWidget* parent);
// UBRightPalette* createDesktopRightPalette(QWidget* parent);
void
changeMode
(
eUBDockPaletteWidgetMode
newMode
);
void
processPalettersWidget
(
UBDockPalette
*
paletter
,
eUBDockPaletteWidgetMode
mode
);
void
changeMode
(
eUBDockPaletteWidgetMode
newMode
,
bool
isInit
=
false
);
signals
:
signals
:
void
connectToDocController
();
void
connectToDocController
();
...
@@ -70,6 +77,8 @@ class UBBoardPaletteManager : public QObject
...
@@ -70,6 +77,8 @@ class UBBoardPaletteManager : public QObject
void
addItem
(
const
QPixmap
&
pPixmap
,
const
QPointF
&
p
=
QPointF
(
0
.
0
,
0
.
0
),
qreal
scale
=
1
.
0
,
const
QUrl
&
sourceUrl
=
QUrl
());
void
addItem
(
const
QPixmap
&
pPixmap
,
const
QPointF
&
p
=
QPointF
(
0
.
0
,
0
.
0
),
qreal
scale
=
1
.
0
,
const
QUrl
&
sourceUrl
=
QUrl
());
// void slot_changeMode(eUBDockPaletteWidgetMode newMode);
// void slot_changeMode(eUBDockPaletteWidgetMode newMode);
void
slot_changeMainMode
(
UBApplicationController
::
MainMode
);
void
slot_changeDesktopMode
(
bool
);
private
:
private
:
...
...
src/core/UBApplication.cpp
View file @
023fddb6
...
@@ -244,6 +244,15 @@ int UBApplication::exec(const QString& pFileToImport)
...
@@ -244,6 +244,15 @@ int UBApplication::exec(const QString& pFileToImport)
applicationController
=
new
UBApplicationController
(
boardController
->
controlView
(),
boardController
->
displayView
(),
mainWindow
,
staticMemoryCleaner
);
applicationController
=
new
UBApplicationController
(
boardController
->
controlView
(),
boardController
->
displayView
(),
mainWindow
,
staticMemoryCleaner
);
connect
(
applicationController
,
SIGNAL
(
mainModeChanged
(
UBApplicationController
::
MainMode
)),
boardController
->
paletteManager
(),
SLOT
(
slot_changeMainMode
(
UBApplicationController
::
MainMode
)));
connect
(
applicationController
,
SIGNAL
(
desktopMode
(
bool
)),
boardController
->
paletteManager
(),
SLOT
(
slot_changeDesktopMode
(
bool
)));
connect
(
mainWindow
->
actionDesktop
,
SIGNAL
(
triggered
(
bool
)),
applicationController
,
SLOT
(
showDesktop
(
bool
)));
connect
(
mainWindow
->
actionDesktop
,
SIGNAL
(
triggered
(
bool
)),
applicationController
,
SLOT
(
showDesktop
(
bool
)));
#ifndef Q_WS_MAC
#ifndef Q_WS_MAC
connect
(
mainWindow
->
actionHideApplication
,
SIGNAL
(
triggered
()),
mainWindow
,
SLOT
(
showMinimized
()));
connect
(
mainWindow
->
actionHideApplication
,
SIGNAL
(
triggered
()),
mainWindow
,
SLOT
(
showMinimized
()));
...
...
src/core/UBApplicationController.cpp
View file @
023fddb6
...
@@ -336,7 +336,6 @@ void UBApplicationController::showBoard()
...
@@ -336,7 +336,6 @@ void UBApplicationController::showBoard()
mMainWindow
->
boardToolBar
->
show
();
mMainWindow
->
boardToolBar
->
show
();
mMainMode
=
Board
;
mMainMode
=
Board
;
UBApplication
::
boardController
->
paletteManager
()
->
changeMode
(
eUBDockPaletteWidget_BOARD
);
adaptToolBar
();
adaptToolBar
();
...
@@ -353,8 +352,6 @@ void UBApplicationController::showBoard()
...
@@ -353,8 +352,6 @@ void UBApplicationController::showBoard()
mUninoteController
->
hideWindow
();
mUninoteController
->
hideWindow
();
mMainWindow
->
show
();
mMainWindow
->
show
();
// UBApplication::boardController->paletteManager()->changeMode(eUBDockPaletteWidget_BOARD);
emit
mainModeChanged
(
Board
);
emit
mainModeChanged
(
Board
);
}
}
...
@@ -368,8 +365,6 @@ void UBApplicationController::showInternet()
...
@@ -368,8 +365,6 @@ void UBApplicationController::showInternet()
UBApplication
::
boardController
->
hide
();
UBApplication
::
boardController
->
hide
();
}
}
UBApplication
::
boardController
->
paletteManager
()
->
changeMode
(
eUBDockPaletteWidget_WEB
);
if
(
UBSettings
::
settings
()
->
webUseExternalBrowser
->
get
().
toBool
())
if
(
UBSettings
::
settings
()
->
webUseExternalBrowser
->
get
().
toBool
())
{
{
showDesktop
(
true
);
showDesktop
(
true
);
...
@@ -390,8 +385,6 @@ void UBApplicationController::showInternet()
...
@@ -390,8 +385,6 @@ void UBApplicationController::showInternet()
emit
mainModeChanged
(
Internet
);
emit
mainModeChanged
(
Internet
);
}
}
// UBApplication::boardController->paletteManager()->changeMode(eUBDockPaletteWidget_WEB);
UBApplication
::
webController
->
show
(
UBWebController
::
WebBrowser
);
UBApplication
::
webController
->
show
(
UBWebController
::
WebBrowser
);
}
}
...
@@ -404,7 +397,6 @@ void UBApplicationController::showDocument()
...
@@ -404,7 +397,6 @@ void UBApplicationController::showDocument()
mMainWindow
->
documentToolBar
->
show
();
mMainWindow
->
documentToolBar
->
show
();
mMainMode
=
Document
;
mMainMode
=
Document
;
UBApplication
::
boardController
->
paletteManager
()
->
changeMode
(
eUBDockPaletteWidget_DOCUMENT
);
adaptToolBar
();
adaptToolBar
();
...
@@ -426,8 +418,6 @@ void UBApplicationController::showDocument()
...
@@ -426,8 +418,6 @@ void UBApplicationController::showDocument()
mUninoteController
->
hideWindow
();
mUninoteController
->
hideWindow
();
// UBApplication::boardController->paletteManager()->changeMode(eUBDockPaletteWidget_DOCUMENT);
emit
mainModeChanged
(
Document
);
emit
mainModeChanged
(
Document
);
}
}
...
@@ -439,8 +429,6 @@ void UBApplicationController::showDesktop(bool dontSwitchFrontProcess)
...
@@ -439,8 +429,6 @@ void UBApplicationController::showDesktop(bool dontSwitchFrontProcess)
UBApplication
::
boardController
->
hide
();
UBApplication
::
boardController
->
hide
();
mMainWindow
->
hide
();
mMainWindow
->
hide
();
UBApplication
::
boardController
->
paletteManager
()
->
changeMode
(
eUBDockPaletteWidget_DESKTOP
);
mUninoteController
->
showWindow
();
mUninoteController
->
showWindow
();
if
(
mMirror
)
if
(
mMirror
)
...
@@ -456,8 +444,6 @@ void UBApplicationController::showDesktop(bool dontSwitchFrontProcess)
...
@@ -456,8 +444,6 @@ void UBApplicationController::showDesktop(bool dontSwitchFrontProcess)
UBPlatformUtils
::
bringPreviousProcessToFront
();
UBPlatformUtils
::
bringPreviousProcessToFront
();
}
}
// UBApplication::boardController->paletteManager()->changeMode(eUBDockPaletteWidget_DESKTOP);
UBDrawingController
::
drawingController
()
->
setStylusTool
(
UBStylusTool
::
Selector
);
UBDrawingController
::
drawingController
()
->
setStylusTool
(
UBStylusTool
::
Selector
);
}
}
...
@@ -627,7 +613,6 @@ void UBApplicationController::hideDesktop()
...
@@ -627,7 +613,6 @@ void UBApplicationController::hideDesktop()
emit
desktopMode
(
false
);
emit
desktopMode
(
false
);
}
}
void
UBApplicationController
::
setMirrorSourceWidget
(
QWidget
*
pWidget
)
void
UBApplicationController
::
setMirrorSourceWidget
(
QWidget
*
pWidget
)
{
{
if
(
mMirror
)
if
(
mMirror
)
...
...
src/core/UBPersistenceManager.cpp
View file @
023fddb6
...
@@ -1059,3 +1059,89 @@ bool UBPersistenceManager::mayHaveWidget(UBDocumentProxy* pDocumentProxy)
...
@@ -1059,3 +1059,89 @@ bool UBPersistenceManager::mayHaveWidget(UBDocumentProxy* pDocumentProxy)
return
widgetDir
.
exists
()
&&
widgetDir
.
entryInfoList
(
QDir
::
Dirs
).
length
()
>
0
;
return
widgetDir
.
exists
()
&&
widgetDir
.
entryInfoList
(
QDir
::
Dirs
).
length
()
>
0
;
}
}
void
UBPersistenceManager
::
persistTeacherBar
(
UBDocumentProxy
*
pDocumentProxy
,
int
page
,
sTeacherBarInfos
infos
)
{
if
(
NULL
!=
pDocumentProxy
)
{
QFile
f
(
pDocumentProxy
->
persistencePath
()
+
UBFileSystemUtils
::
digitFileFormat
(
"/page%1.svg"
,
page
+
1
));
if
(
f
.
exists
())
{
if
(
f
.
open
(
QIODevice
::
ReadOnly
))
{
QDomDocument
domDoc
;
if
(
domDoc
.
setContent
(
f
.
readAll
()))
{
f
.
close
();
if
(
f
.
open
(
QIODevice
::
WriteOnly
))
{
QDomElement
rootElem
=
domDoc
.
documentElement
();
QDomNode
teacherBarNode
=
domDoc
.
namedItem
(
"teacherBar"
);
if
(
teacherBarNode
.
isNull
())
{
// Create the element
QDomElement
teacherElem
=
domDoc
.
createElement
(
"teacherBar"
);
rootElem
.
appendChild
(
teacherElem
);
teacherBarNode
=
teacherElem
;
}
// Set the <teacherBar> element values
QDomElement
teacherBarElem
=
teacherBarNode
.
toElement
();
teacherBarElem
.
setAttribute
(
"title"
,
infos
.
title
);
teacherBarElem
.
setAttribute
(
"phasis"
,
infos
.
phasis
);
teacherBarElem
.
setAttribute
(
"duration"
,
infos
.
Duration
);
teacherBarElem
.
setAttribute
(
"equipment"
,
infos
.
material
);
teacherBarElem
.
setAttribute
(
"activity"
,
infos
.
activity
);
teacherBarElem
.
setAttribute
(
"action1Teacher"
,
infos
.
action1Master
);
teacherBarElem
.
setAttribute
(
"action1Student"
,
infos
.
action1Student
);
teacherBarElem
.
setAttribute
(
"action2Teacher"
,
infos
.
action2Master
);
teacherBarElem
.
setAttribute
(
"action2Student"
,
infos
.
action2Student
);
teacherBarElem
.
setAttribute
(
"action3Teacher"
,
infos
.
action3Master
);
teacherBarElem
.
setAttribute
(
"action3Student"
,
infos
.
action3Student
);
// Save the file
f
.
write
(
domDoc
.
toString
().
toAscii
());
f
.
close
();
}
}
f
.
close
();
}
}
}
}
sTeacherBarInfos
UBPersistenceManager
::
getTeacherBarInfos
(
UBDocumentProxy
*
pDocumentProxy
,
int
page
)
{
sTeacherBarInfos
infos
;
if
(
NULL
!=
pDocumentProxy
)
{
QFile
f
(
pDocumentProxy
->
persistencePath
()
+
UBFileSystemUtils
::
digitFileFormat
(
"/page%1.svg"
,
page
+
1
));
if
(
f
.
exists
())
{
if
(
f
.
open
(
QIODevice
::
ReadWrite
))
{
QDomDocument
domDoc
;
if
(
domDoc
.
setContent
(
f
.
readAll
()))
{
QDomElement
rootElem
=
domDoc
.
documentElement
();
QDomNode
teacherBarNode
=
rootElem
.
namedItem
(
"teacherBar"
);
infos
.
title
=
teacherBarNode
.
toElement
().
attributeNode
(
"title"
).
value
();
infos
.
phasis
=
teacherBarNode
.
toElement
().
attributeNode
(
"phasis"
).
value
().
toInt
();
infos
.
Duration
=
teacherBarNode
.
toElement
().
attributeNode
(
"duration"
).
value
().
toInt
();
infos
.
material
=
teacherBarNode
.
toElement
().
attributeNode
(
"equipment"
).
value
();
infos
.
activity
=
teacherBarNode
.
toElement
().
attributeNode
(
"activity"
).
value
().
toInt
();
infos
.
action1Master
=
teacherBarNode
.
toElement
().
attributeNode
(
"action1Teacher"
).
value
();
infos
.
action1Student
=
teacherBarNode
.
toElement
().
attributeNode
(
"action1Student"
).
value
();
infos
.
action2Master
=
teacherBarNode
.
toElement
().
attributeNode
(
"action2Teacher"
).
value
();
infos
.
action2Student
=
teacherBarNode
.
toElement
().
attributeNode
(
"action2Student"
).
value
();
infos
.
action3Master
=
teacherBarNode
.
toElement
().
attributeNode
(
"action3Teacher"
).
value
();
infos
.
action3Student
=
teacherBarNode
.
toElement
().
attributeNode
(
"action3Student"
).
value
();
}
f
.
close
();
}
}
}
return
infos
;
}
src/core/UBPersistenceManager.h
View file @
023fddb6
...
@@ -20,6 +20,21 @@
...
@@ -20,6 +20,21 @@
#include "UBSceneCache.h"
#include "UBSceneCache.h"
struct
sTeacherBarInfos
{
QString
title
;
int
phasis
;
int
Duration
;
QString
material
;
int
activity
;
QString
action1Master
;
QString
action1Student
;
QString
action2Master
;
QString
action2Student
;
QString
action3Master
;
QString
action3Student
;
};
class
UBDocument
;
class
UBDocument
;
class
UBDocumentProxy
;
class
UBDocumentProxy
;
class
UBGraphicsScene
;
class
UBGraphicsScene
;
...
@@ -60,6 +75,9 @@ class UBPersistenceManager : public QObject
...
@@ -60,6 +75,9 @@ class UBPersistenceManager : public QObject
virtual
void
persistDocumentScene
(
UBDocumentProxy
*
pDocumentProxy
,
virtual
void
persistDocumentScene
(
UBDocumentProxy
*
pDocumentProxy
,
UBGraphicsScene
*
pScene
,
const
int
pSceneIndex
);
UBGraphicsScene
*
pScene
,
const
int
pSceneIndex
);
virtual
void
persistTeacherBar
(
UBDocumentProxy
*
pDocumentProxy
,
int
page
,
sTeacherBarInfos
infos
);
sTeacherBarInfos
getTeacherBarInfos
(
UBDocumentProxy
*
pDocumentProxy
,
int
page
);
virtual
UBGraphicsScene
*
createDocumentSceneAt
(
UBDocumentProxy
*
pDocumentProxy
,
int
index
);
virtual
UBGraphicsScene
*
createDocumentSceneAt
(
UBDocumentProxy
*
pDocumentProxy
,
int
index
);
virtual
void
insertDocumentSceneAt
(
UBDocumentProxy
*
pDocumentProxy
,
UBGraphicsScene
*
scene
,
int
index
);
virtual
void
insertDocumentSceneAt
(
UBDocumentProxy
*
pDocumentProxy
,
UBGraphicsScene
*
scene
,
int
index
);
...
...
src/gui/UBCachePropertiesWidget.cpp
View file @
023fddb6
...
@@ -6,6 +6,7 @@
...
@@ -6,6 +6,7 @@
#include "UBCachePropertiesWidget.h"
#include "UBCachePropertiesWidget.h"
#include "core/UBApplication.h"
#include "core/UBApplication.h"
#include "core/UBApplicationController.h"
#include "board/UBBoardController.h"
#include "board/UBBoardController.h"
#include "domain/UBGraphicsScene.h"
#include "domain/UBGraphicsScene.h"
...
@@ -269,40 +270,59 @@ void UBCachePropertiesWidget::updateShapeButtons()
...
@@ -269,40 +270,59 @@ void UBCachePropertiesWidget::updateShapeButtons()
void
UBCachePropertiesWidget
::
updateCurrentCache
()
void
UBCachePropertiesWidget
::
updateCurrentCache
()
{
{
// Get the current page cache
bool
isBoardMode
=
false
;
QList
<
QGraphicsItem
*>
items
=
UBApplication
::
boardController
->
activeScene
()
->
items
();
// this widget can work only on Board mode
foreach
(
QGraphicsItem
*
it
,
items
)
if
(
UBApplication
::
applicationController
!=
NULL
)
{
{
if
(
"Cache"
==
it
->
data
(
Qt
::
UserRole
).
toString
())
// if app controller is available, and current mode is Board, and no show desktop, than all ok, just process
{
if
(
UBApplication
::
applicationController
->
displayMode
()
==
UBApplicationController
::
Board
&&
setEnabled
(
true
);
!
UBApplication
::
applicationController
->
isShowingDesktop
())
emit
showTab
(
name
());
isBoardMode
=
true
;
mpCurrentCache
=
dynamic_cast
<
UBGraphicsCache
*>
(
it
);
}
if
((
NULL
!=
mpCurrentCache
)
&&
(
!
mCaches
.
contains
(
mpCurrentCache
)))
// if app controller == null, than we do not know what mode now, so just process
{
else
mCaches
.
append
(
mpCurrentCache
);
isBoardMode
=
true
;
}
// Update the values of the cache properties
if
(
isBoardMode
)
mpSizeSlider
->
setValue
(
mpCurrentCache
->
shapeWidth
());
{
updateCacheColor
(
mpCurrentCache
->
maskColor
());
// Get the current page cache
switch
(
mpCurrentCache
->
maskshape
())
QList
<
QGraphicsItem
*>
items
=
UBApplication
::
boardController
->
activeScene
()
->
items
();
foreach
(
QGraphicsItem
*
it
,
items
)
{
if
(
"Cache"
==
it
->
data
(
Qt
::
UserRole
).
toString
())
{
{
case
eMaskShape_Circle
:
setEnabled
(
true
);
mpCircleButton
->
setChecked
(
true
);
emit
showTab
(
name
());
mpSquareButton
->
setChecked
(
false
);
mpCurrentCache
=
dynamic_cast
<
UBGraphicsCache
*>
(
it
);
break
;
if
((
NULL
!=
mpCurrentCache
)
&&
(
!
mCaches
.
contains
(
mpCurrentCache
)))
case
eMaskShap_Rectangle
:
{
mpCircleButton
->
setChecked
(
false
);
mCaches
.
append
(
mpCurrentCache
);
mpSquareButton
->
setChecked
(
true
);
}
break
;
// Update the values of the cache properties
mpSizeSlider
->
setValue
(
mpCurrentCache
->
shapeWidth
());
updateCacheColor
(
mpCurrentCache
->
maskColor
());
switch
(
mpCurrentCache
->
maskshape
())
{
case
eMaskShape_Circle
:
mpCircleButton
->
setChecked
(
true
);
mpSquareButton
->
setChecked
(
false
);
break
;
case
eMaskShap_Rectangle
:
mpCircleButton
->
setChecked
(
false
);
mpSquareButton
->
setChecked
(
true
);
break
;
}
return
;
}
}
return
;
}
}
}
}
// If we fall here, that means that this page has no cache
// If we fall here, that means:
// 1 - that this page has no cache
// 2 - we do not on Board page
// 3 - we in board mode, but show desktop (as really - desktop mode)
emit
hideTab
(
name
());
emit
hideTab
(
name
());
mpCurrentCache
=
NULL
;
mpCurrentCache
=
NULL
;
setDisabled
(
true
);
setDisabled
(
true
);
...
@@ -320,3 +340,4 @@ void UBCachePropertiesWidget::onCacheEnabled()
...
@@ -320,3 +340,4 @@ void UBCachePropertiesWidget::onCacheEnabled()
{
{
emit
showTab
(
name
());
emit
showTab
(
name
());
}
}
\ No newline at end of file
src/gui/UBDockPalette.cpp
View file @
023fddb6
...
@@ -57,15 +57,15 @@ UBDockPalette::UBDockPalette(QWidget *parent, const char *name)
...
@@ -57,15 +57,15 @@ UBDockPalette::UBDockPalette(QWidget *parent, const char *name)
if
(
parent
)
if
(
parent
)
{
{
setAttribute
(
Qt
::
WA_NoMousePropagation
);
setAttribute
(
Qt
::
WA_NoMousePropagation
);
setAttribute
(
Qt
::
WA_TranslucentBackground
);
setAttribute
(
Qt
::
WA_TranslucentBackground
);
}
}
else
else
{
{
// standalone window
// standalone window
setAttribute
(
Qt
::
WA_TranslucentBackground
);
setAttribute
(
Qt
::
WA_TranslucentBackground
);
// !!!! Should be included into Windows after QT recompilation
// !!!! Should be included into Windows after QT recompilation
#ifdef Q_WS_MAC
#ifdef Q_WS_MAC
//setAttribute(Qt::WA_MacNoShadow);
//setAttribute(Qt::WA_MacNoShadow);
#endif
#endif
...
@@ -540,36 +540,35 @@ int UBDockPalette::customMargin()
...
@@ -540,36 +540,35 @@ int UBDockPalette::customMargin()
* \brief Add the given tab widget
* \brief Add the given tab widget
* @param widget as the given widget
* @param widget as the given widget
*/
*/
void
UBDockPalette
::
addTab
Widget
(
UBDockPaletteWidget
*
widget
)
void
UBDockPalette
::
addTab
(
UBDockPaletteWidget
*
widget
)
{
{
if
(
!
mTabWidgets
.
contains
(
widget
))
if
(
!
mTabWidgets
.
contains
(
widget
))
{
{
widget
->
setVisible
(
true
);
widget
->
setVisible
(
true
);
mTabWidgets
.
append
(
widget
);
mTabWidgets
.
append
(
widget
);
mpStackWidget
->
addWidget
(
widget
);
mpStackWidget
->
addWidget
(
widget
);
mpStackWidget
->
setCurrentWidget
(
widget
);
mpStackWidget
->
setCurrentWidget
(
widget
);
update
();
update
();
}
}
}
}
/**
/**
* \brief Remove the given tab
* \brief Remove the given tab
* @param widgetName as the tab widget name
* @param widgetName as the tab widget name
*/
*/
void
UBDockPalette
::
removeTab
(
const
QString
&
widgetName
)
void
UBDockPalette
::
removeTab
(
const
QString
&
widgetName
)
{
{
for
(
int
i
=
0
;
i
<
mTabWidgets
.
size
();
i
++
)
for
(
int
i
=
0
;
i
<
mTabWidgets
.
size
();
i
++
)
{
{
UBDockPaletteWidget
*
pCrntWidget
=
mTabWidgets
.
at
(
i
);
UBDockPaletteWidget
*
pCrntWidget
=
mTabWidgets
.
at
(
i
);
if
(
NULL
!=
pCrntWidget
&&
(
pCrntWidget
->
name
()
==
widgetName
))
if
(
NULL
!=
pCrntWidget
&&
(
pCrntWidget
->
name
()
==
widgetName
))
{
{
mpStackWidget
->
removeWidget
(
pCrntWidget
);
mpStackWidget
->
removeWidget
(
pCrntWidget
);
mTabWidgets
.
remove
(
i
);
mTabWidgets
.
remove
(
i
);
pCrntWidget
->
hide
();
pCrntWidget
->
hide
();
update
();
update
();
break
;
break
;
}
}
}
}
}
}
/**
/**
...
@@ -601,7 +600,7 @@ void UBDockPalette::onShowTabWidget(const QString &widgetName)
...
@@ -601,7 +600,7 @@ void UBDockPalette::onShowTabWidget(const QString &widgetName)
UBDockPaletteWidget
*
pCrntWidget
=
mRegisteredWidgets
.
at
(
i
);
UBDockPaletteWidget
*
pCrntWidget
=
mRegisteredWidgets
.
at
(
i
);
if
(
NULL
!=
pCrntWidget
&&
(
pCrntWidget
->
name
()
==
widgetName
))
if
(
NULL
!=
pCrntWidget
&&
(
pCrntWidget
->
name
()
==
widgetName
))
{
{
addTab
Widget
(
pCrntWidget
);
addTab
(
pCrntWidget
);
break
;
break
;
}
}
}
}
...
...
src/gui/UBDockPalette.h
View file @
023fddb6
...
@@ -72,10 +72,13 @@ public:
...
@@ -72,10 +72,13 @@ public:
void
setBackgroundBrush
(
const
QBrush
&
brush
);
void
setBackgroundBrush
(
const
QBrush
&
brush
);
void
registerWidget
(
UBDockPaletteWidget
*
widget
);
void
registerWidget
(
UBDockPaletteWidget
*
widget
);
void
addTab
Widget
(
UBDockPaletteWidget
*
widget
);
void
addTab
(
UBDockPaletteWidget
*
widget
);
void
removeTab
(
const
QString
&
widgetName
);
void
removeTab
(
const
QString
&
widgetName
);
void
connectSignals
();
void
connectSignals
();
QVector
<
UBDockPaletteWidget
*>
GetWidgetsList
()
{
return
mRegisteredWidgets
;
};
public
slots
:
public
slots
:
void
onShowTabWidget
(
const
QString
&
widgetName
);
void
onShowTabWidget
(
const
QString
&
widgetName
);
void
onHideTabWidget
(
const
QString
&
widgetName
);
void
onHideTabWidget
(
const
QString
&
widgetName
);
...
@@ -90,7 +93,7 @@ protected:
...
@@ -90,7 +93,7 @@ protected:
/** The current dock orientation */
/** The current dock orientation */
eUBDockOrientation
mOrientation
;
eUBDockOrientation
mOrientation
;
/** The current bac
l
ground brush */
/** The current bac
k
ground brush */
QBrush
mBackgroundBrush
;
QBrush
mBackgroundBrush
;
/** The preferred width */
/** The preferred width */
int
mPreferredWidth
;
int
mPreferredWidth
;
...
@@ -123,7 +126,6 @@ protected:
...
@@ -123,7 +126,6 @@ protected:
/** The current widget */
/** The current widget */
QVector
<
UBDockPaletteWidget
*>
mRegisteredWidgets
;
QVector
<
UBDockPaletteWidget
*>
mRegisteredWidgets
;
// QVector<UBDockPaletteWidget*> mVisibleWidgets; // ???
private
slots
:
private
slots
:
void
onToolbarPosUpdated
();
void
onToolbarPosUpdated
();
...
...
src/gui/UBDockPaletteWidget.h
View file @
023fddb6
...
@@ -27,9 +27,7 @@ public:
...
@@ -27,9 +27,7 @@ public:
void
registerMode
(
eUBDockPaletteWidgetMode
mode
);
void
registerMode
(
eUBDockPaletteWidgetMode
mode
);
/* The current widget available mode list */
QVector
<
eUBDockPaletteWidgetMode
>
GetRegisteredModes
()
{
return
mRegisteredModes
;
};
QVector
<
eUBDockPaletteWidgetMode
>
mRegisteredModes
;
signals
:
signals
:
...
@@ -45,6 +43,9 @@ protected:
...
@@ -45,6 +43,9 @@ protected:
QPixmap
mIconToLeft
;
// arrow like this: <
QPixmap
mIconToLeft
;
// arrow like this: <
QString
mName
;
QString
mName
;
/* The current widget available mode list */
QVector
<
eUBDockPaletteWidgetMode
>
mRegisteredModes
;
};
};
#endif // UBDOCKPALETTEWIDGET_H
#endif // UBDOCKPALETTEWIDGET_H
src/gui/UBTeacherBarWidget.cpp
View file @
023fddb6
#include "UBTeacherBarWidget.h"
#include "UBTeacherBarWidget.h"
#include "core/UBApplication.h"
#include "core/UBApplication.h"
#include "core/UBPersistenceManager.h"
#include "document/UBDocumentController.h"
#include "document/UBDocumentProxy.h"
#include "board/UBBoardController.h"
#include "board/UBBoardPaletteManager.h"
UBTeacherBarWidget
::
UBTeacherBarWidget
(
QWidget
*
parent
,
const
char
*
name
)
:
UBDockPaletteWidget
(
parent
)
UBTeacherBarWidget
::
UBTeacherBarWidget
(
QWidget
*
parent
,
const
char
*
name
)
:
UBDockPaletteWidget
(
parent
)
,
mpLayout
(
NULL
)
,
mpLayout
(
NULL
)
...
@@ -110,6 +117,20 @@ UBTeacherBarWidget::UBTeacherBarWidget(QWidget *parent, const char *name):UBDock
...
@@ -110,6 +117,20 @@ UBTeacherBarWidget::UBTeacherBarWidget(QWidget *parent, const char *name):UBDock
mpLayout
->
addWidget
(
mpAction3
);
mpLayout
->
addWidget
(
mpAction3
);
populateCombos
();
populateCombos
();
connect
(
UBApplication
::
boardController
,
SIGNAL
(
activeSceneWillChange
()),
this
,
SLOT
(
saveContent
()));
connect
(
UBApplication
::
boardController
,
SIGNAL
(
activeSceneChanged
()),
this
,
SLOT
(
loadContent
()));
connect
(
mpTitle
,
SIGNAL
(
textChanged
(
QString
)),
this
,
SLOT
(
onValueChanged
()));
connect
(
mpPhasis
,
SIGNAL
(
currentIndexChanged
(
int
)),
this
,
SLOT
(
onValueChanged
()));
connect
(
mpDuration
,
SIGNAL
(
currentIndexChanged
(
int
)),
this
,
SLOT
(
onValueChanged
()));
connect
(
mpEquipment
,
SIGNAL
(
textChanged
(
QString
)),
this
,
SLOT
(
onValueChanged
()));
connect
(
mpActivity
,
SIGNAL
(
currentIndexChanged
(
int
)),
this
,
SLOT
(
onValueChanged
()));
connect
(
mpAction1
->
teacher
(),
SIGNAL
(
textChanged
()),
this
,
SLOT
(
onValueChanged
()));
connect
(
mpAction1
->
student
(),
SIGNAL
(
textChanged
()),
this
,
SLOT
(
onValueChanged
()));
connect
(
mpAction2
->
teacher
(),
SIGNAL
(
textChanged
()),
this
,
SLOT
(
onValueChanged
()));
connect
(
mpAction2
->
student
(),
SIGNAL
(
textChanged
()),
this
,
SLOT
(
onValueChanged
()));
connect
(
mpAction3
->
teacher
(),
SIGNAL
(
textChanged
()),
this
,
SLOT
(
onValueChanged
()));
connect
(
mpAction3
->
student
(),
SIGNAL
(
textChanged
()),
this
,
SLOT
(
onValueChanged
()));
}
}
UBTeacherBarWidget
::~
UBTeacherBarWidget
()
UBTeacherBarWidget
::~
UBTeacherBarWidget
()
...
@@ -219,16 +240,78 @@ UBTeacherBarWidget::~UBTeacherBarWidget()
...
@@ -219,16 +240,78 @@ UBTeacherBarWidget::~UBTeacherBarWidget()
void
UBTeacherBarWidget
::
populateCombos
()
void
UBTeacherBarWidget
::
populateCombos
()
{
{
QStringList
qslPhasis
;
QStringList
qslPhasis
;
qslPhasis
<<
tr
(
"I discover"
)
<<
tr
(
"I experiment"
)
<<
tr
(
"I train myself"
)
<<
tr
(
"I play"
)
<<
tr
(
"I memorize"
);
qslPhasis
<<
tr
(
"
"
)
<<
tr
(
"
I discover"
)
<<
tr
(
"I experiment"
)
<<
tr
(
"I train myself"
)
<<
tr
(
"I play"
)
<<
tr
(
"I memorize"
);
mpPhasis
->
insertItems
(
0
,
qslPhasis
);
mpPhasis
->
insertItems
(
0
,
qslPhasis
);
mpPhasis
->
setCurrentIndex
(
0
);
QStringList
qslDuration
;
QStringList
qslDuration
;
qslDuration
<<
tr
(
"Short"
)
<<
tr
(
"Middle"
)
<<
tr
(
"Long"
);
qslDuration
<<
tr
(
"
"
)
<<
tr
(
"
Short"
)
<<
tr
(
"Middle"
)
<<
tr
(
"Long"
);
mpDuration
->
insertItems
(
0
,
qslDuration
);
mpDuration
->
insertItems
(
0
,
qslDuration
);
mpDuration
->
setCurrentIndex
(
0
);
QStringList
qslActivity
;
QStringList
qslActivity
;
qslActivity
<<
tr
(
"Alone"
)
<<
tr
(
"By Group"
)
<<
tr
(
"All together"
);
qslActivity
<<
tr
(
""
)
<<
tr
(
"Alone"
)
<<
tr
(
"By Group"
)
<<
tr
(
"All together"
);
mpActivity
->
insertItems
(
0
,
qslActivity
);
mpActivity
->
insertItems
(
0
,
qslActivity
);
mpActivity
->
setCurrentIndex
(
0
);
}
void
UBTeacherBarWidget
::
onValueChanged
()
{
if
(
mpTitle
->
text
()
==
""
&&
mpDuration
->
currentIndex
()
==
0
&&
mpPhasis
->
currentIndex
()
==
0
&&
mpEquipment
->
text
()
==
""
&&
mpActivity
->
currentIndex
()
==
0
&&
mpAction1
->
teacherText
()
==
""
&&
mpAction1
->
studentText
()
==
""
&&
mpAction2
->
teacherText
()
==
""
&&
mpAction2
->
studentText
()
==
""
&&
mpAction3
->
teacherText
()
==
""
&&
mpAction3
->
studentText
()
==
""
)
{
mIconToLeft
=
QPixmap
(
":images/teacher_open_disabled.png"
);
mIconToRight
=
QPixmap
(
":images/teacher_close_disabled.png"
);
}
else
{
mIconToLeft
=
QPixmap
(
":images/teacher_open.png"
);
mIconToRight
=
QPixmap
(
":images/teacher_close.png"
);
}
UBApplication
::
boardController
->
paletteManager
()
->
refreshPalettes
();
}
void
UBTeacherBarWidget
::
saveContent
()
{
sTeacherBarInfos
infos
;
infos
.
title
=
mpTitle
->
text
();
infos
.
phasis
=
mpPhasis
->
currentIndex
();
infos
.
Duration
=
mpDuration
->
currentIndex
();
infos
.
material
=
mpEquipment
->
text
();
infos
.
activity
=
mpActivity
->
currentIndex
();
infos
.
action1Master
=
mpAction1
->
teacherText
();
infos
.
action1Student
=
mpAction1
->
studentText
();
infos
.
action2Master
=
mpAction2
->
teacherText
();
infos
.
action2Student
=
mpAction2
->
studentText
();
infos
.
action3Master
=
mpAction3
->
teacherText
();
infos
.
action3Student
=
mpAction3
->
studentText
();
UBPersistenceManager
::
persistenceManager
()
->
persistTeacherBar
(
UBApplication
::
boardController
->
activeDocument
(),
UBApplication
::
boardController
->
activeSceneIndex
(),
infos
);
}
void
UBTeacherBarWidget
::
loadContent
()
{
sTeacherBarInfos
nextInfos
=
UBPersistenceManager
::
persistenceManager
()
->
getTeacherBarInfos
(
UBApplication
::
boardController
->
activeDocument
(),
UBApplication
::
boardController
->
activeSceneIndex
());
mpTitle
->
setText
(
nextInfos
.
title
);
mpPhasis
->
setCurrentIndex
(
nextInfos
.
phasis
);
mpDuration
->
setCurrentIndex
(
nextInfos
.
Duration
);
mpEquipment
->
setText
(
nextInfos
.
material
);
mpActivity
->
setCurrentIndex
(
nextInfos
.
activity
);
mpAction1
->
setTeacherText
(
nextInfos
.
action1Master
);
mpAction1
->
setStudentText
(
nextInfos
.
action1Student
);
mpAction2
->
setTeacherText
(
nextInfos
.
action2Master
);
mpAction2
->
setStudentText
(
nextInfos
.
action2Student
);
mpAction3
->
setTeacherText
(
nextInfos
.
action3Master
);
mpAction3
->
setStudentText
(
nextInfos
.
action3Student
);
}
}
UBTeacherStudentAction
::
UBTeacherStudentAction
(
int
actionNumber
,
QWidget
*
parent
,
const
char
*
name
)
:
QWidget
(
parent
)
UBTeacherStudentAction
::
UBTeacherStudentAction
(
int
actionNumber
,
QWidget
*
parent
,
const
char
*
name
)
:
QWidget
(
parent
)
...
@@ -327,3 +410,22 @@ QString UBTeacherStudentAction::studentText()
...
@@ -327,3 +410,22 @@ QString UBTeacherStudentAction::studentText()
return
mpStudent
->
document
()
->
toPlainText
();
return
mpStudent
->
document
()
->
toPlainText
();
}
}
void
UBTeacherStudentAction
::
setTeacherText
(
QString
text
)
{
mpTeacher
->
setText
(
text
);
}
void
UBTeacherStudentAction
::
setStudentText
(
QString
text
)
{
mpStudent
->
setText
(
text
);
}
QTextEdit
*
UBTeacherStudentAction
::
teacher
()
{
return
mpTeacher
;
}
QTextEdit
*
UBTeacherStudentAction
::
student
()
{
return
mpStudent
;
}
src/gui/UBTeacherBarWidget.h
View file @
023fddb6
...
@@ -20,6 +20,10 @@ public:
...
@@ -20,6 +20,10 @@ public:
~
UBTeacherStudentAction
();
~
UBTeacherStudentAction
();
QString
teacherText
();
QString
teacherText
();
QString
studentText
();
QString
studentText
();
void
setTeacherText
(
QString
text
);
void
setStudentText
(
QString
text
);
QTextEdit
*
teacher
();
QTextEdit
*
student
();
private
:
private
:
int
mActionNumber
;
int
mActionNumber
;
...
@@ -35,10 +39,16 @@ private:
...
@@ -35,10 +39,16 @@ private:
class
UBTeacherBarWidget
:
public
UBDockPaletteWidget
class
UBTeacherBarWidget
:
public
UBDockPaletteWidget
{
{
Q_OBJECT
public
:
public
:
UBTeacherBarWidget
(
QWidget
*
parent
=
0
,
const
char
*
name
=
"UBTeacherBarWidget"
);
UBTeacherBarWidget
(
QWidget
*
parent
=
0
,
const
char
*
name
=
"UBTeacherBarWidget"
);
~
UBTeacherBarWidget
();
~
UBTeacherBarWidget
();
private
slots
:
void
saveContent
();
void
loadContent
();
void
onValueChanged
();
private
:
private
:
void
populateCombos
();
void
populateCombos
();
...
...
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