Fixed issue 962

preferencesAboutTextFull
shibakaneki 12 years ago
parent 58746c87e5
commit 23531e8488
  1. 3
      src/board/UBBoardController.cpp
  2. 11
      src/board/UBBoardPaletteManager.cpp
  3. 6
      src/core/UBDocumentManager.cpp
  4. 7
      src/document/UBDocumentContainer.cpp
  5. 1
      src/document/UBDocumentContainer.h
  6. 6
      src/document/UBDocumentController.cpp
  7. 1
      src/gui/UBDocumentNavigator.cpp
  8. 34
      src/gui/gui.pri

@ -2282,10 +2282,9 @@ void UBBoardController::addItem()
void UBBoardController::importPage() void UBBoardController::importPage()
{ {
int pageCount = selectedDocument()->pageCount(); int pageCount = selectedDocument()->pageCount();
if (UBApplication::documentController->addFileToDocument(selectedDocument())) if (UBApplication::documentController->addFileToDocument(selectedDocument()))
{ {
setActiveDocumentScene(pageCount); setActiveDocumentScene(selectedDocument(), pageCount, true);
} }
} }

@ -347,14 +347,15 @@ void UBBoardPaletteManager::pagePaletteButtonReleased()
{ {
if( mPageButtonPressedTime.msecsTo(QTime::currentTime()) > 900) if( mPageButtonPressedTime.msecsTo(QTime::currentTime()) > 900)
{ {
// The palette is reinstanciate because the duplication depends on the current scene // The palette is reinstanciated because the duplication depends on the current scene
delete(mPagePalette); delete(mPagePalette);
mPagePalette = 0; mPagePalette = 0;
QList<QAction*>pageActions; QList<QAction*>pageActions;
pageActions << UBApplication::mainWindow->actionNewPage; pageActions << UBApplication::mainWindow->actionNewPage;
UBBoardController* boardController = UBApplication::boardController; UBBoardController* boardController = UBApplication::boardController;
if(UBApplication::documentController->pageCanBeDuplicated(UBDocumentContainer::pageFromSceneIndex(boardController->activeSceneIndex()))) if(UBApplication::documentController->pageCanBeDuplicated(UBDocumentContainer::pageFromSceneIndex(boardController->activeSceneIndex()))){
pageActions << UBApplication::mainWindow->actionDuplicatePage; pageActions << UBApplication::mainWindow->actionDuplicatePage;
}
pageActions << UBApplication::mainWindow->actionImportPage; pageActions << UBApplication::mainWindow->actionImportPage;
mPagePalette = new UBActionPalette(pageActions, Qt::Horizontal , mContainer); mPagePalette = new UBActionPalette(pageActions, Qt::Horizontal , mContainer);
@ -362,8 +363,12 @@ void UBBoardPaletteManager::pagePaletteButtonReleased()
mPagePalette->setToolButtonStyle(Qt::ToolButtonTextUnderIcon); mPagePalette->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
mPagePalette->groupActions(); mPagePalette->groupActions();
mPagePalette->setClosable(true); mPagePalette->setClosable(true);
mPagePalette->adjustSizeAndPosition();
// As we recreate the pagePalette every time, we must reconnect the slots
connect(UBApplication::mainWindow->actionNewPage, SIGNAL(triggered()), mPagePalette, SLOT(close()));
connect(UBApplication::mainWindow->actionDuplicatePage, SIGNAL(triggered()), mPagePalette, SLOT(close()));
connect(UBApplication::mainWindow->actionImportPage, SIGNAL(triggered()), mPagePalette, SLOT(close()));
connect(mPagePalette, SIGNAL(closed()), this, SLOT(pagePaletteClosed()));
togglePagePalette(true); togglePagePalette(true);
} }

@ -33,6 +33,8 @@
#include "domain/UBGraphicsPixmapItem.h" #include "domain/UBGraphicsPixmapItem.h"
#include "document/UBDocumentProxy.h" #include "document/UBDocumentProxy.h"
#include "document/UBDocumentController.h"
#include "board/UBBoardController.h"
#include "UBApplication.h" #include "UBApplication.h"
#include "UBSettings.h" #include "UBSettings.h"
@ -234,6 +236,9 @@ int UBDocumentManager::addFilesToDocument(UBDocumentProxy* document, QStringList
UBGraphicsScene* scene = UBPersistenceManager::persistenceManager()->createDocumentSceneAt(document, pageIndex); UBGraphicsScene* scene = UBPersistenceManager::persistenceManager()->createDocumentSceneAt(document, pageIndex);
importAdaptor->placeImportedItemToScene(scene, page); importAdaptor->placeImportedItemToScene(scene, page);
UBPersistenceManager::persistenceManager()->persistDocumentScene(document, scene, pageIndex); UBPersistenceManager::persistenceManager()->persistDocumentScene(document, scene, pageIndex);
// TODO: Add an empty pixmap for the thumbnail here
UBApplication::boardController->addEmptyThumbPage();
} }
UBPersistenceManager::persistenceManager()->persistDocumentMetadata(document); UBPersistenceManager::persistenceManager()->persistDocumentMetadata(document);
@ -297,7 +302,6 @@ QList<UBExportAdaptor*> UBDocumentManager::supportedExportAdaptors()
return mExportAdaptors; return mExportAdaptors;
} }
void UBDocumentManager::emitDocumentUpdated(UBDocumentProxy* pDocument) void UBDocumentManager::emitDocumentUpdated(UBDocumentProxy* pDocument)
{ {
emit documentUpdated(pDocument); emit documentUpdated(pDocument);

@ -114,6 +114,7 @@ void UBDocumentContainer::reloadThumbnails()
if (mCurrentDocument) if (mCurrentDocument)
{ {
UBThumbnailAdaptor::load(mCurrentDocument, mDocumentThumbs); UBThumbnailAdaptor::load(mCurrentDocument, mDocumentThumbs);
qDebug() << "Reloading Thumbnails. new mDocumentThumbs size: " << mDocumentThumbs.size();
emit documentThumbnailsUpdated(this); emit documentThumbnailsUpdated(this);
} }
} }
@ -131,3 +132,9 @@ int UBDocumentContainer::sceneIndexFromPage(int page)
return page; return page;
return page-1; return page-1;
} }
void UBDocumentContainer::addEmptyThumbPage()
{
const QPixmap* pThumb = new QPixmap();
mDocumentThumbs.append(pThumb);
}

@ -41,6 +41,7 @@ class UBDocumentContainer : public QObject
void deletePages(QList<int>& pageIndexes); void deletePages(QList<int>& pageIndexes);
void addPage(int index); void addPage(int index);
void updatePage(int index); void updatePage(int index);
void addEmptyThumbPage();
private: private:
void deleteThumbPage(int index); void deleteThumbPage(int index);

@ -992,8 +992,7 @@ void UBDocumentController::addFileToDocument()
bool UBDocumentController::addFileToDocument(UBDocumentProxy* document) bool UBDocumentController::addFileToDocument(UBDocumentProxy* document)
{ {
QString defaultPath = UBSettings::settings()->lastImportFilePath->get().toString(); QString defaultPath = UBSettings::settings()->lastImportFilePath->get().toString();
QString filePath = QFileDialog::getOpenFileName(mParentWidget, tr("Open Supported File") QString filePath = QFileDialog::getOpenFileName(mParentWidget, tr("Open Supported File"), defaultPath, UBDocumentManager::documentManager()->importFileFilter());
, defaultPath, UBDocumentManager::documentManager()->importFileFilter());
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
QApplication::processEvents(); QApplication::processEvents();
@ -1005,7 +1004,8 @@ bool UBDocumentController::addFileToDocument(UBDocumentProxy* document)
if (filePath.length() > 0) if (filePath.length() > 0)
{ {
QApplication::processEvents(); QApplication::processEvents(); // NOTE: We performed this just a few lines before. Is it really necessary to do it again here??
QFile selectedFile(filePath);
showMessage(tr("Importing file %1...").arg(fileInfo.baseName()), true); showMessage(tr("Importing file %1...").arg(fileInfo.baseName()), true);

@ -84,6 +84,7 @@ void UBDocumentNavigator::generateThumbnails(UBDocumentContainer* source)
for(int i = 0; i < source->selectedDocument()->pageCount(); i++) for(int i = 0; i < source->selectedDocument()->pageCount(); i++)
{ {
qDebug() << "source->selectedDocument()->pageCount: " << source->selectedDocument()->pageCount() << ", source->pageCount: " << source->pageCount() << ", source->pageAt(" << i << ")";
const QPixmap* pix = source->pageAt(i); const QPixmap* pix = source->pageAt(i);
UBSceneThumbnailNavigPixmap* pixmapItem = new UBSceneThumbnailNavigPixmap(*pix, source->selectedDocument(), i); UBSceneThumbnailNavigPixmap* pixmapItem = new UBSceneThumbnailNavigPixmap(*pix, source->selectedDocument(), i);
int pageIndex = UBDocumentContainer::pageFromSceneIndex(i); int pageIndex = UBDocumentContainer::pageFromSceneIndex(i);

@ -1,4 +1,3 @@
HEADERS += src/gui/UBThumbnailView.h \ HEADERS += src/gui/UBThumbnailView.h \
src/gui/UBFloatingPalette.h \ src/gui/UBFloatingPalette.h \
src/gui/UBToolbarButtonGroup.h \ src/gui/UBToolbarButtonGroup.h \
@ -52,7 +51,6 @@ HEADERS += src/gui/UBThumbnailView.h \
src/gui/UBTeacherGuideWidget.h \ src/gui/UBTeacherGuideWidget.h \
src/gui/UBTeacherGuideWidgetsTools.h \ src/gui/UBTeacherGuideWidgetsTools.h \
src/gui/UBMessagesDialog.h src/gui/UBMessagesDialog.h
SOURCES += src/gui/UBThumbnailView.cpp \ SOURCES += src/gui/UBThumbnailView.cpp \
src/gui/UBFloatingPalette.cpp \ src/gui/UBFloatingPalette.cpp \
src/gui/UBToolbarButtonGroup.cpp \ src/gui/UBToolbarButtonGroup.cpp \
@ -106,30 +104,8 @@ SOURCES += src/gui/UBThumbnailView.cpp \
src/gui/UBTeacherGuideWidget.cpp \ src/gui/UBTeacherGuideWidget.cpp \
src/gui/UBTeacherGuideWidgetsTools.cpp \ src/gui/UBTeacherGuideWidgetsTools.cpp \
src/gui/UBMessagesDialog.cpp src/gui/UBMessagesDialog.cpp
win32:SOURCES += src/gui/UBKeyboardPalette_win.cpp
win32 { macx:SOURCES += src/gui/UBKeyboardPalette_mac.cpp
linux-g++:SOURCES += src/gui/UBKeyboardPalette_linux.cpp
SOURCES += src/gui/UBKeyboardPalette_win.cpp linux-g++-32:SOURCES += src/gui/UBKeyboardPalette_linux.cpp
linux-g++-64:SOURCES += src/gui/UBKeyboardPalette_linux.cpp
}
macx {
SOURCES += src/gui/UBKeyboardPalette_mac.cpp
}
linux-g++ {
SOURCES += src/gui/UBKeyboardPalette_linux.cpp
}
linux-g++-32 {
SOURCES += src/gui/UBKeyboardPalette_linux.cpp
}
linux-g++-64 {
SOURCES += src/gui/UBKeyboardPalette_linux.cpp
}

Loading…
Cancel
Save