void ColorInspector::onModeChanged() { bool newValue = ui->rgb->isChecked(); if (isRgbColors == newValue) { return; } isRgbColors = newValue; noColorUpdate = true; if (!isRgbColors) { ui->red->setText(tr("Hue")); ui->green->setText(tr("Saturation")); ui->blue->setText(tr("Value")); ui->alpha->setText(tr("Alpha")); ui->RedspinBox->setRange(0,359); ui->GreenspinBox->setRange(0,100); ui->GreenspinBox->setSuffix("%"); ui->BluespinBox->setRange(0,100); ui->BluespinBox->setSuffix("%"); ui->AlphaspinBox->setRange(0,100); ui->AlphaspinBox->setSuffix("%"); m_color = m_color.toHsv(); ui->RedspinBox->setValue( qBound(0.0, m_color.hsvHueF()*359, 359.0) ); ui->GreenspinBox->setValue( qBound(0.0, m_color.hsvSaturationF()*100, 100.0) ); ui->BluespinBox->setValue( qBound(0.0, m_color.valueF()*100, 100.0) ); ui->AlphaspinBox->setValue( qBound(0.0, m_color.alphaF()*100, 100.0) ); } else { ui->red->setText(tr("Red")); ui->green->setText(tr("Green")); ui->blue->setText(tr("Blue")); ui->alpha->setText(tr("Alpha")); ui->RedspinBox->setRange(0,255); ui->GreenspinBox->setRange(0,255); ui->GreenspinBox->setSuffix(""); ui->BluespinBox->setRange(0,255); ui->BluespinBox->setSuffix(""); ui->AlphaspinBox->setRange(0,255); ui->AlphaspinBox->setSuffix(""); m_color = m_color.toRgb(); ui->RedspinBox->setValue(m_color.red()); ui->GreenspinBox->setValue(m_color.green()); ui->BluespinBox->setValue(m_color.blue()); ui->AlphaspinBox->setValue(m_color.alpha()); } noColorUpdate = false; emit modeChange(isRgbColors); }
GS_CHANGE_MODE() { mem_req_t memReq; memReq.rw = WRITE; memReq.size = WORD; memReq.addr = modeAddress(Input.pageId) memReq.data = modeChange(memRep.data, Input.pageId) memRep = mem(memReq); rank = Input.rankUpdate; State = GS_WRITE_RANK; }
void App::initVirtualConsole(void) { m_virtualConsole = new VirtualConsole(workspace()); m_virtualConsole->initView(); m_virtualConsole->resize(400, 400); m_virtualConsole->hide(); connect(m_virtualConsole, SIGNAL(closed()), this, SLOT(slotVirtualConsoleClosed())); connect(m_virtualConsole, SIGNAL(modeChange(VirtualConsole::Mode)), this, SLOT(slotSetModeIndicator(VirtualConsole::Mode))); }
void DeviceManagerView::initView() { setCaption(QString("Device Manager")); resize(300, 200); QString dir; _app->settings()->get(KEY_SYSTEM_DIR, dir); dir += QString("/") + PIXMAPPATH; setIcon(dir + QString("/device.xpm")); m_layout = new QVBoxLayout(this); m_dockArea = new QDockArea(Horizontal, QDockArea::Normal, this); m_dockArea->setFixedHeight(30); m_toolbar = new QToolBar("Device Manager", _app, m_dockArea); m_dm = new DeviceManager(this); m_addOutputDeviceButton = new QToolButton(QIconSet(QPixmap(dir + "/addoutputdevice.xpm")), "Add New Output Device", 0, m_dm, SLOT(slotDLAddOutputDevice()), m_toolbar); m_addBusButton = new QToolButton(QIconSet(QPixmap(dir + "/addbus.xpm")), "Add New Bus", 0, m_dm, SLOT(slotDLAddBus()), m_toolbar); m_removeButton = new QToolButton(QIconSet(QPixmap(dir + "/remove.xpm")), "Remove Current Selection", 0, m_dm, SLOT(slotDLRemove()), m_toolbar); m_toolbar->addSeparator(); m_propertiesButton = new QToolButton(QIconSet(QPixmap(dir + "/settings.xpm")), "Properties", 0, m_dm, SLOT(slotDLViewProperties()), m_toolbar); m_toolbar->addSeparator(); m_monitorButton = new QToolButton(QIconSet(QPixmap(dir + "/monitor.xpm")), "Monitor Device", 0, m_dm, SLOT(slotDLViewMonitor()), m_toolbar); m_consoleButton = new QToolButton(QIconSet(QPixmap(dir + "/console.xpm")), "View Console", 0, m_dm, SLOT(slotDLViewConsole()), m_toolbar); m_layout->addWidget(m_dockArea); m_layout->addWidget(m_dm); connect(_app->virtualConsole(), SIGNAL(modeChange(VirtualConsole::Mode)), this, SLOT(slotModeChanged(VirtualConsole::Mode))); connect(m_dm, SIGNAL(selectionChanged()), this, SLOT(slotSelectionChanged())); slotSelectionChanged(); }
void ColorSpinBoxGroup::onModeChanged() { bool newValue = ui->rgb->isChecked(); if(isRgbColors == newValue) return; isRgbColors = newValue; noColorUpdate = true; if(!isRgbColors){ ui->red->setText(tr("Hue")); ui->green->setText(tr("Saturation")); ui->blue->setText(tr("Value")); ui->RedspinBox->setRange(0,359); ui->GreenspinBox->setRange(0,100); ui->GreenspinBox->setSuffix("%"); ui->BluespinBox->setRange(0,100); ui->BluespinBox->setSuffix("%"); color_ = color_.toHsv(); ui->RedspinBox->setValue( qBound(0.0, color_.hsvHueF()*359, 359.0) ); ui->GreenspinBox->setValue( qBound(0.0, color_.hsvSaturationF()*100, 100.0) ); ui->BluespinBox->setValue( qBound(0.0, color_.valueF()*100, 100.0) ); }else{ ui->red->setText(tr("Red")); ui->green->setText(tr("Green")); ui->blue->setText(tr("Blue")); ui->RedspinBox->setRange(0,255); ui->GreenspinBox->setRange(0,255); ui->GreenspinBox->setSuffix(""); ui->BluespinBox->setRange(0,255); ui->BluespinBox->setSuffix(""); color_ = color_.toRgb(); ui->RedspinBox->setValue(color_.red()); ui->GreenspinBox->setValue(color_.green()); ui->BluespinBox->setValue(color_.blue()); } noColorUpdate = false; emit modeChange(isRgbColors); }
void Irc::parse(QString raw) { if (raw.startsWith(':')) raw = raw.right(raw.length() - 1); #ifdef COLOR_WIPE QString xraw; int len = 0; int olen = raw.length(); // dirty but useful color removal code do { do { if ( raw [len] == '\003' ) { // color, veo muuucho color len += 2; if ( raw [len].isNumber() ) len++; if ( raw [len] == ',' && raw [len+1].isDigit() ) { // color, veo aúuuun más color len += 2; if ( raw [len].isNumber() ) len++; } } else if ( raw [len] == '\002' || raw [len] == '\026' || raw [len] == '\035' ) // blablalba len++; } while ( raw [len] == '\003' || raw [len] == '\002'|| raw [len] == '\026'|| raw [len] == '\035' ); // esto es una guarrada pero evita varios control codes consecutivos xraw.append(raw[len]); len++; } while( len < olen ); raw = xraw; #endif QStringList matrix = raw.split(' '); if( matrix[0] == "PING" ) { // Recibido ping, pongoneamos. sendData("PONG " + matrix[1]); emit PingPong(); } else if ( matrix[0] == "ERROR" ) { // error de conexion, whichever emit connError(raw.right(raw.length() - 7)); //quita el "ERROR :" del principio y deja el msj limpio } else if ( matrix[1] == "PRIVMSG" || matrix[1] == "NOTICE" ) { QString nick = matrix[0].left(matrix[0].indexOf('!')); QString message = raw.right((raw.length() - 2) - raw.indexOf(" :")); QString mask = matrix[0].mid(matrix[0].indexOf('!') + 1,(matrix[0].indexOf(" PRIVMSG") - nick.length())); if ( matrix[1] == "PRIVMSG" ) { if ( matrix[2].startsWith("#") ) { // mensaje de canal if ( message.startsWith("\001") ) // /ctcp if ( message.startsWith("\001ACTION ")) // me emit chanme ( nick, mask, matrix[2], message.right((message.length() - 8)) ); else emit chanctcp ( nick, mask, matrix[2], message.right((message.length() - 1)) ); else emit chanmsg ( nick, mask, matrix[2], message ); } else { // mensaje en privado if ( message.startsWith("\001") ) // /me if ( message.startsWith("\001ACTION ")) // me emit queryme ( nick, mask, message.right((message.length() - 8)) ); else emit queryctcp ( nick, mask, message.right((message.length() - 1)) ); else emit querymsg ( nick, mask, message ); } } else if ( matrix[1] == "NOTICE" ) { if ( matrix[2].startsWith("#") ) { // notice en canal emit channotice ( nick, mask, matrix[2], message ); } else { // notice en privado emit querynotice ( nick, mask, message ); } } } else if ( matrix[1] == "JOIN" ) { //join a un canal QString nick = matrix[0].left(matrix[0].indexOf('!')); QString mask = matrix[0].mid(matrix[0].indexOf('!') + 1,(matrix[0].indexOf(" JOIN") - nick.length())); if( matrix[2].startsWith(':') ) emit join(nick,mask,matrix[2].right( matrix[2].length() -1 )); else emit join(nick,mask,matrix[2]); } else if ( matrix[1] == "PART" || matrix[1] == "QUIT" ) { //handled together QString message = "", chan = ""; if (raw.indexOf(" :") != -1) message = raw.right((raw.length() - 2) - raw.indexOf(" :")); QString nick = matrix[0].left(matrix[0].indexOf('!')); QString mask = matrix[0].mid(matrix[0].indexOf('!') + 1,(matrix[0].indexOf(" PART") - nick.length())); if ( matrix[1] == "PART" ) { QString chan = raw.right((raw.length() - 1) - raw.indexOf(" #")); chan = chan.left(chan.indexOf(" :")); QString mask = matrix[0].mid(matrix[0].indexOf('!') + 1,(matrix[0].indexOf(" PART") - nick.length())); emit part(nick,mask,chan,message); } else if ( matrix[1] == "QUIT" ) { QString mask = matrix[0].mid(matrix[0].indexOf('!') + 1,(matrix[0].indexOf(" QUIT") - nick.length())); emit quit(nick,mask,message); } } else if ( matrix[1] == "NICK" ) { QString nick = matrix[0].left(matrix[0].indexOf('!')); QString mask = matrix[0].mid(matrix[0].indexOf('!') + 1,(matrix[0].indexOf(" NICK") - nick.length())); QString newnick = raw.right((raw.length() - 2) - raw.indexOf(" :")); if (newnick == ownNick) emit ownNickChange(newnick); emit nickChange(nick,mask,newnick); } else if ( matrix[1] == "MODE" ) { // cambio de modo, pero no sé si es de usuario o canal. if ( matrix[2].startsWith('#') ) { // c mode QString nick = matrix[0].left(matrix[0].indexOf('!')); QString mask = matrix[0].mid(matrix[0].indexOf('!') + 1,(matrix[0].indexOf(" MODE") - nick.length())); QString chan = matrix[2]; QString mode = raw.right((raw.length() - raw.indexOf(" #")) - chan.length() - 2); emit modeChange(nick,mask,chan,mode); } else { // u mode if( matrix[3].startsWith(':') ) emit umodeChange(matrix[0],matrix[2],matrix[3].right( matrix[3].length() -1 )); else emit umodeChange(matrix[0],matrix[2],matrix[3]); } } else if ( matrix[1] == "KICK" ) { // expulsión del canal if ( matrix[2].startsWith('#') ) { // c mode QString nick = matrix[0].left(matrix[0].indexOf('!')); QString mask = matrix[0].mid(matrix[0].indexOf('!') + 1,(matrix[0].indexOf(" KICK") - nick.length())); QString chan = matrix[2]; QString kicked = matrix[3]; QString message; if (raw.indexOf(" :") != -1) message = raw.right((raw.length() - 2) - raw.indexOf(" :")); emit kick(nick,mask,chan,kicked,message); } else // u mode emit umodeChange(matrix[0],matrix[2],raw.right((raw.length() - 2) - raw.indexOf(" :"))); } bool isInt; int code_msg = matrix[1].toInt( &isInt ); if( isInt ) { switch ( code_msg ) { case 001: // me es útil, así sé con qué nick entro xD emit ownNickChange(matrix[2]); ownNick = matrix[2]; if (!chans.isEmpty()) { sendData("JOIN ",true); sendData(chans); } status = STATUS_IDLE; emit signedIn(); break; case 254: // número de canales formados emit totalChans(matrix[3]); case 321: // chanlist begin handleChanlist(false); break; case 322: // chanlist handleChanlist(matrix[3],matrix[4],raw.right((raw.length() - 2) - raw.indexOf(" :"))); break; case 323: // chanlist end handleChanlist(true); break; case 332: //topic emit topic(matrix[3],raw.right((raw.length() - 2) - raw.indexOf(" :"))); break; case 333: //topic timestamp emit topicTime(matrix[3],matrix[4],matrix[5]); break; case 353: // names emit names(matrix[4], raw.right((raw.length() - 2) - raw.indexOf(" :"))); break; case 366: // fin de /names emit namesEnd(matrix[3]); break; case 372: // texto de motd emit motd( raw.right((raw.length() - 2) - raw.indexOf(" :"))); break; case 375: // inicio de motd emit motdStart( raw.right((raw.length() - 2) - raw.indexOf(" :"))); break; case 376: // fin de motd emit motdEnd( raw.right((raw.length() - 2) - raw.indexOf(" :"))); break; case 433: // nick en uso! getNewRandomNick(); break; case 471: qDebug() << matrix[3] << "Cannot join channel (+l)"; break; case 473: qDebug() << matrix[3] << "Cannot join channel (+i)"; break; case 474: qDebug() << matrix[3] << "Cannot join channel (+b)"; break; case 475: qDebug() << matrix[3] << "Cannot join channel (+k)"; break; default: //qDebug() << "Numeric NO MANEJADO!" << matrix[1] << endl; break; } } }
void ColorInspector::onModeChanged() { // assume hsv if not checked bool newValue = ui->rgbButton->isChecked(); QSettings settings(PENCIL2D, PENCIL2D); settings.setValue("isRgb", newValue); isRgbColors = newValue; if (isRgbColors) { // Spinboxes may emit unwanted valueChanged signals when setting ranges // so block them all first QSignalBlocker b1(ui->RedspinBox); QSignalBlocker b2(ui->GreenspinBox); QSignalBlocker b3(ui->BluespinBox); QSignalBlocker b4(ui->AlphaspinBox); ui->red->setText("R"); ui->green->setText("G"); ui->blue->setText("B"); ui->alpha->setText("A"); ui->RedspinBox->setRange(0,255); ui->RedspinBox->setSuffix(""); ui->GreenspinBox->setRange(0,255); ui->GreenspinBox->setSuffix(""); ui->BluespinBox->setRange(0,255); ui->BluespinBox->setSuffix(""); ui->AlphaspinBox->setRange(0,255); ui->AlphaspinBox->setSuffix(""); mCurrentColor = mCurrentColor.toRgb(); ui->red_slider->setMax(255); ui->red_slider->setColorType(ColorSlider::ColorType::RED); ui->red_slider->setColorSpecType(ColorSlider::ColorSpecType::RGB); ui->green_slider->setColorSpecType(ColorSlider::ColorSpecType::RGB); ui->green_slider->setColorType(ColorSlider::ColorType::GREEN); ui->blue_slider->setColorSpecType(ColorSlider::ColorSpecType::RGB); ui->blue_slider->setColorType(ColorSlider::ColorType::BLUE); ui->alpha_slider->setColorSpecType(ColorSlider::ColorSpecType::RGB); ui->alpha_slider->setColorType(ColorSlider::ColorType::ALPHA); ui->RedspinBox->setValue(mCurrentColor.red()); ui->GreenspinBox->setValue(mCurrentColor.green()); ui->BluespinBox->setValue(mCurrentColor.blue()); ui->AlphaspinBox->setValue(mCurrentColor.alpha()); } else { QSignalBlocker b1(ui->RedspinBox); QSignalBlocker b2(ui->GreenspinBox); QSignalBlocker b3(ui->BluespinBox); QSignalBlocker b4(ui->AlphaspinBox); ui->red->setText("H"); ui->green->setText("S"); ui->blue->setText("V"); ui->alpha->setText("A"); ui->red_slider->setMax(359); ui->red_slider->setColorType(ColorSlider::ColorType::HUE); ui->red_slider->setColorSpecType(ColorSlider::ColorSpecType::HSV); ui->green_slider->setColorType(ColorSlider::ColorType::SAT); ui->green_slider->setColorSpecType(ColorSlider::ColorSpecType::HSV); ui->blue_slider->setColorType(ColorSlider::ColorType::VAL); ui->blue_slider->setColorSpecType(ColorSlider::ColorSpecType::HSV); ui->alpha_slider->setColorType(ColorSlider::ColorType::ALPHA); ui->alpha_slider->setColorSpecType(ColorSlider::ColorSpecType::HSV); ui->RedspinBox->setRange(0,359); ui->RedspinBox->setSuffix("°"); ui->GreenspinBox->setRange(0,100); ui->GreenspinBox->setSuffix("%"); ui->BluespinBox->setRange(0,100); ui->BluespinBox->setSuffix("%"); ui->AlphaspinBox->setRange(0,100); ui->AlphaspinBox->setSuffix("%"); mCurrentColor = mCurrentColor.toHsv(); const qreal bound = 100.0 / 255.0; // from 255 to 100 ui->RedspinBox->setValue(mCurrentColor.hsvHue()); ui->GreenspinBox->setValue(qRound(mCurrentColor.hsvSaturation()*bound)); ui->BluespinBox->setValue(qRound(mCurrentColor.value()*bound)); ui->AlphaspinBox->setValue(qRound(mCurrentColor.alpha()*bound)); } emit modeChange(isRgbColors); }