Commit ff9a74b1 authored by Claudio Valerio's avatar Claudio Valerio
parent e59ac4ca
......@@ -54,7 +54,6 @@
#include "document/UBDocumentProxy.h"
#include "document/UBDocumentController.h"
#include "board/UBLibraryController.h"
#include "board/UBDrawingController.h"
#include "board/UBBoardView.h"
......@@ -72,7 +71,6 @@ UBBoardController::UBBoardController(UBMainWindow* mainWindow)
, mActiveDocument(0)
, mActiveScene(0)
, mActiveSceneIndex(-1)
, mLibraryController(0)
, mPaletteManager(0)
, mSoftwareUpdateDialog(0)
, mMessageWindow(0)
......@@ -85,8 +83,6 @@ UBBoardController::UBBoardController(UBMainWindow* mainWindow)
, mSystemScaleFactor(1.0)
, mCleanupDone(false)
{
mLibraryController = new UBLibraryController(mMainWindow->centralWidget(), this);
mZoomFactor = UBSettings::settings()->boardZoomFactor->get().toDouble();
int penColorIndex = UBSettings::settings()->penColorIndex();
......
......@@ -25,7 +25,6 @@ class UBApplication;
class UBBoardView;
class UBDocumentController;
class UBLibraryController;
class UBMessageWindow;
class UBGraphicsScene;
class UBDocumentProxy;
......@@ -129,11 +128,6 @@ class UBBoardController : public QObject
return mMarkerColorOnLightBackground;
}
UBLibraryController* libraryController()
{
return mLibraryController;
}
qreal systemScaleFactor()
{
return mSystemScaleFactor;
......@@ -285,7 +279,6 @@ class UBBoardController : public QObject
UBGraphicsScene* mActiveScene;
int mActiveSceneIndex;
UBLibraryController* mLibraryController;
UBBoardPaletteManager *mPaletteManager;
UBSoftwareUpdateDialog *mSoftwareUpdateDialog;
......
......@@ -49,7 +49,6 @@
#include "document/UBDocumentProxy.h"
#include "podcast/UBPodcastController.h"
#include "board/UBLibraryController.h"
#include "board/UBDrawingController.h"
#include "tools/UBToolsManager.h"
......@@ -569,7 +568,8 @@ void UBBoardPaletteManager::addItemToLibrary()
, Qt::KeepAspectRatio, Qt::SmoothTransformation);
}
QImage image = mPixmap.toImage();
UBApplication::boardController->libraryController()->importImageOnLibrary(image);
//UBApplication::boardController->libraryController()->importImageOnLibrary(image);
}
else
{
......@@ -579,29 +579,6 @@ void UBBoardPaletteManager::addItemToLibrary()
mAddItemPalette->hide();
}
//void UBBoardPaletteManager::shareItemOnWeb()
//{
// QPixmap pixmap = mPixmap;
// if(mPixmap.isNull())
// {
// pixmap = QPixmap(mItemUrl.toLocalFile());
// }
// if(!pixmap.isNull())
// {
// UBCapturePublisher* publisher = new UBCapturePublisher(pixmap, this);
// publisher->publish();
// }
// else
// {
// UBApplication::showMessage(tr("Error Publishing Image to the Web"));
// }
// mAddItemPalette->hide();
//}
void UBBoardPaletteManager::zoomButtonPressed()
{
mZoomButtonPressedTime = QTime::currentTime();
......
This diff is collapsed.
......@@ -42,6 +42,7 @@ class UBLibElement
public:
UBLibElement();
UBLibElement(eUBLibElementType type, const QUrl& path, const QString& name);
UBLibElement(UBLibElement* element);
~UBLibElement();
static UBLibElement* trashElement();
......@@ -51,7 +52,7 @@ public:
QUrl path(){return mPath;}
void setPath(QUrl path){mPath = path;}
QImage* thumbnail(){return &mThumbnail;}
void setThumbnail(QImage* pThumb){mThumbnail = *pThumb;}
void setThumbnail(QImage pThumb){mThumbnail = pThumb;}
QString information(){return mInfo;}
void setInformation(QString info){mInfo = info;}
QString name(){return mName;}
......@@ -91,7 +92,7 @@ class UBLibraryController : public QObject
Q_OBJECT;
public:
UBLibraryController(QWidget *parentWidget, UBBoardController *boardController);
UBLibraryController(QWidget *parentWidget);
virtual ~UBLibraryController();
QList<UBLibElement*> getContent(UBLibElement* pElement);
......@@ -134,14 +135,16 @@ class UBLibraryController : public QObject
void persistFavoriteList();
void readFavoriteList();
QList<UBLibElement*> mInternalLibElements;
QList<UBLibElement*> mElementsList;
void cleanElementsList();
private:
QList<UBLibElement*> rootCategoriesList();
QList<UBLibElement*> listElementsInPath(const QString& pPath);
QList<UBLibElement*> listElementsInVirtualForlder(UBLibElement* pElement);
void userPath(QUrl &pPath);
QImage* thumbnailForFile(UBLibElement* pPath);
QImage* createThumbnail(UBLibElement* pPath);
QImage thumbnailForFile(UBLibElement* pPath);
QImage createThumbnail(UBLibElement* pPath);
QList<UBLibElement*> addVirtualElementsForItemPath(const QString& pPath);
void createInternalWidgetItems();
......
......@@ -38,7 +38,6 @@
#include "board/UBBoardController.h"
#include "board/UBDrawingController.h"
#include "board/UBLibraryController.h"
#include "board/UBBoardView.h"
#include "web/UBWebController.h"
......@@ -380,10 +379,10 @@ void UBApplication::toolBarDisplayTextChanged(QVariant display)
}
void UBApplication::closeEvent(QCloseEvent *event)
{
void UBApplication::closeEvent(QCloseEvent *event)
{
Q_UNUSED(event);
closing();
}
......
......@@ -16,9 +16,9 @@
#include <QSize>
#include <QDebug>
#include "UBLibWidget.h"
#include "UBLibActionBar.h"
#include "core/UBApplication.h"
#include "board/UBBoardController.h"
#include "core/memcheck.h"
......@@ -361,7 +361,8 @@ void UBLibActionBar::onSelectionChanged(QList<UBLibElement *> itemList, bool isI
*/
UBLibraryController* UBLibActionBar::libraryController()
{
return UBApplication::boardController->libraryController();
UBLibWidget* libWidget = dynamic_cast<UBLibWidget*>(parentWidget());
return libWidget->libNavigator()->libraryWidget()->libraryController();
}
/**
......
......@@ -12,15 +12,14 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "UBLibWidget.h"
#include "UBLibItemProperties.h"
#include "core/UBApplication.h"
#include "board/UBBoardController.h"
#include "frameworks/UBFileSystemUtils.h"
#include "core/memcheck.h"
/**
......@@ -223,7 +222,8 @@ void UBLibItemProperties::adaptSize()
*/
void UBLibItemProperties::onAddToPage()
{
UBApplication::boardController->libraryController()->addItemToPage(mpElement);
UBLibWidget* libWidget = dynamic_cast<UBLibWidget*>(parentWidget()->parentWidget());
libWidget->libNavigator()->libraryWidget()->libraryController()->addItemToPage(mpElement);
}
/**
......@@ -239,7 +239,8 @@ void UBLibItemProperties::onAddToLib()
*/
void UBLibItemProperties::onSetAsBackground()
{
UBApplication::boardController->libraryController()->setItemAsBackground(mpElement);
UBLibWidget* libWidget = dynamic_cast<UBLibWidget*>(parentWidget()->parentWidget());
libWidget->libNavigator()->libraryWidget()->libraryController()->setItemAsBackground(mpElement);
}
/**
......
......@@ -13,7 +13,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "UBLibNavigatorWidget.h"
#include "UBRightPalette.h"
#include "UBLibWidget.h"
#include "core/memcheck.h"
......@@ -27,19 +27,18 @@ static int tickIntervalForSlider = 10;
* @param name as the object name
*/
UBLibNavigatorWidget::UBLibNavigatorWidget(QWidget *parent, const char *name):QWidget(parent)
, mLayout(NULL)
, mLibWidget(NULL)
, mPathViewer(NULL)
, mSlider(NULL)
, mSliderWidthSetting(NULL)
, mLayout(NULL)
, mLibWidget(NULL)
, mPathViewer(NULL)
, mSlider(NULL)
, mSliderWidthSetting(NULL)
{
setObjectName(name);
setAcceptDrops(true);
UBRightPalette* pRightPalette = dynamic_cast<UBRightPalette*>(parentWidget());
UBLibWidget* libWidget = dynamic_cast<UBLibWidget*>(parentWidget());
mLayout = new QVBoxLayout(this);
// mLayout->setContentsMargins(20, 5, 5, 5);
setLayout(mLayout);
mPathViewer = new UBLibPathViewer(this);
......@@ -66,15 +65,13 @@ UBLibNavigatorWidget::UBLibNavigatorWidget(QWidget *parent, const char *name):QW
connect(mSlider,SIGNAL(valueChanged(int)),this,SLOT(updateThumbnailsSize(int)));
connect(mPathViewer, SIGNAL(elementsDropped(QList<QString>,UBLibElement*)), mLibWidget, SLOT(onElementsDropped(QList<QString>,UBLibElement*)));
if(NULL != pRightPalette)
{
connect(mLibWidget, SIGNAL(navigBarUpdate(UBLibElement*)), pRightPalette->libWidget()->actionBar(), SLOT(onNavigbarUpdate(UBLibElement*)));
connect(mLibWidget, SIGNAL(itemsSelected(QList<UBLibElement*>, bool)), pRightPalette->libWidget()->actionBar(), SLOT(onSelectionChanged(QList<UBLibElement*>, bool)));
connect(pRightPalette->libWidget()->actionBar(), SIGNAL(deleteDone()), mLibWidget, SLOT(onRefreshCurrentFolder()));
connect(mLibWidget, SIGNAL(favoritesEntered(bool)), pRightPalette->libWidget()->actionBar(), SLOT(onFavoritesEntered(bool)));
connect(pRightPalette->libWidget()->actionBar(), SIGNAL(searchElement(QString)), mLibWidget, SLOT(onSearchElement(QString)));
connect(pRightPalette->libWidget()->actionBar(), SIGNAL(newFolderToCreate()), mLibWidget, SLOT(onNewFolderToCreate()));
}
connect(mLibWidget, SIGNAL(navigBarUpdate(UBLibElement*)), libWidget->actionBar(), SLOT(onNavigbarUpdate(UBLibElement*)));
connect(mLibWidget, SIGNAL(itemsSelected(QList<UBLibElement*>, bool)), libWidget->actionBar(), SLOT(onSelectionChanged(QList<UBLibElement*>, bool)));
connect(libWidget->actionBar(), SIGNAL(deleteDone()), mLibWidget, SLOT(onRefreshCurrentFolder()));
connect(mLibWidget, SIGNAL(favoritesEntered(bool)), libWidget->actionBar(), SLOT(onFavoritesEntered(bool)));
connect(libWidget->actionBar(), SIGNAL(searchElement(QString)), mLibWidget, SLOT(onSearchElement(QString)));
connect(libWidget->actionBar(), SIGNAL(newFolderToCreate()), mLibWidget, SLOT(onNewFolderToCreate()));
mLibWidget->init();
}
......@@ -147,6 +144,7 @@ void UBLibNavigatorWidget::removeNextChainedElements(UBChainedLibElement *fromEl
if(NULL != fromElem->nextElement())
{
removeNextChainedElements(fromElem->nextElement());
delete fromElem->nextElement()->element();
delete fromElem->nextElement();
fromElem->setNextElement(NULL);
}
......
......@@ -32,6 +32,8 @@ public:
~UBLibNavigatorWidget();
void dropMe(const QMimeData* _data);
UBLibraryWidget* libraryWidget(){return mLibWidget;};
signals:
void propertiesRequested(UBLibElement* elem);
......
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <QDebug>
#include "UBLibPalette.h"
#include "core/memcheck.h"
/**
* \brief Constructor
* @param parent as the parent widget
* @param name as the object name
*/
UBLibPalette::UBLibPalette(QWidget *parent, const char *name):UBDockPalette(parent, name)
, mLayout(NULL)
, mStackedWidget(NULL)
, mNavigator(NULL)
, mProperties(NULL)
, mActionBar(NULL)
{
setOrientation(eUBDockOrientation_Right);
setAcceptDrops(true);
resize(UBSettings::settings()->libPaletteWidth->get().toInt(), parentWidget()->height());
setContentsMargins(border(), 0, 0, 0);
mCollapseWidth = 180;
mLastWidth = 300;
mLayout = new QVBoxLayout(this);
mLayout->setContentsMargins(20, customMargin(), customMargin(), customMargin());
setLayout(mLayout);
// Build the GUI
mStackedWidget = new QStackedWidget(this);
mActionBar = new UBLibActionBar(this);
mNavigator = new UBLibNavigatorWidget(this);
mProperties = new UBLibItemProperties(this);
mLayout->addWidget(mStackedWidget, 1);
mLayout->addWidget(mActionBar, 0);
mStackedWidget->addWidget(mNavigator);
mStackedWidget->addWidget(mProperties);
mStackedWidget->setCurrentIndex(ID_NAVIGATOR);
miCrntStackWidget = ID_NAVIGATOR;
connect(mNavigator, SIGNAL(propertiesRequested(UBLibElement*)), this, SLOT(showProperties(UBLibElement*)));
connect(mProperties, SIGNAL(showFolderContent()), this, SLOT(showFolder()));
}
/**
* \brief Destructor
*/
UBLibPalette::~UBLibPalette()
{
if(NULL != mProperties)
{
delete mProperties;
mProperties = NULL;
}
if(NULL != mActionBar)
{
delete mActionBar;
mActionBar = NULL;
}
}
/**
* \brief Update the maximum width
*/
void UBLibPalette::updateMaxWidth()
{
setMaximumWidth((int)((parentWidget()->width() * 2)/3));
setMaximumHeight(parentWidget()->height());
setMinimumHeight(parentWidget()->height());
}
/**
* \brief Handles the drag enter event
* @param pEvent as the drag enter event
*/
void UBLibPalette::dragEnterEvent(QDragEnterEvent *pEvent)
{
setBackgroundRole(QPalette::Highlight);
pEvent->acceptProposedAction();
}
void UBLibPalette::dragLeaveEvent(QDragLeaveEvent *pEvent)
{
pEvent->accept();
}
/**
* \brief Handles the drop event
* @param pEvent as the drop event
*/
void UBLibPalette::dropEvent(QDropEvent *pEvent)
{
processMimeData(pEvent->mimeData());
setBackgroundRole(QPalette::Dark);
mStackedWidget->setCurrentIndex(miCrntStackWidget);
pEvent->acceptProposedAction();
}
/**
* \brief Handles the drag move event
* @param pEvent as the drag move event
*/
void UBLibPalette::dragMoveEvent(QDragMoveEvent *pEvent)
{
pEvent->acceptProposedAction();
}
/**
* \brief Process the dropped MIME data
* @param pData as the mime dropped data
*/
void UBLibPalette::processMimeData(const QMimeData *pData)
{
// Display the different mime types contained in the mime data
QStringList qslFormats = pData->formats();
for(int i = 0; i < qslFormats.size(); i++)
{
qDebug() << "Dropped element format " << i << " = "<< qslFormats.at(i);
}
}
void UBLibPalette::mouseMoveEvent(QMouseEvent *event)
{
if(mCanResize)
{
UBDockPalette::mouseMoveEvent(event);
}
else
{
//qDebug() << "Mouse move event detected!" ;
}
}
void UBLibPalette::showProperties(UBLibElement *elem)
{
if(NULL != elem)
{
mActionBar->setButtons(eButtonSet_Properties);
// Show the properties of this object
mProperties->showElement(elem);
mStackedWidget->setCurrentIndex(ID_PROPERTIES);
miCrntStackWidget = ID_PROPERTIES;
}
}
void UBLibPalette::showFolder()
{
mActionBar->setButtons(mActionBar->previousButtonSet());
mStackedWidget->setCurrentIndex(ID_NAVIGATOR);
miCrntStackWidget = ID_NAVIGATOR;
}
void UBLibPalette::resizeEvent(QResizeEvent *event)
{
UBDockPalette::resizeEvent(event);
UBSettings::settings()->libPaletteWidth->set(width());
emit resized();
}
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef UBLIBPALETTE_H
#define UBLIBPALETTE_H
#include <QWidget>
#include <QVBoxLayout>
#include <QStackedWidget>
#include <QDragEnterEvent>
#include <QDropEvent>
#include <QDragMoveEvent>
#include <QMimeData>
#include <QMouseEvent>
#include <QResizeEvent>
#include <QLabel>
#include "UBDockPalette.h"
#include "UBLibNavigatorWidget.h"
#include "UBLibItemProperties.h"
#include "UBLibActionBar.h"
#define ID_NAVIGATOR 0
#define ID_PROPERTIES 1
class UBLibPalette : public UBDockPalette
{
Q_OBJECT
public:
UBLibPalette(QWidget* parent=0, const char* name="libPalette");
~UBLibPalette();
UBLibActionBar* actionBar(){return mActionBar;}
signals:
void resized();
protected:
void updateMaxWidth();
void dragEnterEvent(QDragEnterEvent* pEvent);
void dropEvent(QDropEvent *pEvent);
void dragMoveEvent(QDragMoveEvent* pEvent);
void dragLeaveEvent(QDragLeaveEvent* pEvent);
void mouseMoveEvent(QMouseEvent *event);
void resizeEvent(QResizeEvent *event);
private slots:
void showProperties(UBLibElement* elem);
void showFolder();
private:
void processMimeData(const QMimeData* pData);
/** The layout */
QVBoxLayout* mLayout;
/** The stacked layout */
QStackedWidget* mStackedWidget;
/** The Navigator widget */
UBLibNavigatorWidget* mNavigator;
/** The Properties widget */
UBLibItemProperties* mProperties;
/** UBLibActionBar */
UBLibActionBar* mActionBar;
/** The current stack widget index*/
int miCrntStackWidget;
};
#endif // UBLIBPALETTE_H
......@@ -42,6 +42,7 @@ public:
~UBLibWidget();
UBLibActionBar* actionBar(){return mActionBar;}
UBLibNavigatorWidget* libNavigator() {return mNavigator;};
signals:
void resized();
......
This diff is collapsed.
......@@ -29,7 +29,10 @@
#include <QVBoxLayout>
#include "UBThumbnailWidget.h"
#include "board/UBLibraryController.h"
class UBLibraryController;
class UBChainedLibElement;
class UBLibElement;
class UBLibraryWidget : public UBThumbnailWidget
{
......@@ -44,6 +47,8 @@ public:
void updateThumbnailsSize(int newSize);
void init();
UBLibraryController* libraryController() {return mLibraryController;};
public slots:
void onRefreshCurrentFolder();
void onElementsDropped(QList<QString> elements, UBLibElement* target);
......@@ -71,14 +76,13 @@ private:
void appendChainedElement(UBChainedLibElement* element, UBChainedLibElement* toElem);
UBLibElement* elementAt(QPoint p);
UBLibElement* elementFromFilePath(const QString& filePath);
UBLibraryController* libraryController();
UBLibraryController* mLibraryController;
UBLibElement* mpCrntDir;
UBLibElement* mpCrntElem;
QList<UBLibElement*> mCurrentElems;
QList<UBLibElement*> mOrigCurrentElems;
QList<QGraphicsItem*> mItems;
QString mCrntPath;
};
......
......@@ -29,7 +29,6 @@ HEADERS += src/gui/UBThumbnailView.h \
src/gui/UBFavoriteToolPalette.h \
src/gui/UBKeyboardPalette.h \
src/gui/UBNavigatorPalette.h \
src/gui/UBLibPalette.h \
src/gui/UBDocumentNavigator.h \
src/gui/UBDockPalette.h \
src/gui/UBPropertyPalette.h \
......@@ -76,7 +75,6 @@ SOURCES += src/gui/UBThumbnailView.cpp \
src/gui/UBFavoriteToolPalette.cpp \
src/gui/UBKeyboardPalette.cpp \
src/gui/UBNavigatorPalette.cpp \
src/gui/UBLibPalette.cpp \
src/gui/UBDocumentNavigator.cpp \
src/gui/UBDockPalette.cpp \
src/gui/UBPropertyPalette.cpp \
......
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