developed Sankore-208

preferencesAboutTextFull
Claudio Valerio 13 years ago
parent 0a40c2f36c
commit fc693d7317
  1. 91
      resources/images/duplicateDisabled.svg
  2. 1
      resources/sankore.qrc
  3. 15
      src/document/UBDocumentController.cpp
  4. 2
      src/document/UBDocumentController.h
  5. 3
      src/gui/UBDocumentThumbnailWidget.cpp
  6. 47
      src/gui/UBThumbnailWidget.cpp
  7. 2
      src/gui/UBThumbnailWidget.h

@ -0,0 +1,91 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Generator: Adobe Illustrator 13.0.2, SVG Export Plug-In . SVG Version: 6.00 Build 14948) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
version="1.1"
id="Layer_1"
x="0px"
y="0px"
width="26px"
height="26px"
viewBox="0 0 26 26"
style="enable-background:new 0 0 26 26;"
xml:space="preserve"
inkscape:version="0.48.3.1 r9886"
sodipodi:docname="duplicateDisabled.svg"><metadata
id="metadata21"><rdf:RDF><cc:Work
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /></cc:Work></rdf:RDF></metadata><defs
id="defs19" /><sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1283"
inkscape:window-height="762"
id="namedview17"
showgrid="false"
inkscape:zoom="9.0769231"
inkscape:cx="13"
inkscape:cy="13"
inkscape:window-x="65"
inkscape:window-y="24"
inkscape:window-maximized="0"
inkscape:current-layer="Layer_1" />
<circle
style="fill:#CCCCCC;opacity:0.5"
cx="13"
cy="13"
r="13"
id="circle3" />
<circle
style="fill:#999999;opacity:0.5"
cx="13"
cy="13"
r="11"
id="circle5" />
<rect
x="5"
y="6"
style="fill:#F2F2F2;opacity:0.5"
width="12"
height="10"
id="rect7" />
<rect
x="8"
y="9"
style="fill:#999999;opacity:0.5"
width="12"
height="10"
id="rect9" />
<rect
x="7"
y="8"
style="fill:#999999;opacity:0.5"
width="8"
height="6"
id="rect11" />
<rect
x="9"
y="10"
style="fill:#FFFFFF;opacity:0.5"
width="12"
height="10"
id="rect13" />
<path
style="fill:#FFA600;opacity:0.5"
d="M10,7c0,0,2,0,4,0s3,1,3,3s0,3,0,3h3l-5,5l-5-5h3c0,0,0-1,0-2s0-2-1-2C10.5,9,10,7,10,7z"
id="path15" />
</svg>

After

Width:  |  Height:  |  Size: 2.2 KiB

@ -355,5 +355,6 @@
<file>images/teacherGuide/link.png</file> <file>images/teacherGuide/link.png</file>
<file>images/teacherGuide/movie.png</file> <file>images/teacherGuide/movie.png</file>
<file>images/teacherGuide/w3c.png</file> <file>images/teacherGuide/w3c.png</file>
<file>images/duplicateDisabled.svg</file>
</qresource> </qresource>
</RCC> </RCC>

@ -535,6 +535,20 @@ void UBDocumentController::openSelectedItem()
} }
void UBDocumentController::duplicateScenes(UBDocumentProxy* proxy, QList<int> scenesIndex)
{
if(scenesIndex.count()){
int offset = 0;
foreach (int eachSceneIndex, scenesIndex){
UBPersistenceManager::persistenceManager()->duplicateDocumentScene(proxy, eachSceneIndex + offset);
mDocumentThumbs.insert(eachSceneIndex + offset, mDocumentThumbs.at(eachSceneIndex + offset));
UBApplication::boardController->setActiveDocumentScene(proxy,eachSceneIndex+offset+1);
offset++;
}
}
}
void UBDocumentController::duplicateSelectedItem() void UBDocumentController::duplicateSelectedItem()
{ {
if (UBApplication::applicationController->displayMode() != UBApplicationController::Document) if (UBApplication::applicationController->displayMode() != UBApplicationController::Document)
@ -558,7 +572,6 @@ void UBDocumentController::duplicateSelectedItem()
} }
} }
} }
if (selectedSceneIndexes.count() > 0) if (selectedSceneIndexes.count() > 0)
{ {
UBSceneThumbnailPixmap *thumb = dynamic_cast<UBSceneThumbnailPixmap*>(selectedItems.at(0)); UBSceneThumbnailPixmap *thumb = dynamic_cast<UBSceneThumbnailPixmap*>(selectedItems.at(0));

@ -50,6 +50,8 @@ class UBDocumentController : public QObject
UBDocumentProxy* getCurrentDocument() { return mCurrentDocument; }; UBDocumentProxy* getCurrentDocument() { return mCurrentDocument; };
void deletePages(QList<QGraphicsItem*> itemsToDelete); void deletePages(QList<QGraphicsItem*> itemsToDelete);
int getSelectedItemIndex(); int getSelectedItemIndex();
void duplicateScenes(UBDocumentProxy* proxy, QList<int> scenesIndex);
signals: signals:
void refreshThumbnails(); void refreshThumbnails();

@ -26,7 +26,8 @@ UBDocumentThumbnailWidget::UBDocumentThumbnailWidget(QWidget* parent)
: UBThumbnailWidget(parent) : UBThumbnailWidget(parent)
, mDropCaretRectItem(0) , mDropCaretRectItem(0)
, mClosestDropItem(0) , mClosestDropItem(0)
, mDragEnabled(true), mScrollMagnitude(0) , mDragEnabled(true)
, mScrollMagnitude(0)
{ {
mScrollTimer = new QTimer(this); mScrollTimer = new QTimer(this);
connect(mScrollTimer, SIGNAL(timeout()), this, SLOT(autoScroll())); connect(mScrollTimer, SIGNAL(timeout()), this, SLOT(autoScroll()));

@ -750,6 +750,7 @@ UBSceneThumbnailNavigPixmap::UBSceneThumbnailNavigPixmap(const QPixmap& pix, UBD
, bCanDelete(false) , bCanDelete(false)
, bCanMoveUp(false) , bCanMoveUp(false)
, bCanMoveDown(false) , bCanMoveDown(false)
, bCanDuplicate(false)
{ {
if(0 <= UBApplication::boardController->pageFromSceneIndex(pSceneIndex)){ if(0 <= UBApplication::boardController->pageFromSceneIndex(pSceneIndex)){
setAcceptsHoverEvents(true); setAcceptsHoverEvents(true);
@ -788,14 +789,18 @@ void UBSceneThumbnailNavigPixmap::paint(QPainter *painter, const QStyleOptionGra
painter->drawPixmap(0, 0, BUTTONSIZE, BUTTONSIZE, QPixmap(":images/close.svg")); painter->drawPixmap(0, 0, BUTTONSIZE, BUTTONSIZE, QPixmap(":images/close.svg"));
else else
painter->drawPixmap(0, 0, BUTTONSIZE, BUTTONSIZE, QPixmap(":images/closeDisabled.svg")); painter->drawPixmap(0, 0, BUTTONSIZE, BUTTONSIZE, QPixmap(":images/closeDisabled.svg"));
if(bCanDuplicate)
painter->drawPixmap(BUTTONSIZE + BUTTONSPACING, 0, BUTTONSIZE, BUTTONSIZE, QPixmap(":images/duplicate.svg"));
else
painter->drawPixmap(BUTTONSIZE + BUTTONSPACING, 0, BUTTONSIZE, BUTTONSIZE, QPixmap(":images/duplicateDisabled.svg"));
if(bCanMoveUp) if(bCanMoveUp)
painter->drawPixmap(BUTTONSIZE + BUTTONSPACING, 0, BUTTONSIZE, BUTTONSIZE, QPixmap(":images/moveUp.svg")); painter->drawPixmap(2*(BUTTONSIZE + BUTTONSPACING), 0, BUTTONSIZE, BUTTONSIZE, QPixmap(":images/moveUp.svg"));
else else
painter->drawPixmap(BUTTONSIZE + BUTTONSPACING, 0, BUTTONSIZE, BUTTONSIZE, QPixmap(":images/moveUpDisabled.svg")); painter->drawPixmap(2*(BUTTONSIZE + BUTTONSPACING), 0, BUTTONSIZE, BUTTONSIZE, QPixmap(":images/moveUpDisabled.svg"));
if(bCanMoveDown) if(bCanMoveDown)
painter->drawPixmap(2*(BUTTONSIZE + BUTTONSPACING), 0, BUTTONSIZE, BUTTONSIZE, QPixmap(":images/menu.svg")); painter->drawPixmap(3*(BUTTONSIZE + BUTTONSPACING), 0, BUTTONSIZE, BUTTONSIZE, QPixmap(":images/menu.svg"));
else else
painter->drawPixmap(2*(BUTTONSIZE + BUTTONSPACING), 0, BUTTONSIZE, BUTTONSIZE, QPixmap(":images/menuDisabled.svg")); painter->drawPixmap(3*(BUTTONSIZE + BUTTONSPACING), 0, BUTTONSIZE, BUTTONSIZE, QPixmap(":images/menuDisabled.svg"));
} }
} }
@ -805,17 +810,14 @@ void UBSceneThumbnailNavigPixmap::mousePressEvent(QGraphicsSceneMouseEvent *even
// Here we check the position of the click and verify if it has to trig an action or not. // Here we check the position of the click and verify if it has to trig an action or not.
if(bCanDelete && p.x() >= 0 && p.x() <= BUTTONSIZE && p.y() >= 0 && p.y() <= BUTTONSIZE) if(bCanDelete && p.x() >= 0 && p.x() <= BUTTONSIZE && p.y() >= 0 && p.y() <= BUTTONSIZE)
{
deletePage(); deletePage();
} if(bCanDuplicate && p.x() >= BUTTONSIZE + BUTTONSPACING && p.x() <= 2*BUTTONSIZE + BUTTONSPACING && p.y() >= 0 && p.y() <= BUTTONSIZE)
if(bCanMoveUp && p.x() >= BUTTONSIZE + BUTTONSPACING && p.x() <= 2*BUTTONSIZE + BUTTONSPACING && p.y() >= 0 && p.y() <= BUTTONSIZE) duplicatePage();
{ if(bCanMoveUp && p.x() >= 2*(BUTTONSIZE + BUTTONSPACING) && p.x() <= 3*BUTTONSIZE + 2*BUTTONSPACING && p.y() >= 0 && p.y() <= BUTTONSIZE)
moveUpPage(); moveUpPage();
} if(bCanMoveDown && p.x() >= 3*(BUTTONSIZE + BUTTONSPACING) && p.x() <= 4*BUTTONSIZE + 3*BUTTONSPACING && p.y() >= 0 && p.y() <= BUTTONSIZE)
if(bCanMoveDown && p.x() >= 2*(BUTTONSIZE + BUTTONSPACING) && p.x() <= 2*(BUTTONSIZE + BUTTONSPACING) + BUTTONSIZE && p.y() >= 0 && p.y() <= BUTTONSIZE)
{
moveDownPage(); moveDownPage();
}
event->accept(); event->accept();
} }
@ -824,6 +826,7 @@ void UBSceneThumbnailNavigPixmap::updateButtonsState()
bCanDelete = false; bCanDelete = false;
bCanMoveUp = false; bCanMoveUp = false;
bCanMoveDown = false; bCanMoveDown = false;
bCanDuplicate = true;
UBDocumentProxy* p = proxy(); UBDocumentProxy* p = proxy();
if(NULL != p && 0 <= UBApplication::boardController->pageFromSceneIndex(sceneIndex())) if(NULL != p && 0 <= UBApplication::boardController->pageFromSceneIndex(sceneIndex()))
@ -842,13 +845,19 @@ void UBSceneThumbnailNavigPixmap::updateButtonsState()
} }
} }
} }
if(UBSettings::settings()->teacherGuidePageZeroActivated && sceneIndex()<1) if(UBSettings::settings()->teacherGuidePageZeroActivated && sceneIndex()<=1)
bCanMoveUp = false; bCanMoveUp = false;
if(UBSettings::settings()->teacherGuidePageZeroActivated && sceneIndex() == 0){
bCanDelete = false;
bCanDuplicate = false;
bCanMoveUp = false;
bCanMoveDown = false;
}
if(bCanDelete || bCanMoveUp || bCanMoveDown) if(bCanDelete || bCanMoveUp || bCanMoveDown)
{
bButtonsVisible = true; bButtonsVisible = true;
}
} }
void UBSceneThumbnailNavigPixmap::deletePage() void UBSceneThumbnailNavigPixmap::deletePage()
@ -859,6 +868,14 @@ void UBSceneThumbnailNavigPixmap::deletePage()
UBApplication::documentController->deletePages(itemsToDelete); UBApplication::documentController->deletePages(itemsToDelete);
} }
void UBSceneThumbnailNavigPixmap::duplicatePage()
{
QList<int> itemsToDelete;
itemsToDelete << sceneIndex();
UBApplication::documentController->duplicateScenes(proxy(),itemsToDelete);
}
void UBSceneThumbnailNavigPixmap::moveUpPage() void UBSceneThumbnailNavigPixmap::moveUpPage()
{ {
UBApplication::documentController->moveSceneToIndex(proxy(), sceneIndex(), sceneIndex() - 1); UBApplication::documentController->moveSceneToIndex(proxy(), sceneIndex(), sceneIndex() - 1);

@ -306,6 +306,7 @@ class UBSceneThumbnailNavigPixmap : public UBSceneThumbnailPixmap
private: private:
void updateButtonsState(); void updateButtonsState();
void deletePage(); void deletePage();
void duplicatePage();
void moveUpPage(); void moveUpPage();
void moveDownPage(); void moveDownPage();
@ -313,6 +314,7 @@ class UBSceneThumbnailNavigPixmap : public UBSceneThumbnailPixmap
bool bCanDelete; bool bCanDelete;
bool bCanMoveUp; bool bCanMoveUp;
bool bCanMoveDown; bool bCanMoveDown;
bool bCanDuplicate;
}; };
class UBThumbnailVideo : public UBThumbnailPixmap class UBThumbnailVideo : public UBThumbnailPixmap

Loading…
Cancel
Save