/** * Sets the color shown in the combobox to the given color. */ void QG_ColorBox::setColor(const RS_Color& color) { currentColor = color; if (color.isByLayer() && showByLayer) { setCurrentItem(0); } else if (color.isByBlock() && showByLayer) { setCurrentItem(1); } else if (color==Qt::red) { setCurrentItem(0+(int)showByLayer*2 + (int)showUnchanged); } else if (color==Qt::yellow) { setCurrentItem(1+(int)showByLayer*2 + (int)showUnchanged); } else if (color==Qt::green) { setCurrentItem(2+(int)showByLayer*2 + (int)showUnchanged); } else if (color==Qt::cyan) { setCurrentItem(3+(int)showByLayer*2 + (int)showUnchanged); } else if (color==Qt::blue) { setCurrentItem(4+(int)showByLayer*2 + (int)showUnchanged); } else if (color==Qt::magenta) { setCurrentItem(5+(int)showByLayer*2 + (int)showUnchanged); } else if (color==Qt::white || color==Qt::black) { setCurrentItem(6+(int)showByLayer*2 + (int)showUnchanged); } else if (color==Qt::gray) { setCurrentItem(7+(int)showByLayer*2 + (int)showUnchanged); } else if (color==QColor(191,191,191)) { setCurrentItem(8+(int)showByLayer*2 + (int)showUnchanged); } else { setCurrentItem(9+(int)showByLayer*2 + (int)showUnchanged); } if (currentItem()!=9+(int)showByLayer*2 + (int)showUnchanged) { slotColorChanged(currentItem()); } }
BooleanLedWidgetView::BooleanLedWidgetView(CompView * cv, QWidget *parent, const char *name) : CompViewVBox(cv,parent,name) { m_led = new KLed(red, this); m_boolLed = (BooleanLed*)cv->getComponent(); slotColorChanged(); //Setup }
QWidget * BooleanLedView::createCompViewWidget(QWidget * parent) { BooleanLedWidgetView * wid = new BooleanLedWidgetView(this, parent,"Led"); KLed * led = wid->m_led; Q_CHECK_PTR(led); /* Specific signals */ // LED state changed (Component->Widget) connect(this, SIGNAL(signalState(bool)), wid, SLOT(slotState(bool))); // Color changed (Component->CompViewWidget) connect(getComponent(), SIGNAL(signalColorChanged()), wid, SLOT(slotColorChanged())); return wid; }
/** * Sets the color of the pixmap next to the "By Layer" item * to the given color. */ void QG_ColorBox::setLayerColor(const RS_Color& color) { if (showByLayer) { QPixmap pixmap; if (color==Qt::black || color==Qt::white) { pixmap = color07_xpm; } else { pixmap = color00_xpm; int w = pixmap.width(); int h = pixmap.height(); QPainter painter(&pixmap); painter.fillRect(1, 1, w-2, h-2, color); painter.end(); } changeItem(pixmap, tr("By Layer"), 0); // needed for the first time a layer is added: if (currentItem()!=9) { slotColorChanged(currentItem()); } } }
/** * Initialisation (called from constructor or manually but only * once). * * @param showByLayer true: Show attribute ByLayer, ByBlock. */ void QG_ColorBox::init(bool showByLayer, bool showUnchanged) { this->showByLayer = showByLayer; this->showUnchanged = showUnchanged; if (showUnchanged) { insertItem(QPixmap(color00_xpm), tr("Unchanged")); } if (showByLayer) { insertItem(QPixmap(color00_xpm), tr("By Layer")); insertItem(QPixmap(color00_xpm), tr("By Block")); } insertItem(QPixmap(color01_xpm), tr("Red")); insertItem(QPixmap(color02_xpm), tr("Yellow")); insertItem(QPixmap(color03_xpm), tr("Green")); insertItem(QPixmap(color04_xpm), tr("Cyan")); insertItem(QPixmap(color05_xpm), tr("Blue")); insertItem(QPixmap(color06_xpm), tr("Magenta")); insertItem(QPixmap(color07_xpm), tr("Black / White")); insertItem(QPixmap(color08_xpm), tr("Gray")); insertItem(QPixmap(color09_xpm), tr("Light Gray")); //insertItem(QPixmap(color11_xpm), tr("11")); //insertItem(QPixmap(color14_xpm), tr("14")); insertItem(QPixmap(colorxx_xpm), tr("Others..")); connect(this, SIGNAL(activated(int)), this, SLOT(slotColorChanged(int))); if (showUnchanged) { setCurrentItem(0); } else if (showByLayer) { setCurrentItem(0); } else { setCurrentItem(6); } slotColorChanged(currentItem()); }
ContextManager::ContextManager(QQuickView *view, Doc *doc, FixtureManager *fxMgr, FunctionManager *funcMgr, QObject *parent) : QObject(parent) , m_view(view) , m_doc(doc) , m_fixtureManager(fxMgr) , m_functionManager(funcMgr) , m_universeFilter(Universe::invalid()) , m_prevRotation(0) , m_editingEnabled(false) { m_source = new GenericDMXSource(m_doc); m_source->setOutputEnabled(true); m_2DView = new MainView2D(m_view, m_doc); m_view->rootContext()->setContextProperty("View2D", m_2DView); m_DMXView = new MainViewDMX(m_view, m_doc); connect(m_fixtureManager, SIGNAL(newFixtureCreated(quint32,qreal,qreal)), this, SLOT(slotNewFixtureCreated(quint32,qreal,qreal))); connect(m_fixtureManager, SIGNAL(channelValueChanged(quint32,quint32,quint8)), this, SLOT(slotChannelValueChanged(quint32,quint32,quint8))); connect(m_fixtureManager, SIGNAL(channelTypeValueChanged(int,quint8)), this, SLOT(slotChannelTypeValueChanged(int,quint8))); connect(m_fixtureManager, SIGNAL(colorChanged(QColor,QColor)), this, SLOT(slotColorChanged(QColor,QColor))); connect(m_fixtureManager, SIGNAL(positionTypeValueChanged(int,int)), this, SLOT(slotPositionChanged(int,int))); connect(m_fixtureManager, SIGNAL(presetChanged(const QLCChannel*,quint8)), this, SLOT(slotPresetChanged(const QLCChannel*,quint8))); connect(m_doc->inputOutputMap(), SIGNAL(universesWritten(int, const QByteArray&)), this, SLOT(slotUniversesWritten(int, const QByteArray&))); connect(m_functionManager, SIGNAL(functionEditingChanged(bool)), this, SLOT(slotFunctionEditingChanged(bool))); }
void CHTMLWriteDisplay::setupToolbar(QToolBar * bar, BtActionCollection * actions) { //--------------------font chooser------------------------- m_fontFamilyChooser = new QFontComboBox(this); actions->addAction(CResMgr::displaywindows::writeWindow::fontFamily::actionName, m_fontFamilyChooser); m_fontFamilyChooser->setToolTip( tr("Font") ); bar->addWidget(m_fontFamilyChooser); bool ok = connect(m_fontFamilyChooser, SIGNAL(currentFontChanged(const QFont&)), this, SLOT(slotFontFamilyChoosen(const QFont&))); Q_ASSERT(ok); //--------------------font size chooser------------------------- m_fontSizeChooser = new BtFontSizeWidget(this); m_fontSizeChooser->setToolTip( tr("Font size") ); bar->addWidget(m_fontSizeChooser); ok = connect(m_fontSizeChooser, SIGNAL(fontSizeChanged(int)), this, SLOT(changeFontSize(int))); Q_ASSERT(ok); //--------------------color button------------------------- m_colorChooser = new BtColorWidget(); m_colorChooser->setToolTip(tr("Font color")); bar->addWidget(m_colorChooser); ok = connect(m_colorChooser, SIGNAL(changed(const QColor&)), this, SLOT(slotColorSelected(const QColor&))); Q_ASSERT(ok); bar->addSeparator(); //--------------------bold toggle------------------------- m_actions.bold = new QAction( util::filesystem::DirectoryUtil::getIcon(CResMgr::displaywindows::writeWindow::boldText::icon), tr("Bold"), actions); m_actions.bold->setCheckable(true); m_actions.bold->setShortcut(CResMgr::displaywindows::writeWindow::boldText::accel); actions->addAction(CResMgr::displaywindows::writeWindow::boldText::actionName, m_actions.bold); m_actions.bold->setToolTip( tr("Bold") ); connect(m_actions.bold, SIGNAL(toggled(bool)), this, SLOT(toggleBold(bool))); bar->addAction(m_actions.bold); //--------------------italic toggle------------------------- m_actions.italic = new QAction( util::filesystem::DirectoryUtil::getIcon(CResMgr::displaywindows::writeWindow::italicText::icon), tr("Italic"), actions ); m_actions.italic->setCheckable(true); m_actions.bold->setShortcut(CResMgr::displaywindows::writeWindow::italicText::accel); actions->addAction(CResMgr::displaywindows::writeWindow::italicText::actionName, m_actions.italic); connect(m_actions.italic, SIGNAL(toggled(bool)), this, SLOT(toggleItalic(bool))); m_actions.italic->setToolTip( tr("Italic") ); bar->addAction(m_actions.italic); //--------------------underline toggle------------------------- m_actions.underline = new QAction( util::filesystem::DirectoryUtil::getIcon(CResMgr::displaywindows::writeWindow::underlinedText::icon), tr("Underline"), actions ); m_actions.underline->setCheckable(true); m_actions.underline->setShortcut(CResMgr::displaywindows::writeWindow::underlinedText::accel); actions->addAction(CResMgr::displaywindows::writeWindow::underlinedText::actionName, m_actions.underline); connect(m_actions.underline, SIGNAL(toggled(bool)), this, SLOT(toggleUnderline(bool))); m_actions.underline->setToolTip( tr("Underline") ); bar->addAction(m_actions.underline); //seperate formatting from alignment buttons bar->addSeparator(); //--------------------align left toggle------------------------- m_actions.alignLeft = new QAction( util::filesystem::DirectoryUtil::getIcon(CResMgr::displaywindows::writeWindow::alignLeft::icon), tr("Left"), actions); m_actions.alignLeft->setCheckable(true); m_actions.alignLeft->setShortcut(CResMgr::displaywindows::writeWindow::alignLeft::accel); actions->addAction(CResMgr::displaywindows::writeWindow::alignLeft::actionName, m_actions.alignLeft); connect(m_actions.alignLeft, SIGNAL(toggled(bool)), this, SLOT(alignLeft(bool))); m_actions.alignLeft->setToolTip( tr("Align left") ); bar->addAction(m_actions.alignLeft); //--------------------align center toggle------------------------- m_actions.alignCenter = new QAction( util::filesystem::DirectoryUtil::getIcon(CResMgr::displaywindows::writeWindow::alignCenter::icon), tr("Center"), actions); m_actions.alignCenter->setCheckable(true); m_actions.alignCenter->setShortcut(CResMgr::displaywindows::writeWindow::alignCenter::accel); actions->addAction(CResMgr::displaywindows::writeWindow::alignCenter::actionName, m_actions.alignCenter); connect(m_actions.alignCenter, SIGNAL(toggled(bool)), this, SLOT(alignCenter(bool))); m_actions.alignCenter->setToolTip( tr("Center") ); bar->addAction(m_actions.alignCenter); //--------------------align right toggle------------------------- m_actions.alignRight = new QAction( util::filesystem::DirectoryUtil::getIcon(CResMgr::displaywindows::writeWindow::alignRight::icon), tr("Right"), actions); m_actions.alignRight->setCheckable(true); m_actions.alignRight->setShortcut(CResMgr::displaywindows::writeWindow::alignRight::accel); actions->addAction(CResMgr::displaywindows::writeWindow::alignRight::actionName, m_actions.alignRight); connect(m_actions.alignRight, SIGNAL(toggled(bool)), this, SLOT(alignRight(bool))); m_actions.alignRight->setToolTip( tr("Align right") ); bar->addAction(m_actions.alignRight); connect(this, SIGNAL(currentFontChanged(const QFont&)), SLOT(slotFontChanged(const QFont&))); connect(this, SIGNAL(currentAlignmentChanged(int)), SLOT(slotAlignmentChanged(int))); connect(this, SIGNAL(currentColorChanged(const QColor&)), SLOT(slotColorChanged(const QColor&))); //set initial values for toolbar items slotFontChanged( font() ); slotAlignmentChanged( alignment() ); slotColorChanged( textColor() ); }