Ejemplo n.º 1
0
QWidget * TextBoxContent::createPropertyWidget()
{
	TextProperties * p = new TextProperties();

	// common properties
	connect(p->bFront, SIGNAL(clicked()), this, SLOT(slotStackFront()));
	connect(p->bRaise, SIGNAL(clicked()), this, SLOT(slotStackRaise()));
	connect(p->bLower, SIGNAL(clicked()), this, SLOT(slotStackLower()));
	connect(p->bBack, SIGNAL(clicked()), this, SLOT(slotStackBack()));
	connect(p->bDel, SIGNAL(clicked()), this, SIGNAL(deleteItem()), Qt::QueuedConnection);


	return p;
}
Ejemplo n.º 2
0
QWidget * AbstractContent::createPropertyWidget(ContentProperties * __p)
{
    ContentProperties * cp = __p ? __p : new ContentProperties;

    // connect actions
    connect(cp->cFront, SIGNAL(clicked()), this, SLOT(slotStackFront()));
    connect(cp->cRaise, SIGNAL(clicked()), this, SLOT(slotStackRaise()));
    connect(cp->cLower, SIGNAL(clicked()), this, SLOT(slotStackLower()));
    connect(cp->cBack, SIGNAL(clicked()), this, SLOT(slotStackBack()));
    connect(cp->cConfigure, SIGNAL(clicked()), this, SLOT(slotConfigure()));

    // properties link
    new PE_AbstractSlider(cp->cOpacity, this, "contentOpacity", cp);
    new PE_Combo(cp->cFxCombo, this, "fxIndex", cp);
    cp->cPerspWidget->setRange(QRectF(-70.0, -70.0, 140.0, 140.0));
    new PE_PaneWidget(cp->cPerspWidget, this, "perspective", cp);

    return cp;
}
Ejemplo n.º 3
0
AbstractConfig::AbstractConfig(AbstractContent * content, AbstractConfig_PARENT * parent)
    : AbstractConfig_TYPE(parent)
    , m_content(content)
    , m_commonUi(new Ui::AbstractConfig())
#if !defined(MOBILE_UI)
    , m_closeButton(0)
    , m_okButton(0)
#endif
    , m_frame(FrameFactory::defaultPanelFrame())
{
#if !defined(MOBILE_UI)
    // close button
    m_closeButton = new StyledButtonItem(tr(" x "), font(), this);//this, ":/data/button-close.png", ":/data/button-close-hovered.png", ":/data/button-close-pressed.png");
    connect(m_closeButton, SIGNAL(clicked()), this, SIGNAL(requestClose()));

    // WIDGET setup (populate contents and set base palette (only) to transparent)
    QWidget * widget = new QWidget();
    m_commonUi->setupUi(widget);
    QPalette pal;
    QColor oldColor = pal.window().color();
    pal.setBrush(QPalette::Window, Qt::transparent);
    widget->setPalette(pal);
    pal.setBrush(QPalette::Window, oldColor);
    m_commonUi->tab->setPalette(pal);
#else
    m_commonUi->setupUi(this);
#endif

    populateFrameList();

    // select the frame
    quint32 frameClass = m_content->frameClass();
    if (frameClass != Frame::NoFrame) {
        for (int i = 0; i < m_commonUi->framesList->count(); ++i) {
            QListWidgetItem * item = m_commonUi->framesList->item(i);
            if (item->data(Qt::UserRole).toUInt() == frameClass) {
                item->setSelected(true);
                break;
            }
        }
    }

    // read other properties
    m_commonUi->reflection->setChecked(m_content->mirrored());
    m_commonUi->contentLocked->setChecked(m_content->locked());
    m_commonUi->fixedPosition->setChecked(m_content->fixedPosition());
    m_commonUi->fixedRotation->setChecked(m_content->fixedRotation());
    m_commonUi->fixedPerspective->setChecked(m_content->fixedPerspective());

    connect(m_commonUi->front, SIGNAL(clicked()), m_content, SLOT(slotStackFront()));
    connect(m_commonUi->raise, SIGNAL(clicked()), m_content, SLOT(slotStackRaise()));
    connect(m_commonUi->lower, SIGNAL(clicked()), m_content, SLOT(slotStackLower()));
    connect(m_commonUi->back, SIGNAL(clicked()), m_content, SLOT(slotStackBack()));
    connect(m_commonUi->save, SIGNAL(clicked()), m_content, SLOT(slotSaveAs()));
    connect(m_commonUi->background, SIGNAL(clicked()), m_content, SIGNAL(requestBackgrounding()));
    connect(m_commonUi->del, SIGNAL(clicked()), m_content, SIGNAL(requestRemoval()));

    connect(m_commonUi->contentLocked, SIGNAL(stateChanged(int)), m_content, SLOT(slotSetLocked(int)));
    connect(m_commonUi->fixedPosition, SIGNAL(stateChanged(int)), m_content, SLOT(slotSetFixedPosition(int)));
    connect(m_commonUi->fixedRotation, SIGNAL(stateChanged(int)), m_content, SLOT(slotSetFixedRotation(int)));
    connect(m_commonUi->fixedPerspective, SIGNAL(stateChanged(int)), m_content, SLOT(slotSetFixedPerspective(int)));

    connect(m_commonUi->newFrame, SIGNAL(clicked()), this, SLOT(slotAddFrame()));
    connect(m_commonUi->removeFrame, SIGNAL(clicked()), this, SLOT(slotRemoveFrame()));
    connect(m_commonUi->lookApplyAll, SIGNAL(clicked()), this, SLOT(slotLookApplyAll()));
    connect(m_commonUi->framesList, SIGNAL(itemSelectionChanged()), this, SLOT(slotFrameSelectionChanged()));
    connect(m_commonUi->reflection, SIGNAL(toggled(bool)), this, SLOT(slotReflectionToggled(bool)));

    // ITEM setup
#if !defined(MOBILE_UI)
    setFlag(QGraphicsItem::ItemIgnoresTransformations, true);
    setWidget(widget);
    static qreal s_propZBase = 99999;
    setZValue(s_propZBase++);
#endif

#if !defined(MOBILE_UI) && QT_VERSION >= 0x040600
    // fade in animation
    QPropertyAnimation * ani = new QPropertyAnimation(this, "opacity");
    ani->setEasingCurve(QEasingCurve::OutCubic);
    ani->setDuration(400);
    ani->setStartValue(0.0);
    ani->setEndValue(1.0);
    ani->start(QPropertyAnimation::DeleteWhenStopped);
#endif
}
Ejemplo n.º 4
0
AbstractConfig::AbstractConfig(AbstractContent * content, QWidget * parent)
    : QDialog(parent)
    , m_content(content)
    , m_commonUi(new Ui::AbstractConfig())
    , m_closeButton(0)
    , m_okButton(0)
    , m_frame(FrameFactory::defaultPanelFrame())
{
   

	// WIDGET setup
	QWidget * widget = new QWidget(this);
// 	#if QT_VERSION < 0x040500
// 	widget->setAttribute(Qt::WA_NoSystemBackground, true);
// 	#else
// 	widget->setAttribute(Qt::WA_TranslucentBackground, true);
// 	#endif
	m_commonUi->setupUi(widget);
	
	populateFrameList();
	
	// select the frame
	quint32 frameClass = m_content->frameClass();
	if (frameClass != Frame::NoFrame) {
		for (int i = 0; i < m_commonUi->listWidget->count(); ++i) {
		QListWidgetItem * item = m_commonUi->listWidget->item(i);
		if (item->data(Qt::UserRole).toUInt() == frameClass) {
			item->setSelected(true);
			break;
		}
		}
	}
	
	// read other properties
	m_commonUi->reflection->setChecked(m_content->mirrorEnabled());
	
	connect(m_commonUi->front, SIGNAL(clicked()), m_content, SLOT(slotStackFront()));
	connect(m_commonUi->raise, SIGNAL(clicked()), m_content, SLOT(slotStackRaise()));
	connect(m_commonUi->lower, SIGNAL(clicked()), m_content, SLOT(slotStackLower()));
	connect(m_commonUi->back, SIGNAL(clicked()), m_content, SLOT(slotStackBack()));
	connect(m_commonUi->background, SIGNAL(clicked()), m_content, SIGNAL(backgroundMe()));
	connect(m_commonUi->save, SIGNAL(clicked()), m_content, SLOT(slotSaveAs()));
	connect(m_commonUi->del, SIGNAL(clicked()), m_content, SIGNAL(deleteItem()), Qt::QueuedConnection);
	// autoconnection doesn't work because we don't do ->setupUi(this), so here we connect manually
	connect(m_commonUi->applyLooks, SIGNAL(clicked()), this, SLOT(on_applyLooks_clicked()));
	connect(m_commonUi->newFrame, SIGNAL(clicked()), this, SLOT(on_newFrame_clicked()));
	connect(m_commonUi->listWidget, SIGNAL(itemSelectionChanged()), this, SLOT(on_listWidget_itemSelectionChanged()));
	connect(m_commonUi->reflection, SIGNAL(toggled(bool)), this, SLOT(on_reflection_toggled(bool)));

//     // ITEM setup
//     setWidget(widget);
//     static qreal s_propZBase = 99999;
//     setZValue(s_propZBase++);

	QBoxLayout *layout = new QVBoxLayout;
	layout->addWidget(widget);
// 	layout->addWidget(rotateSlider);
// 	layout->addLayout(controlLayout);
	
	m_okButton = new QPushButton(tr("Ok"));
	m_okButton->setDefault(true);
	connect(m_okButton, SIGNAL(clicked()), this, SLOT(slotOkClicked()));
	
	m_closeButton = new QPushButton(tr("Cancel"));
	connect(m_closeButton, SIGNAL(clicked()), this, SLOT(reject()));
	
	setWindowTitle("Item Settings");
	
	QBoxLayout *controlLayout = new QHBoxLayout;
	controlLayout->addStretch(1);
	controlLayout->addWidget(m_closeButton);
	controlLayout->addWidget(m_okButton);
	layout->addLayout(controlLayout);
	
	
	
	setLayout(layout);
/*
#if QT_VERSION >= 0x040600
    // fade in animation
    QPropertyAnimation * ani = new QPropertyAnimation(this, "opacity");
    ani->setEasingCurve(QEasingCurve::OutCubic);
    ani->setDuration(400);
    ani->setStartValue(0.0);
    ani->setEndValue(1.0);
    ani->start(QPropertyAnimation::DeleteWhenStopped);
#endif*/
}