Commit fca4b6c9 authored by Clément Fauconnier's avatar Clément Fauconnier

improvements on the document mode behavior

parent 681acce8
...@@ -46,7 +46,15 @@ class UBDocumentContainer : public QObject ...@@ -46,7 +46,15 @@ class UBDocumentContainer : public QObject
UBDocumentProxy* selectedDocument(){return mCurrentDocument;} UBDocumentProxy* selectedDocument(){return mCurrentDocument;}
int pageCount(){return mCurrentDocument->pageCount();} int pageCount(){return mCurrentDocument->pageCount();}
const QPixmap* pageAt(int index){return mDocumentThumbs[index];} const QPixmap* pageAt(int index)
{
if (index < mDocumentThumbs.size())
return mDocumentThumbs[index];
else
{
return NULL;
}
}
static int pageFromSceneIndex(int sceneIndex); static int pageFromSceneIndex(int sceneIndex);
static int sceneIndexFromPage(int sceneIndex); static int sceneIndexFromPage(int sceneIndex);
......
This diff is collapsed.
...@@ -111,7 +111,14 @@ public: ...@@ -111,7 +111,14 @@ public:
void removeChild(int index); void removeChild(int index);
UBDocumentProxy *proxyData() const {return mProxy;} UBDocumentProxy *proxyData() const {return mProxy;}
bool isRoot() {return !mParent;} bool isRoot() {return !mParent;}
bool isTopLevel() {return mParent && !mParent->mParent;} bool isTopLevel()
{
if (mParent)
{
return !mParent->mParent;
}
else return false;
}
UBDocumentTreeNode *clone(); UBDocumentTreeNode *clone();
QString dirPathInHierarchy(); QString dirPathInHierarchy();
...@@ -216,7 +223,7 @@ public: ...@@ -216,7 +223,7 @@ public:
QPersistentModelIndex myDocumentsIndex() const {return mMyDocuments;} QPersistentModelIndex myDocumentsIndex() const {return mMyDocuments;}
QPersistentModelIndex trashIndex() const {return mTrash;} QPersistentModelIndex trashIndex() const {return mTrash;}
QPersistentModelIndex untitledDocumentsIndex() const {return mUntitledDocuments;} QPersistentModelIndex untitledDocumentsIndex() const {return mMyDocuments;}
UBDocumentTreeNode *nodeFromIndex(const QModelIndex &pIndex) const; UBDocumentTreeNode *nodeFromIndex(const QModelIndex &pIndex) const;
static bool nodeLessThan(const UBDocumentTreeNode *firstIndex, const UBDocumentTreeNode *secondIndex); static bool nodeLessThan(const UBDocumentTreeNode *firstIndex, const UBDocumentTreeNode *secondIndex);
void setHighLighted(const QModelIndex &newHighLighted) {mHighLighted = newHighLighted;} void setHighLighted(const QModelIndex &newHighLighted) {mHighLighted = newHighLighted;}
......
...@@ -42,6 +42,7 @@ ...@@ -42,6 +42,7 @@
UBDocumentProxy::UBDocumentProxy() UBDocumentProxy::UBDocumentProxy()
: mPageCount(0) : mPageCount(0)
, mPageDpi(0) , mPageDpi(0)
, mPersistencePath("")
{ {
init(); init();
} }
......
...@@ -127,7 +127,7 @@ void UBDocumentNavigator::generateThumbnails(UBDocumentContainer* source) ...@@ -127,7 +127,7 @@ void UBDocumentNavigator::generateThumbnails(UBDocumentContainer* source)
{ {
//claudio This is a very bad hack and shows a architectural problem //claudio This is a very bad hack and shows a architectural problem
// source->selectedDocument()->pageCount() != source->pageCount() // source->selectedDocument()->pageCount() != source->pageCount()
if(i>=source->pageCount() || source->pageAt(i)->isNull()) if(i>=source->pageCount() || !source->pageAt(i))
source->insertThumbPage(i); source->insertThumbPage(i);
const QPixmap* pix = source->pageAt(i); const QPixmap* pix = source->pageAt(i);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment