CustomWidgetEditor::CustomWidgetEditor( QWidget *parent, MainWindow *mw )
    : CustomWidgetEditorBase( parent, 0, TRUE ), mainWindow( mw )
{
    connect( helpButton, SIGNAL( clicked() ), MainWindow::self, SLOT( showDialogHelp() ) );
    checkTimer = new QTimer( this );
    connect( checkTimer, SIGNAL( timeout() ),
	     this, SLOT( checkWidgetName() ) );

    editClass->setEnabled( FALSE );
    editHeader->setEnabled( FALSE );
    buttonChooseHeader->setEnabled( FALSE );
    buttonChoosePixmap->setEnabled( FALSE );
    spinWidth->setEnabled( FALSE );
    spinHeight->setEnabled( FALSE );
    sizeHor->setEnabled( FALSE );
    sizeVer->setEnabled( FALSE );
    checkContainer->setEnabled( FALSE );
    localGlobalCombo->setEnabled( FALSE );
    editClass->setValidator( new AsciiValidator( QString(":"), editClass ) );
    editSignal->setValidator( new AsciiValidator( TRUE, editSignal ) );
    editSlot->setValidator( new AsciiValidator( TRUE, editSignal ) );
    editProperty->setValidator( new AsciiValidator( editSignal ) );
    editSignal->setEnabled( FALSE );
    buttonRemoveSignal->setEnabled( FALSE );

    setupDefinition();
    setupSignals();
    setupSlots();
    setupProperties();
}
void CustomWidgetEditor::loadDescription()
{
    QString fn = KFileDialog::getOpenFileName( QString::null, i18n( "*.cw|Custom-Widget Description\n*|All Files" ), this );
    if ( fn.isEmpty() )
	return;

    QFile f( fn );
    if ( !f.open( IO_ReadOnly ) )
	return;

    QDomDocument doc;
    QString errMsg;
    int errLine;
    if ( !doc.setContent( &f, &errMsg, &errLine ) ) {
	qDebug( QString("Parse error: ") + errMsg + QString(" in line %d"), errLine );
	return;
    }

    QDomElement firstWidget = doc.firstChild().toElement().firstChild().toElement();

    while ( firstWidget.tagName() != "customwidgets" )
	firstWidget = firstWidget.nextSibling().toElement();

    Resource::loadCustomWidgets( firstWidget, 0 );
    boxWidgets->clear();
    setupDefinition();
    setupSignals();
    setupSlots();
    setupProperties();
}
Ejemplo n.º 3
0
void initRunMode() {
	#if ENABLE_SLOTS
		setupSlots();
	#endif
	
	mcu_clearTimer();
	
	//TODO: Figure out that dest = destorig shit
	dest = destorig;
	
	#if !(ENABLE_SLOTS)
		queryReplyCRC = crc16_ccitt(&queryReply[0],2);
		queryReply[3] = (unsigned char) queryReplyCRC;
		queryReply[2] = (unsigned char) mcu_swapBytes(queryReplyCRC);
	#endif

	#if SENSOR_DATA_IN_ID
		// this branch is for sensor data in the id
		ackReply[2] = SENSOR_DATA_TYPE_ID;
		state = STATE_READ_SENSOR;
		timeToSample++;
	#else
		ackReplyCRC = crc16_ccitt(&ackReply[0], 14);
		ackReply[15] = (unsigned char) ackReplyCRC;
		ackReply[14] = (unsigned char) mcu_swapBytes(ackReplyCRC);
	#endif
	
	#if ENABLE_SESSIONS
		initialize_sessions();
	#endif

	state = STATE_READY;
}
Ejemplo n.º 4
0
//////////////////////////////////////////////////////////////////////////
//	被VPProcessor的构造调用
//	下面所有的操作都是构造Processor所特有!
//////////////////////////////////////////////////////////////////////////
VPAbstractNode::VPAbstractNode( QMenu *contextMenu,
			   AProcess* proc,
			   unsigned int nbinput, unsigned int nboutput,
			   unsigned int id,
			   const QString& name )
			   : myInCount(nbinput), myOutCount(nboutput)
			   , myId(id)
			   , myProcess(proc)
{
	// 设置右键菜单!
	myContextMenu = contextMenu;

	// 设置名字!
	setText(name);

	// 设置字体!
	setFont( QFont("Verdana", 15, QFont::Normal) );

	// 设置默认的结点区域,在局部坐标系下!
	myRect.setRect(gNodeLeft, gNodeTop, gNodeWidth, gNodeHeight);
	
	// 调整结点区域/myRect!
	adjustRectByContent();

	// 装载端口!
	setupSlots();
}
Ejemplo n.º 5
0
Archivo: picmi.cpp Proyecto: KDE/picmi
Picmi::Picmi()
{
    int width, height;
    double density;
    bool prevent_mistakes;

    switch (Settings::instance()->level()) {
    case KgDifficultyLevel::Easy: width = height = 10; density = 0.55; prevent_mistakes = false; break;
    case KgDifficultyLevel::Medium: width = 15; height = 10; density = 0.55; prevent_mistakes = false; break;
    case KgDifficultyLevel::Hard: width = height = 15; density = 0.55; prevent_mistakes = false; break;
    case KgDifficultyLevel::Custom:
    default:
        width = Settings::instance()->width();
        height = Settings::instance()->height();
        density = Settings::instance()->boxDensity();
        prevent_mistakes = Settings::instance()->preventMistakes();
        break;
    }

    m_map = QSharedPointer<BoardMap>(new BoardMap(width, height, density));
    m_state = QSharedPointer<BoardState>(new BoardState(width, height));
    m_streaks = QSharedPointer<Streaks>(new Streaks(m_map, m_state));

    if (prevent_mistakes) {
        m_io_handler = QSharedPointer<IOHandler>(new IOHandlerHints(m_map.data(), m_state.data(), &m_timer));
    } else {
        m_io_handler = QSharedPointer<IOHandler>(new IOHandlerNoHints(m_map.data(), m_state.data(), &m_timer));
    }

    m_timer.start();

    setupSlots();
}
Ejemplo n.º 6
0
Archivo: picmi.cpp Proyecto: KDE/picmi
Picmi::Picmi(QSharedPointer<BoardMap> board) {
    m_map = board;
    m_state = QSharedPointer<BoardState>(new BoardState(board->width(), board->height()));
    m_streaks = QSharedPointer<Streaks>(new Streaks(m_map, m_state));
    m_io_handler = QSharedPointer<IOHandler>(new IOHandlerNoHints(m_map.data(), m_state.data(), &m_timer));
    m_timer.start();

    setupSlots();
}
Ejemplo n.º 7
0
void jumpTo(int r1,int g1,int b1,int r2,int g2,int b2,int r3,int g3,int b3) {
    current[0] = r1;
    current[1] = g1;
    current[2] = b1;
    current[3] = r2;
    current[4] = g2;
    current[5] = b2;
    current[6] = r3;
    current[7] = g3;
    current[8] = b3;
    setupSlots(r1,g1,b1,r2,g2,b2,r3,g3,b3);
}
void CustomWidgetEditor::currentWidgetChanged( QListBoxItem *i )
{
    checkTimer->stop();
    checkWidgetName();

    MetaDataBase::CustomWidget *w = findWidget( i );
    if ( !i || !w ) {
	buttonChooseHeader->setEnabled( FALSE );
	editClass->setEnabled( FALSE );
	editHeader->setEnabled( FALSE );
	buttonChoosePixmap->setEnabled( FALSE );
	spinWidth->setEnabled( FALSE );
	spinHeight->setEnabled( FALSE );
	localGlobalCombo->setEnabled( FALSE );
	sizeHor->setEnabled( FALSE );
	sizeVer->setEnabled( FALSE );
	checkContainer->setEnabled( FALSE );
	return;
    }

    buttonChooseHeader->setEnabled( TRUE );
    editClass->setEnabled( TRUE );
    editHeader->setEnabled( TRUE );
    buttonChoosePixmap->setEnabled( TRUE );
    spinWidth->setEnabled( TRUE );
    spinHeight->setEnabled( TRUE );
    localGlobalCombo->setEnabled( TRUE );
    sizeHor->setEnabled( TRUE );
    sizeVer->setEnabled( TRUE );
    checkContainer->setEnabled( TRUE );

    editClass->blockSignals( TRUE );
    editClass->setText( w->className );
    editClass->blockSignals( FALSE );
    editHeader->setText( w->includeFile );
    localGlobalCombo->setCurrentItem( (int)w->includePolicy );
    if ( w->pixmap )
	previewPixmap->setPixmap( *w->pixmap );
    else
	previewPixmap->setText( "" );
    spinWidth->setValue( w->sizeHint.width() );
    spinHeight->setValue( w->sizeHint.height() );
    sizeHor->setCurrentItem( size_type_to_int( w->sizePolicy.horData() ) );
    sizeVer->setCurrentItem( size_type_to_int( w->sizePolicy.verData() ) );
    checkContainer->setChecked( w->isContainer );

    setupSignals();
    setupSlots();
    setupProperties();
}
Ejemplo n.º 9
0
void KRenameWindow::setupGui()
{
    m_buttons->clear();

    m_guiMode    = &tAdvancedMode;

    m_buttonFinish = new QPushButton(QIcon::fromTheme(QStringLiteral("dialog-ok")),    i18n("&Finish"));

    m_buttons->setStandardButtons(QDialogButtonBox::Help | QDialogButtonBox::Close);
    m_buttons->addButton(m_buttonFinish, QDialogButtonBox::AcceptRole);
    m_buttonClose = m_buttons->button(QDialogButtonBox::Close);
    m_buttonClose->setShortcut(QKeySequence(QKeySequence::Quit));

    KHelpMenu *helpMenu = new KHelpMenu(this);
    m_buttons->button(QDialogButtonBox::Help)->setMenu(helpMenu->menu());

    setupSlots();
    slotEnableControls();
}