Commit 0febe749 authored by NICLAUSSE Nicolas's avatar NICLAUSSE Nicolas

rename dtkWidgetsStackBar to dtkWidgetsWorkspaceStackBar

parent 6451f553
......@@ -369,7 +369,7 @@ dummyWindow::dummyWindow(QWidget *parent) : QFrame(parent)
this->stack->addWidget(dtk::widgets::workspace::pluginFactory().create("dummyWorkspaceB"));
this->stack->addWidget(dtk::widgets::workspace::pluginFactory().create("dummyWorkspaceC"));
dtkWidgetsStackBar *stack_bar = new dtkWidgetsStackBar(this);
dtkWidgetsWorkspaceStackBar *stack_bar = new dtkWidgetsWorkspaceStackBar(this);
stack_bar->setStack(this->stack);
QHBoxLayout *l = new QHBoxLayout(this);
......@@ -413,19 +413,19 @@ dummyWindowBar::dummyWindowBar(QWidget *parent) : QFrame(parent)
// For a dynamic bar with a botton that pops a menu to create new workspace:
//
// bar->addWorkspaceInMenu("dummyWorkspaceA", "My Dummy Workspace A");
// bar->addWorkspaceInMenu("dummyWorkspaceB", "My Dummy Workspace B", fa::image, "category1");
// bar->addWorkspaceInMenu("dummyWorkspaceC", "dtk", fa::image, "category1");
// bar->addWorkspaceInMenu("dummyWorkspaceA", "My Dummy Workspace A");
// bar->addWorkspaceInMenu("dummyWorkspaceB", "My Dummy Workspace B", fa::image, "category1");
// bar->addWorkspaceInMenu("dummyWorkspaceC", "dtk", fa::image, "category1");
// Another option is to build automatically the bar from the factory keys
bar->buildFromFactory();
// bar->buildFromFactory();
// here we use a static workspace bar
//
// bar->setDynamic(false);
// bar->createWorkspace("My Dummy Workspace A", "dummyWorkspaceA", false );
// bar->createWorkspace("My Dummy Workspace B", "dummyWorkspaceB", false );
bar->setDynamic(false);
bar->createWorkspace("My Dummy Workspace A", "dummyWorkspaceA", false );
bar->createWorkspace("My Dummy Workspace B", "dummyWorkspaceB", false );
QVBoxLayout *l = new QVBoxLayout(this);
l->setContentsMargins(0, 0, 0, 0);
......
......@@ -81,14 +81,14 @@ set(${PROJECT_NAME}_HEADERS
dtkWidgetsParameterStringListComboBox.h
dtkWidgetsSettings
dtkWidgetsSettings.h
dtkWidgetsStackBar
dtkWidgetsStackBar.h
dtkWidgetsWidget
dtkWidgetsWidget.h
dtkWidgetsWorkspace
dtkWidgetsWorkspace.h
dtkWidgetsWorkspaceBar
dtkWidgetsWorkspaceBar.h)
dtkWidgetsWorkspaceBar.h
dtkWidgetsWorkspaceStackBar
dtkWidgetsWorkspaceStackBar.h)
set(${PROJECT_NAME}_SOURCES
dtkApplication.cpp
......@@ -122,10 +122,10 @@ set(${PROJECT_NAME}_SOURCES
dtkWidgetsParameterMenuBarGenerator.cpp
dtkWidgetsParameterStringListComboBox.cpp
dtkWidgetsSettings.cpp
dtkWidgetsStackBar.cpp
dtkWidgetsWidget.cpp
dtkWidgetsWorkspace.cpp
dtkWidgetsWorkspaceBar.cpp)
dtkWidgetsWorkspaceBar.cpp
dtkWidgetsWorkspaceStackBar.cpp)
## #################################################################
## Build rules
......
......@@ -27,7 +27,7 @@
#include "dtkWidgetsParameterMenuBarGenerator.h"
#include "dtkWidgetsParameterStringListComboBox.h"
#include "dtkWidgetsSettings.h"
#include "dtkWidgetsStackBar.h"
#include "dtkWidgetsWidget.h"
#include "dtkWidgetsWorkspace.h"
#include "dtkWidgetsWorkspaceBar.h"
#include "dtkWidgetsWorkspaceStackBar.h"
#include "dtkWidgetsStackBar.h"
#include "dtkWidgetsWorkspaceStackBar.h"
#include "dtkWidgetsStackBar.h"
#include "dtkWidgetsWorkspaceStackBar.h"
// ///////////////////////////////////////////////////////////////////
//
// ///////////////////////////////////////////////////////////////////
class dtkWidgetsStackBarItem : public QFrame
class dtkWidgetsWorkspaceStackBarItem : public QFrame
{
Q_OBJECT
Q_PROPERTY(bool active READ active WRITE setActive NOTIFY activeChanged)
public:
dtkWidgetsStackBarItem(int index, QWidget *parent = nullptr);
~dtkWidgetsStackBarItem(void);
dtkWidgetsWorkspaceStackBarItem(int index, QWidget *parent = nullptr);
~dtkWidgetsWorkspaceStackBarItem(void);
signals:
void clicked(int);
......@@ -50,7 +50,7 @@ private:
bool on = false;
};
dtkWidgetsStackBarItem::dtkWidgetsStackBarItem(int index, QWidget *parent) : QFrame(parent)
dtkWidgetsWorkspaceStackBarItem::dtkWidgetsWorkspaceStackBarItem(int index, QWidget *parent) : QFrame(parent)
{
this->index = index;
......@@ -68,12 +68,12 @@ dtkWidgetsStackBarItem::dtkWidgetsStackBarItem(int index, QWidget *parent) : QFr
layout->addStretch();
}
dtkWidgetsStackBarItem::~dtkWidgetsStackBarItem(void)
dtkWidgetsWorkspaceStackBarItem::~dtkWidgetsWorkspaceStackBarItem(void)
{
}
void dtkWidgetsStackBarItem::setSource(QWidget *source)
void dtkWidgetsWorkspaceStackBarItem::setSource(QWidget *source)
{
this->source = source;
......@@ -92,7 +92,7 @@ void dtkWidgetsStackBarItem::setSource(QWidget *source)
timer->start();
}
void dtkWidgetsStackBarItem::mousePressEvent(QMouseEvent *event)
void dtkWidgetsWorkspaceStackBarItem::mousePressEvent(QMouseEvent *event)
{
Q_UNUSED(event);
......@@ -103,13 +103,13 @@ void dtkWidgetsStackBarItem::mousePressEvent(QMouseEvent *event)
//
// ///////////////////////////////////////////////////////////////////
class dtkWidgetsStackBarPrivate
class dtkWidgetsWorkspaceStackBarPrivate
{
public:
QStackedWidget *stack = nullptr;
public:
QList<dtkWidgetsStackBarItem *> items;
QList<dtkWidgetsWorkspaceStackBarItem *> items;
public:
QVBoxLayout *layout;
......@@ -119,9 +119,9 @@ public:
//
// ///////////////////////////////////////////////////////////////////
dtkWidgetsStackBar::dtkWidgetsStackBar(QWidget *parent) : QFrame(parent)
dtkWidgetsWorkspaceStackBar::dtkWidgetsWorkspaceStackBar(QWidget *parent) : QFrame(parent)
{
d = new dtkWidgetsStackBarPrivate;
d = new dtkWidgetsWorkspaceStackBarPrivate;
d->layout = new QVBoxLayout(this);
d->layout->setContentsMargins(0, 0, 1, 0);
......@@ -130,17 +130,17 @@ dtkWidgetsStackBar::dtkWidgetsStackBar(QWidget *parent) : QFrame(parent)
this->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding);
}
dtkWidgetsStackBar::~dtkWidgetsStackBar(void)
dtkWidgetsWorkspaceStackBar::~dtkWidgetsWorkspaceStackBar(void)
{
delete d;
}
QSize dtkWidgetsStackBar::sizeHint(void) const
QSize dtkWidgetsWorkspaceStackBar::sizeHint(void) const
{
return QSize(300, 100);
}
void dtkWidgetsStackBar::setStack(QStackedWidget *stack)
void dtkWidgetsWorkspaceStackBar::setStack(QStackedWidget *stack)
{
d->stack = stack;
......@@ -149,13 +149,13 @@ void dtkWidgetsStackBar::setStack(QStackedWidget *stack)
for (int i = 0; i < d->stack->count(); i++) {
dtkWidgetsStackBarItem *item = new dtkWidgetsStackBarItem(i, this);
dtkWidgetsWorkspaceStackBarItem *item = new dtkWidgetsWorkspaceStackBarItem(i, this);
item->setSource(d->stack->widget(i));
connect(item, SIGNAL(clicked(int)), d->stack, SLOT(setCurrentIndex(int)));
connect(item, &dtkWidgetsStackBarItem::clicked, [=] (int) {
connect(item, &dtkWidgetsWorkspaceStackBarItem::clicked, [=] (int) {
foreach(dtkWidgetsStackBarItem *it, d->items) {
foreach(dtkWidgetsWorkspaceStackBarItem *it, d->items) {
this->style()->unpolish(it);
it->setActive(it == item);
this->style()->polish(it);
......@@ -171,7 +171,7 @@ void dtkWidgetsStackBar::setStack(QStackedWidget *stack)
// ///////////////////////////////////////////////////////////////////
#include "dtkWidgetsStackBar.moc"
#include "dtkWidgetsWorkspaceStackBar.moc"
//
// dtkWidgetsStackBar.cpp ends here
// dtkWidgetsWorkspaceStackBar.cpp ends here
......@@ -4,13 +4,13 @@
#include <QtWidgets>
class DTKWIDGETS_EXPORT dtkWidgetsStackBar : public QFrame
class DTKWIDGETS_EXPORT dtkWidgetsWorkspaceStackBar : public QFrame
{
Q_OBJECT
public:
dtkWidgetsStackBar(QWidget *parent = nullptr);
~dtkWidgetsStackBar(void);
dtkWidgetsWorkspaceStackBar(QWidget *parent = nullptr);
~dtkWidgetsWorkspaceStackBar(void);
public:
QSize sizeHint(void) const override;
......@@ -19,5 +19,5 @@ public:
void setStack(QStackedWidget *);
private:
class dtkWidgetsStackBarPrivate *d;
class dtkWidgetsWorkspaceStackBarPrivate *d;
};
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