parent
bb6a1ebf5c
commit
11f8c6b5a5
@ -0,0 +1,44 @@ |
||||
/*
|
||||
* 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 "UBLeftPalette.h" |
||||
|
||||
UBLeftPalette::UBLeftPalette(QWidget *parent, const char *name):UBDockPalette(parent) |
||||
, mpPageNavigator(NULL) |
||||
{ |
||||
setObjectName(name); |
||||
setOrientation(eUBDockOrientation_Left); |
||||
mLastWidth = 300; |
||||
setMaximumWidth(300); |
||||
resize(UBSettings::settings()->navigPaletteWidth->get().toInt(), height()); |
||||
|
||||
mpLayout->setContentsMargins(customMargin(), customMargin(), 2*border() + customMargin(), customMargin()); |
||||
|
||||
mpPageNavigator = new UBPageNavigationWidget(this); |
||||
addTabWidget(mpPageNavigator); |
||||
} |
||||
|
||||
UBLeftPalette::~UBLeftPalette() |
||||
{ |
||||
if(NULL != mpPageNavigator) |
||||
{ |
||||
delete mpPageNavigator; |
||||
mpPageNavigator = NULL; |
||||
} |
||||
} |
||||
|
||||
UBPageNavigationWidget* UBLeftPalette::pageNavigator() |
||||
{ |
||||
return mpPageNavigator; |
||||
} |
@ -0,0 +1,34 @@ |
||||
/*
|
||||
* 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 UBLEFTPALETTE_H |
||||
#define UBLEFTPALETTE_H |
||||
|
||||
#include "UBDockPalette.h" |
||||
#include "UBPageNavigationWidget.h" |
||||
|
||||
class UBLeftPalette : public UBDockPalette |
||||
{ |
||||
public: |
||||
UBLeftPalette(QWidget* parent=0, const char* name="UBLeftPalette"); |
||||
~UBLeftPalette(); |
||||
|
||||
UBPageNavigationWidget* pageNavigator(); |
||||
|
||||
private: |
||||
UBPageNavigationWidget* mpPageNavigator; |
||||
|
||||
}; |
||||
|
||||
#endif // UBLEFTPALETTE_H
|
@ -0,0 +1,154 @@ |
||||
/*
|
||||
* 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 "UBLibWidget.h" |
||||
#include "core/memcheck.h" |
||||
|
||||
/**
|
||||
* \brief Constructor |
||||
* @param parent as the parent widget |
||||
* @param name as the object name |
||||
*/ |
||||
UBLibWidget::UBLibWidget(QWidget *parent, const char *name):UBDockPaletteWidget(parent) |
||||
, mLayout(NULL) |
||||
, mStackedWidget(NULL) |
||||
, mNavigator(NULL) |
||||
, mProperties(NULL) |
||||
, mActionBar(NULL) |
||||
{ |
||||
setObjectName(name); |
||||
mName = "LibWidget"; |
||||
mIconToLeft = QPixmap(":images/library_open.png"); |
||||
mIconToRight = QPixmap(":images/library_close.png"); |
||||
setAcceptDrops(true); |
||||
|
||||
mLayout = new QVBoxLayout(this); |
||||
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 |
||||
*/ |
||||
UBLibWidget::~UBLibWidget() |
||||
{ |
||||
if(NULL != mProperties) |
||||
{ |
||||
delete mProperties; |
||||
mProperties = NULL; |
||||
} |
||||
if(NULL != mActionBar) |
||||
{ |
||||
delete mActionBar; |
||||
mActionBar = NULL; |
||||
} |
||||
} |
||||
|
||||
/**
|
||||
* \brief Handles the drag enter event |
||||
* @param pEvent as the drag enter event |
||||
*/ |
||||
void UBLibWidget::dragEnterEvent(QDragEnterEvent *pEvent) |
||||
{ |
||||
setBackgroundRole(QPalette::Highlight); |
||||
pEvent->acceptProposedAction(); |
||||
} |
||||
|
||||
void UBLibWidget::dragLeaveEvent(QDragLeaveEvent *pEvent) |
||||
{ |
||||
pEvent->accept(); |
||||
} |
||||
|
||||
/**
|
||||
* \brief Handles the drop event |
||||
* @param pEvent as the drop event |
||||
*/ |
||||
void UBLibWidget::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 UBLibWidget::dragMoveEvent(QDragMoveEvent *pEvent) |
||||
{ |
||||
pEvent->acceptProposedAction(); |
||||
} |
||||
|
||||
/**
|
||||
* \brief Process the dropped MIME data |
||||
* @param pData as the mime dropped data |
||||
*/ |
||||
void UBLibWidget::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 UBLibWidget::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 UBLibWidget::showFolder() |
||||
{ |
||||
mActionBar->setButtons(mActionBar->previousButtonSet()); |
||||
mStackedWidget->setCurrentIndex(ID_NAVIGATOR); |
||||
miCrntStackWidget = ID_NAVIGATOR; |
||||
} |
||||
|
||||
int UBLibWidget::customMargin() |
||||
{ |
||||
return 5; |
||||
} |
||||
|
||||
int UBLibWidget::border() |
||||
{ |
||||
return 15; |
||||
} |
@ -0,0 +1,78 @@ |
||||
/*
|
||||
* 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 UBLIBWIDGET_H |
||||
#define UBLIBWIDGET_H |
||||
|
||||
#include <QWidget> |
||||
#include <QVBoxLayout> |
||||
#include <QStackedWidget> |
||||
#include <QDragEnterEvent> |
||||
#include <QDropEvent> |
||||
#include <QDragMoveEvent> |
||||
#include <QMimeData> |
||||
#include <QMouseEvent> |
||||
#include <QResizeEvent> |
||||
#include <QLabel> |
||||
|
||||
#include "UBDockPaletteWidget.h" |
||||
#include "UBLibNavigatorWidget.h" |
||||
#include "UBLibItemProperties.h" |
||||
#include "UBLibActionBar.h" |
||||
|
||||
#define ID_NAVIGATOR 0 |
||||
#define ID_PROPERTIES 1 |
||||
|
||||
class UBLibWidget : public UBDockPaletteWidget |
||||
{ |
||||
Q_OBJECT |
||||
public: |
||||
UBLibWidget(QWidget* parent=0, const char* name="UBLibWidget"); |
||||
~UBLibWidget(); |
||||
|
||||
UBLibActionBar* actionBar(){return mActionBar;} |
||||
|
||||
signals: |
||||
void resized(); |
||||
|
||||
protected: |
||||
void dragEnterEvent(QDragEnterEvent* pEvent); |
||||
void dropEvent(QDropEvent *pEvent); |
||||
void dragMoveEvent(QDragMoveEvent* pEvent); |
||||
void dragLeaveEvent(QDragLeaveEvent* pEvent); |
||||
|
||||
private slots: |
||||
void showProperties(UBLibElement* elem); |
||||
void showFolder(); |
||||
|
||||
private: |
||||
void processMimeData(const QMimeData* pData); |
||||
int customMargin(); |
||||
int border(); |
||||
|
||||
/** 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 // UBLIBWIDGET_H
|
@ -0,0 +1,195 @@ |
||||
/*
|
||||
* 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 "UBPageNavigationWidget.h" |
||||
#include "core/UBApplication.h" |
||||
#include "board/UBBoardController.h" |
||||
#include "core/memcheck.h" |
||||
|
||||
/**
|
||||
* \brief Constructor |
||||
* @param parent as the parent widget |
||||
* @param name as the object name |
||||
*/ |
||||
UBPageNavigationWidget::UBPageNavigationWidget(QWidget *parent, const char *name):UBDockPaletteWidget(parent) |
||||
, mNavigator(NULL) |
||||
, mLayout(NULL) |
||||
, mHLayout(NULL) |
||||
, mPageNbr(NULL) |
||||
, mClock(NULL) |
||||
{ |
||||
setObjectName(name); |
||||
mName = "PageNavigator"; |
||||
|
||||
mIconToRight = QPixmap(":images/pages_open.png"); |
||||
mIconToLeft = QPixmap(":images/pages_close.png"); |
||||
|
||||
// Build the gui
|
||||
mLayout = new QVBoxLayout(this); |
||||
//mLayout->setContentsMargins(customMargin(), customMargin(), 2*border() + customMargin(), customMargin());
|
||||
setLayout(mLayout); |
||||
|
||||
mNavigator = new UBDocumentNavigator(this); |
||||
mNavigator->setStyleSheet(QString("background-color : transparent;")); |
||||
mLayout->addWidget(mNavigator, 1); |
||||
|
||||
mHLayout = new QHBoxLayout(); |
||||
mLayout->addLayout(mHLayout, 0); |
||||
|
||||
mPageNbr = new QLabel(this); |
||||
mClock = new QLabel(this); |
||||
mHLayout->addWidget(mPageNbr); |
||||
mHLayout->addWidget(mClock); |
||||
|
||||
// Configure the page number indicator
|
||||
mPageNbr->setStyleSheet(QString("QLabel { color: white; background-color: transparent; border: none; font-family: Arial; font-weight: bold; font-size: 20px }")); |
||||
setPageNumber(0, 0); |
||||
mPageNbr->setAlignment(Qt::AlignHCenter); |
||||
|
||||
// Configure the clock
|
||||
mClock->setStyleSheet(QString("QLabel {color: white; background-color: transparent; text-align: center; font-family: Arial; font-weight: bold; font-size: 20px}")); |
||||
mTimeFormat = QLocale::system().timeFormat(QLocale::ShortFormat); |
||||
mClock->setAlignment(Qt::AlignHCenter); |
||||
|
||||
//strip seconds
|
||||
mTimeFormat = mTimeFormat.remove(":ss"); |
||||
mTimeFormat = mTimeFormat.remove(":s"); |
||||
mTimerID = startTimer(1000); |
||||
|
||||
connect(mNavigator, SIGNAL(changeCurrentPage()), this, SLOT(changeCurrentPage())); |
||||
} |
||||
|
||||
/**
|
||||
* \brief Destructor |
||||
*/ |
||||
UBPageNavigationWidget::~UBPageNavigationWidget() |
||||
{ |
||||
killTimer(mTimerID); |
||||
|
||||
if(NULL != mClock) |
||||
{ |
||||
delete mClock; |
||||
mClock = NULL; |
||||
} |
||||
if(NULL != mPageNbr) |
||||
{ |
||||
delete mPageNbr; |
||||
mPageNbr = NULL; |
||||
} |
||||
if(NULL != mHLayout) |
||||
{ |
||||
delete mHLayout; |
||||
mHLayout = NULL; |
||||
} |
||||
if(NULL != mLayout) |
||||
{ |
||||
delete mLayout; |
||||
mLayout = NULL; |
||||
} |
||||
if(NULL != mNavigator) |
||||
{ |
||||
delete mNavigator; |
||||
mNavigator = NULL; |
||||
} |
||||
} |
||||
|
||||
/**
|
||||
* \brief Set the current document in the navigator |
||||
* @param document as the given document |
||||
*/ |
||||
void UBPageNavigationWidget::setDocument(UBDocumentProxy *document) |
||||
{ |
||||
if(mNavigator->currentDoc() != document) |
||||
{ |
||||
mNavigator->setDocument(document); |
||||
} |
||||
} |
||||
|
||||
/**
|
||||
* \brief Change the current page |
||||
*/ |
||||
void UBPageNavigationWidget::changeCurrentPage() |
||||
{ |
||||
// Get the index of the page to display
|
||||
int iPage = mNavigator->selectedPageNumber(); |
||||
if(NO_PAGESELECTED != iPage) |
||||
{ |
||||
// Display the selected page
|
||||
UBApplication::boardController->setActiveDocumentScene(mNavigator->currentDoc(), iPage); |
||||
} |
||||
} |
||||
|
||||
/**
|
||||
* \brief Refresh the thumbnails widget |
||||
*/ |
||||
void UBPageNavigationWidget::refresh() |
||||
{ |
||||
mNavigator->setDocument(UBApplication::boardController->activeDocument()); |
||||
} |
||||
|
||||
/**
|
||||
* \brief Handle the resize event |
||||
* @param event as the resize event |
||||
*/ |
||||
void UBPageNavigationWidget::resizeEvent(QResizeEvent *event) |
||||
{ |
||||
emit resizeRequest(event); |
||||
//UBDockPalette::resizeEvent(event);
|
||||
if(NULL != mNavigator) |
||||
{ |
||||
mNavigator->setMinimumHeight(height() - 2*border()); |
||||
} |
||||
UBSettings::settings()->navigPaletteWidth->set(width()); |
||||
} |
||||
|
||||
/**
|
||||
* \brief Notify a timer event |
||||
* @param event as the timer event |
||||
*/ |
||||
void UBPageNavigationWidget::timerEvent(QTimerEvent *event) |
||||
{ |
||||
Q_UNUSED(event); |
||||
updateTime(); |
||||
} |
||||
|
||||
/**
|
||||
* \brief Update the current time |
||||
*/ |
||||
void UBPageNavigationWidget::updateTime() |
||||
{ |
||||
if (mClock) |
||||
{ |
||||
mClock->setText(QLocale::system().toString (QTime::currentTime(), mTimeFormat)); |
||||
} |
||||
} |
||||
|
||||
/**
|
||||
* \brief Set the page number |
||||
* @param current as the current page |
||||
* @param total as the total number of pages |
||||
*/ |
||||
void UBPageNavigationWidget::setPageNumber(int current, int total) |
||||
{ |
||||
mPageNbr->setText(QString("%1 / %2").arg(current).arg(total)); |
||||
} |
||||
|
||||
int UBPageNavigationWidget::customMargin() |
||||
{ |
||||
return 5; |
||||
} |
||||
|
||||
int UBPageNavigationWidget::border() |
||||
{ |
||||
return 15; |
||||
} |
@ -0,0 +1,68 @@ |
||||
/*
|
||||
* 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 UBPAGENAVIGATIONWIDGET_H |
||||
#define UBPAGENAVIGATIONWIDGET_H |
||||
|
||||
#include <QVBoxLayout> |
||||
#include <QHBoxLayout> |
||||
#include <QMouseEvent> |
||||
#include <QResizeEvent> |
||||
#include <QTimerEvent> |
||||
#include <QLabel> |
||||
#include <QString> |
||||
|
||||
#include "UBDocumentNavigator.h" |
||||
#include "UBDockPaletteWidget.h" |
||||
#include "document/UBDocumentProxy.h" |
||||
|
||||
class UBPageNavigationWidget : public UBDockPaletteWidget |
||||
{ |
||||
Q_OBJECT |
||||
public: |
||||
UBPageNavigationWidget(QWidget* parent=0, const char* name="UBPageNavigationWidget"); |
||||
~UBPageNavigationWidget(); |
||||
void setDocument(UBDocumentProxy* document); |
||||
void refresh(); |
||||
|
||||
signals: |
||||
void resizeRequest(QResizeEvent* event); |
||||
|
||||
public slots: |
||||
void setPageNumber(int current, int total); |
||||
|
||||
protected: |
||||
virtual void resizeEvent(QResizeEvent *event); |
||||
virtual void timerEvent(QTimerEvent *event); |
||||
|
||||
private: |
||||
void updateTime(); |
||||
int customMargin(); |
||||
int border(); |
||||
|
||||
/** The thumbnails navigator widget */ |
||||
UBDocumentNavigator* mNavigator; |
||||
/** The layout */ |
||||
QVBoxLayout* mLayout; |
||||
QHBoxLayout* mHLayout; |
||||
QLabel* mPageNbr; |
||||
QLabel* mClock; |
||||
QString mTimeFormat; |
||||
int mTimerID; |
||||
|
||||
private slots: |
||||
void changeCurrentPage(); |
||||
}; |
||||
|
||||
#endif // UBPAGENAVIGATIONWIDGET_H
|
@ -0,0 +1,73 @@ |
||||
/*
|
||||
* 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 "UBRightPalette.h" |
||||
|
||||
UBRightPalette::UBRightPalette(QWidget *parent, const char *name):UBDockPalette(parent) |
||||
, mpLibWidget(NULL) |
||||
{ |
||||
setObjectName(name); |
||||
setOrientation(eUBDockOrientation_Right); |
||||
setOrientation(eUBDockOrientation_Right); |
||||
mCollapseWidth = 180; |
||||
mLastWidth = 300; |
||||
resize(UBSettings::settings()->libPaletteWidth->get().toInt(), parentWidget()->height()); |
||||
mpLayout->setContentsMargins(2*border() + customMargin(), customMargin(), customMargin(), customMargin()); |
||||
|
||||
mpLibWidget = new UBLibWidget(this); |
||||
addTabWidget(mpLibWidget); |
||||
} |
||||
|
||||
UBRightPalette::~UBRightPalette() |
||||
{ |
||||
if(NULL != mpLibWidget) |
||||
{ |
||||
delete mpLibWidget; |
||||
mpLibWidget = NULL; |
||||
} |
||||
} |
||||
|
||||
UBLibWidget* UBRightPalette::libWidget() |
||||
{ |
||||
return mpLibWidget; |
||||
} |
||||
|
||||
void UBRightPalette::mouseMoveEvent(QMouseEvent *event) |
||||
{ |
||||
if(mCanResize) |
||||
{ |
||||
UBDockPalette::mouseMoveEvent(event); |
||||
} |
||||
else |
||||
{ |
||||
//qDebug() << "Mouse move event detected!" ;
|
||||
} |
||||
} |
||||
|
||||
void UBRightPalette::resizeEvent(QResizeEvent *event) |
||||
{ |
||||
UBDockPalette::resizeEvent(event); |
||||
UBSettings::settings()->libPaletteWidth->set(width()); |
||||
emit resized(); |
||||
} |
||||
|
||||
/**
|
||||
* \brief Update the maximum width |
||||
*/ |
||||
void UBRightPalette::updateMaxWidth() |
||||
{ |
||||
setMaximumWidth((int)((parentWidget()->width() * 2)/3)); |
||||
setMaximumHeight(parentWidget()->height()); |
||||
setMinimumHeight(parentWidget()->height()); |
||||
} |
@ -0,0 +1,42 @@ |
||||
/*
|
||||
* 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 UBRIGHTPALETTE_H |
||||
#define UBRIGHTPALETTE_H |
||||
|
||||
#include "UBDockPalette.h" |
||||
#include "UBLibWidget.h" |
||||
|
||||
class UBRightPalette : public UBDockPalette |
||||
{ |
||||
Q_OBJECT |
||||
public: |
||||
UBRightPalette(QWidget* parent=0, const char* name="UBRightPalette"); |
||||
~UBRightPalette(); |
||||
|
||||
UBLibWidget* libWidget(); |
||||
|
||||
signals: |
||||
void resized(); |
||||
|
||||
protected: |
||||
void updateMaxWidth(); |
||||
void mouseMoveEvent(QMouseEvent *event); |
||||
void resizeEvent(QResizeEvent *event); |
||||
|
||||
private: |
||||
UBLibWidget* mpLibWidget; |
||||
}; |
||||
|
||||
#endif // UBRIGHTPALETTE_H
|
Loading…
Reference in new issue