preferencesAboutTextFull
parent
e59ac4ca19
commit
ff9a74b1ea
@ -1,177 +0,0 @@ |
|||||||
/*
|
|
||||||
* 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(); |
|
||||||
} |
|
@ -1,79 +0,0 @@ |
|||||||
/*
|
|
||||||
* 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
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in new issue