Exemplo n.º 1
0
void processSpecialKeys(int key, int x, int y) {
	switch (key) {
	case GLUT_KEY_LEFT:
		moveLeft();
		break;
	case GLUT_KEY_RIGHT:
		moveRight();
		break;
	case GLUT_KEY_UP:
		moveUp();
		break;
	case GLUT_KEY_DOWN:
		moveDown();
		break;
	}
	glutPostRedisplay();
}
Exemplo n.º 2
0
ColorDialog::ColorDialog(QWidget *parent)
	: QDialog(parent)
{
	manager_ = Application::self()->colorManager();
	changed_ = false;
	
	ui_ = new Ui::ColorDialog();

	ui_->setupUi(this);

	ui_->buttonMoveDown->setEnabled(false);
	ui_->buttonMoveUp->setEnabled(false);
	ui_->buttonAdd->setEnabled(false);
	ui_->buttonRemove->setEnabled(false);
	
	ui_->buttonMoveDown->setIcon(KIcon("arrow-down"));
	ui_->buttonMoveUp->setIcon(KIcon("arrow-up"));
	ui_->buttonAdd->setIcon(KIcon("list-add"));
	ui_->buttonRemove->setIcon(KIcon("list-remove"));

	QStringList headers;
	headers << i18n("ID") << i18n("Name") << i18n("Material Type");

	ui_->listColors->setHeaderLabels(headers);
	ui_->listFavorites->setHeaderLabels(headers);

	ui_->listColors->setColumnWidth(0, 32);
	ui_->listColors->setColumnWidth(1, 128);
	ui_->listColors->setColumnWidth(2, 96);
	
	ui_->listFavorites->setColumnWidth(0, 32);
	ui_->listFavorites->setColumnWidth(1, 128);
	ui_->listFavorites->setColumnWidth(2, 96);

	connect(ui_->listColors, SIGNAL(currentItemChanged(QTreeWidgetItem *, QTreeWidgetItem *)),
			this, SLOT(colorItemChanged(QTreeWidgetItem *, QTreeWidgetItem *)));
	connect(ui_->listFavorites, SIGNAL(currentItemChanged(QTreeWidgetItem *, QTreeWidgetItem *)),
			this, SLOT(favoritesItemChanged(QTreeWidgetItem *, QTreeWidgetItem *)));
	connect(ui_->buttonAdd, SIGNAL(clicked()), this, SLOT(addToFavorites()));
	connect(ui_->buttonRemove, SIGNAL(clicked()), this, SLOT(removeFromFavorites()));
	connect(ui_->buttonMoveUp, SIGNAL(clicked()), this, SLOT(moveUp()));
	connect(ui_->buttonMoveDown, SIGNAL(clicked()), this, SLOT(moveDown()));
	connect(ui_->buttonBox, SIGNAL(accepted()), this, SLOT(apply()));

	initList();
}
Exemplo n.º 3
0
StringListEdit::StringListEdit(const QStringList &list, 
                               UntitledList* unamedList, 
                               QWidget *parent)
    : QDialog(parent), 
      ask(false), 
      duplicatesOk(false),
      _suggestedStringsList(unamedList)
{
    addCaption = "Add String";
    addLabel = "String:";
    editCaption = "Edit String";
    editLabel = addLabel;

    Q3HBoxLayout *hbox = new Q3HBoxLayout(this, 5, 5);
    Q3VBoxLayout *vbox = new Q3VBoxLayout;
    listBox = new Q3ListBox(this);
    connect(listBox, SIGNAL(currentChanged(Q3ListBoxItem*)),
            this, SLOT(updateButtons()));
    hbox->addWidget(listBox, 1);
    QPushButton *button = new QPushButton(tr("&Add..."), this);
    connect(button, SIGNAL(clicked()), this, SLOT(addString()));
    vbox->addWidget(button);
    editButton = new QPushButton(tr("&Edit..."), this);
    connect(editButton, SIGNAL(clicked()), this, SLOT(editString()));
    vbox->addWidget(editButton);
    removeButton = new QPushButton(tr("&Remove..."), this);
    connect(removeButton, SIGNAL(clicked()), this, SLOT(removeString()));
    vbox->addWidget(removeButton);
    upButton = new QPushButton(tr("&Up"), this);
    connect(upButton, SIGNAL(clicked()), this, SLOT(moveUp()));
    vbox->addWidget(upButton);
    downButton = new QPushButton(tr("&Down"), this);
    connect(downButton, SIGNAL(clicked()), this, SLOT(moveDown()));
    vbox->addWidget(downButton);
    vbox->addStretch(1);
    button = new QPushButton(tr("OK"), this);
    connect(button, SIGNAL(clicked()), this, SLOT(accept()));
    vbox->addWidget(button);
    button = new QPushButton(tr("Cancel"), this);
    connect(button, SIGNAL(clicked()), this, SLOT(reject()));
    vbox->addWidget(button);
    hbox->addLayout(vbox);

    setList(list);
}
Exemplo n.º 4
0
ColumnList::ColumnList( QWidget *parent, const char *name )
    : QHBox( parent, name ), m_changed( true )
{
    setSpacing( 5 );

    QVBox *buttonbox = new QVBox( this );

    m_up = new KPushButton( KGuiItem( QString::null, "up" ), buttonbox );
    QToolTip::add( m_up, i18n( "Move column up" ) );
    connect( m_up, SIGNAL( clicked() ), this, SLOT( moveUp() ) );

    m_down = new KPushButton( KGuiItem( QString::null, "down" ), buttonbox );
    QToolTip::add( m_down, i18n( "Move column down" ) );
    connect( m_down, SIGNAL( clicked() ), this, SLOT( moveDown() ) );

    m_list = new KListView( this );
    m_list->addColumn("");
    m_list->header()->hide();
    m_list->setSelectionMode( QListView::Single );
    m_list->setResizeMode( QListView::LastColumn );
    m_list->setSorting( -1 );
    m_list->setAcceptDrops( true );
    m_list->setDragEnabled( true );
    m_list->setDropVisualizer( true );
    m_list->setDropVisualizerWidth( 3 );
    connect( m_list, SIGNAL( moved() ), this, SLOT( updateUI() ) );
    connect( m_list, SIGNAL( moved() ), this, SLOT( setChanged() ) );
    connect( m_list, SIGNAL( currentChanged( QListViewItem* ) ), this, SLOT( updateUI() ) );

    QHeader* const h = Playlist::instance()->header();
    for( int i = h->count() - 1; i >= 0; --i )
    {
        const int s = h->mapToSection( i );
        if( ( s != MetaBundle::Rating || AmarokConfig::useRatings() ) &&
            ( s != MetaBundle::Score || AmarokConfig::useScores() ) )
        {
            ( new MyCheckListItem( s, m_list, MetaBundle::prettyColumnName( s ), QCheckListItem::CheckBox, this ) )
                ->setOn( h->sectionSize( s ) );
        }
    }

    m_list->setCurrentItem( m_list->firstChild() );
    updateUI();
    resetChanged();
}
void CSchoolFish::process()
{
	// Only move the fish, when it gets speed, which only happens, when Keen is nearby them
	if(m_moveSpeed)
	{
		if(xDirection == LEFT)
			moveLeft(m_moveSpeed);
		else if(xDirection == RIGHT)
			moveRight(m_moveSpeed);

		if(yDirection == UP)
			moveUp(m_moveSpeed);
		else if(yDirection == DOWN)
			moveDown(m_moveSpeed);
	}

	processActionRoutine();
}
Exemplo n.º 6
0
void ce_player::jump(){
	
	if (jumpCount == 0){

		//Jump down
		moveDown(jump_speed);

		//Stop jumping if collision with wall
		if (isTouching(cet_wall)){
			isJumping = false;
		}
	}else{

		//Jump up
		moveUp(jump_speed);
		jumpCount--;
	}
}
Exemplo n.º 7
0
void BasicBullet::move(double vx, double vy)// double vx, double vy
{
//	std::cout << "\nbullet x " << x << std::endl;
//	std::cout << "fin x " << finX << std::endl;

	if(vx > 0)
		moveRight(1);

	else if(vx < 0)
		moveLeft(1);
/*
*/
	if(vy < 0)
		moveUp(1);

	else if(vy > 0)
		moveDown(1);
}
Exemplo n.º 8
0
void EffectView::contextMenuEvent( QContextMenuEvent * )
{
	QPointer<CaptionMenu> contextMenu = new CaptionMenu( model()->displayName(), this );
	contextMenu->addAction( embed::getIconPixmap( "arp_up" ),
						tr( "Move &up" ),
						this, SLOT( moveUp() ) );
	contextMenu->addAction( embed::getIconPixmap( "arp_down" ),
						tr( "Move &down" ),
						this, SLOT( moveDown() ) );
	contextMenu->addSeparator();
	contextMenu->addAction( embed::getIconPixmap( "cancel" ),
						tr( "&Remove this plugin" ),
						this, SLOT( deletePlugin() ) );
	contextMenu->addSeparator();
	contextMenu->addHelpAction();
	contextMenu->exec( QCursor::pos() );
	delete contextMenu;
}
Exemplo n.º 9
0
void EditorScreen::buttonClicked(int button)
{
  int entity = CalculatorState::instance().printableEntityByButton(button);

  if (entity >= 0) // Printable entity
    writeEntity(entity);
  else if (cursorVisible())
    switch (button)
    {
    case Button_Up: moveUp(); break;
    case Button_Down: moveDown(); break;
    case Button_Left: moveLeft(); break;
    case Button_Right: moveRight(); break;
    case Button_Del: deleteString(); break;
    case Button_Ins: insertClicked(); break;
    default:;
    }
}
Exemplo n.º 10
0
void Editor::handleNormalModeCommand(int c)
{
    std::lock_guard<std::recursive_mutex> lock(_mutex);
    assert(_mode == NORMAL);
    assert(!_cmd.empty());

    switch(c)
    {
        case KEY_LEFT:
            moveLeft();
            break;
        case KEY_RIGHT:
            moveRight();
            break;
        case KEY_UP:
            moveUp();
            break;
        case KEY_DOWN:
            moveDown();
            break;
        case KEY_ENTER:
        case 10:
            executeCommand();
            break;
        case 27:
            //esc/alt key clear command
            _cmd.clear();
            break;
        case 127:
        case KEY_BACKSPACE:
        case KEY_DC:
            //remove last character from command
            if(!_cmd.empty())
            {
                _cmd.erase(_cmd.size()-1, 1);
            }
            break;
        default:
            // Add character to command
            _cmd.append(1, char(c));
            break;
    }
}
Exemplo n.º 11
0
void Object::getInput()
{
    if(GetKeyState(VK_UP) & 0x80)
    {
        moveUp();
    }
    if(GetKeyState(VK_RIGHT) & 0x80)
    {
        moveRight();
    }
    if(GetKeyState(VK_DOWN) & 0x80)
    {
        moveDown();
    }
    if(GetKeyState(VK_LEFT) & 0x80)
    {
        moveLeft();
    }
}
Exemplo n.º 12
0
DefectsEditor::DefectsEditor(const QList<Defect<GeneralComponentSystem> >& defects, QMap<int,
                                                                                        QString>& boundaryConditionsIdentifier,
    QMainWindow* parent) : QDialog(parent), boundaryConditionsIdentifier(boundaryConditionsIdentifier), defects(defects)
{

    setupUi(this);
    defectsModel = new DefectsModel(defects, boundaryConditionsIdentifier, this);
    TextSelectionDelegate* delegate = new TextSelectionDelegate(boundaryConditionsIdentifier, this);
    tableView->setItemDelegateForColumn(4, delegate);
    tableView->setModel(defectsModel);
    tableView->horizontalHeader()->setStretchLastSection(true);
    tableView->resizeColumnsToContents();
    tableView->resizeRowsToContents();
    connect(defectsModel, SIGNAL(dataChanged(const QModelIndex&, const QModelIndex&)), this, SLOT(updateData(const QModelIndex&, const QModelIndex&)));
    connect(insertButton, SIGNAL(clicked()), this, SLOT(insertRow()));
    connect(deleteButton, SIGNAL(clicked()), this, SLOT(removeRow()));
    connect(upButton, SIGNAL(clicked()), this, SLOT(moveUp()));
    connect(downButton, SIGNAL(clicked()), this, SLOT(moveDown()));
}
Exemplo n.º 13
0
void CLindsey::process()
{
	if(m_timer <= 0)
	{
		m_timer = LINDSEY_MOVE_SPEED;
		yDirection = (yDirection==UP) ? DOWN : UP;
	}


	if(yDirection == UP)
		moveUp(LINDSEY_MOVE_SPEED);
	else
		moveDown(LINDSEY_MOVE_SPEED);

	m_timer--;

	if(!processActionRoutine())
			exists = false;
}
Exemplo n.º 14
0
void CDoor::process()
{
	CSprite &Doorsprite = g_pGfxEngine->getSprite(sprite);

	if (timer > DOOR_OPEN_SPEED)
	{
		// TODO: Create a flag for mods in which the door can be opened in another direction
		//if (DoorOpenDir==DOWN)
		moveDown(1<<STC);
		Doorsprite.setHeight(Doorsprite.getHeight()-1);
		timer = 0;
		if (Doorsprite.getHeight() == 0)
		{
			exists = false;
			return;
		}
	}
	else timer++;
}
Exemplo n.º 15
0
/**
 * \brief    Constructeur de DocumentEditorRow
 * \details  Construit une ligne d'édition pour le DocumentEditor en construisant
 *           un éditeur pliable et les boutons pour déplacer une note dans le document,
 *           l'éditer directement dans la fenêtre principale ou la supprimer
 */
DocumentEditorRow::DocumentEditorRow(Note *n, QWidget *parent) :
    QWidget(parent) {
    editor = new FoldableEditor(NotesEditorFactory::getInstance().getNewNoteEditor(n, this), this);
    QObject::connect(editor, SIGNAL(onOpen()), this, SLOT(setSideBarVertical()));
    QObject::connect(editor, SIGNAL(onClose()), this, SLOT(setSideBarHorizontal()));
    moveUpBtn = new QPushButton(QIcon("moveUp.png"), "", this);
    moveUpBtn->setFixedSize(30, 30);
    QObject::connect(moveUpBtn, SIGNAL(clicked()), this, SLOT(moveUp()));
    moveDownBtn = new QPushButton(QIcon("moveDown.png"), "", this);
    moveDownBtn->setFixedSize(30, 30);
    QObject::connect(moveDownBtn, SIGNAL(clicked()), this, SLOT(moveDown()));
    editBtn = new QPushButton(QIcon("editer.png"), "", this);
    editBtn->setFixedSize(30, 30);
    QObject::connect(editBtn, SIGNAL(clicked()), this, SLOT(edit()));
    supressBtn = new QPushButton(QIcon("supprimer.png"), "", this);
    supressBtn->setFixedSize(30, 30);
    QObject::connect(supressBtn, SIGNAL(clicked()), this, SLOT(supress()));
    addBtn = new QPushButton("Ajouter une note existante");
    QObject::connect(addBtn, SIGNAL(clicked()), this, SLOT(add()));
    createBtn = new QPushButton("Créer une note");
    QObject::connect(createBtn, SIGNAL(clicked()), this, SLOT(create()));

    subLayout = new QBoxLayout(QBoxLayout::LeftToRight);
    subLayout->addWidget(moveUpBtn);
    subLayout->addWidget(moveDownBtn);
    subLayout->addWidget(editBtn);
    subLayout->addWidget(supressBtn);

    QHBoxLayout* hLayout = new QHBoxLayout();
    hLayout->addWidget(editor);
    hLayout->addLayout(subLayout);

    QHBoxLayout* addLayout = new QHBoxLayout();
    addLayout->addWidget(addBtn);
    addLayout->addWidget(createBtn);

    layout = new QVBoxLayout();
    layout->addLayout(hLayout);
    layout->addLayout(addLayout);

    this->setLayout(layout);
}
Exemplo n.º 16
0
ReorderDialog::ReorderDialog(QWidget *parent, SoundFileList *list) :
    QDialog(parent),
    ui(new Ui::ReorderDialog)
{
    qDebug("Entering ReorderDialog::ReorderDialog()...");
    ui->setupUi(this);

    this->list = list;

    fillWidget(0);

    connect(list, SIGNAL(moved(int)), this, SLOT(fillWidget(int)));

    connect(ui->bottom, SIGNAL(clicked()), this, SLOT(moveBottom()));
    connect(ui->down, SIGNAL(clicked()), this, SLOT(moveDown()));
    connect(ui->down10, SIGNAL(clicked()), this, SLOT(moveTenDown()));
    connect(ui->up10, SIGNAL(clicked()), this, SLOT(moveTenUp()));
    connect(ui->up, SIGNAL(clicked()), this, SLOT(moveUp()));
    connect(ui->top, SIGNAL(clicked()), this, SLOT(moveTop()));
}
Exemplo n.º 17
0
void joyStickBusyWaitingMonitor( void ) {
	uint32_t i;

	while ( 1 ) {

		if ( ~(LPC_GPIO1->FIOPIN | ~UP ) ) {
			moveUp();
		} else if ( ~(LPC_GPIO1->FIOPIN | ~DOWN) ) {
			moveDown();
		} else if( ~(LPC_GPIO1->FIOPIN | ~FIRST ) ) {
			moveFirst();
		} else if( ~(LPC_GPIO1->FIOPIN | ~LAST ) ) {
			moveLast();
		}

		for ( i = 0; i < 100000; ++i ) {
			// Pause
		}
	}
}
Exemplo n.º 18
0
void IntroState::handleEvents(sf::Event event)
{
    switch(event.type)
    {
    case sf::Event::KeyPressed:
        switch(event.key.code)
        {
        case sf::Keyboard::Up:
            moveUp();
            break;
        case sf::Keyboard::Down:
            moveDown();
            break;
        case sf::Keyboard::Return:
            /*if(buttons[selected]->getID() == menu_enums::Exit)
            {
                quit = true;
            }*/
            buttons[selected]->setColor(down_color);
            break;
        }
        break;
    case sf::Event::KeyReleased:
        switch(event.key.code)
        {
        case sf::Keyboard::Return:
            if(buttons[selected]->getID() == menu_enums::Exit)
            {
                quit = true;
            }
            else if(buttons[selected]->getID() == menu_enums::Play)
            {
                manager->changeState(new PlayState(manager));
            }
            buttons[selected]->setColor(sel_color);
            break;
        }
        break;

    }
}
Exemplo n.º 19
0
void Editor::handleNormalMode(int c)
{
    switch(c)
    {
        case KEY_LEFT:
        case 'h':
            moveLeft();
            break;
        case KEY_RIGHT:
        case 'l':
            moveRight();
            break;
        case KEY_UP:
        case 'k':
            moveUp();
            break;
        case KEY_DOWN:
        case 'j':
            moveDown();
            break;
        case 'i':
            _mode = INSERT;
            break;
        case 'p':
            _showPass = !_showPass;
        case KEY_ENTER:
        case 10:
            break;
        case 27:
            //esc/alt key clear command
            break;
        case 127:
        case KEY_BACKSPACE:
        case KEY_DC:
            break;
        default:
            // Add character to command
            _cmd.append(1, char(c));
            break;
    }
}
Exemplo n.º 20
0
SearchEnginesDialog::SearchEnginesDialog(QWidget* parent)
    : QDialog(parent)
    , ui(new Ui::SearchEnginesDialog)
    , m_manager(mApp->searchEnginesManager())
{
    setAttribute(Qt::WA_DeleteOnClose);
    ui->setupUi(this);

    connect(ui->add, SIGNAL(clicked()), this, SLOT(addEngine()));
    connect(ui->remove, SIGNAL(clicked()), this, SLOT(removeEngine()));
    connect(ui->edit, SIGNAL(clicked()), this, SLOT(editEngine()));
    connect(ui->setAsDefault, SIGNAL(clicked()), this, SLOT(setDefaultEngine()));
    connect(ui->defaults, SIGNAL(clicked()), this, SLOT(defaults()));
    connect(ui->moveUp, SIGNAL(clicked()), this, SLOT(moveUp()));
    connect(ui->moveDown, SIGNAL(clicked()), this, SLOT(moveDown()));

    connect(ui->treeWidget, SIGNAL(itemDoubleClicked(QTreeWidgetItem*,int)), this, SLOT(editEngine()));

    ui->treeWidget->sortByColumn(-1);
    reloadEngines();
}
Exemplo n.º 21
0
//--------------------------------------------------------------
void testApp::keyReleased(int key){

    switch(key){
        case OF_KEY_RETURN:
            current_point = (current_point+1)%4;
            break;
        case OF_KEY_LEFT:
            moveLeft();
            break;
        case OF_KEY_RIGHT:
            moveRight();
            break;
        case OF_KEY_UP:
            moveUp();
            break;
        case OF_KEY_DOWN:
            moveDown();
            break;
    }

}
Exemplo n.º 22
0
void PlaylistEdit::createConnections()
{
    connect(ui->actionAbout, SIGNAL(triggered()), this, SLOT(aboutTano()));
    connect(ui->actionSettings, SIGNAL(triggered()), this, SLOT(settings()));
    connect(ui->actionOpen, SIGNAL(triggered()), this, SLOT(open()));
    connect(ui->actionNew, SIGNAL(triggered()), this, SLOT(newPlaylist()));
    connect(ui->actionDelete, SIGNAL(triggered()), this, SLOT(deleteItem()));
    connect(ui->actionAdd, SIGNAL(triggered()), this, SLOT(addItem()));
    connect(ui->actionSave, SIGNAL(triggered()), this, SLOT(save()));
    connect(ui->actionClose, SIGNAL(triggered()), this, SLOT(exit()));
    connect(ui->actionExport, SIGNAL(triggered()), this, SLOT(menuOpenExport()));
    connect(ui->actionExportTvheadend, SIGNAL(triggered()), this, SLOT(exportTvheadend()));
    connect(ui->actionExportXmltvId, SIGNAL(triggered()), this, SLOT(exportXmltvId()));
    connect(ui->actionPrint, SIGNAL(triggered()), this, SLOT(print()));

    connect(ui->editName, SIGNAL(textChanged(QString)), this, SLOT(setTitle(QString)));

    connect(ui->buttonApplyNum, SIGNAL(clicked()), this, SLOT(editChannelNumber()));
    connect(ui->editNumber, SIGNAL(returnPressed()), ui->buttonApplyNum, SLOT(click()));
    connect(ui->editChannelName, SIGNAL(textChanged(QString)), this, SLOT(editChannelName(QString)));
    connect(ui->editUrl, SIGNAL(textChanged(QString)), this, SLOT(editChannelUrl(QString)));
    connect(ui->editCategories, SIGNAL(textChanged(QString)), this, SLOT(editChannelCategories(QString)));
    connect(ui->editLanguage, SIGNAL(textChanged(QString)), this, SLOT(editChannelLanguage(QString)));
    connect(ui->editEpg, SIGNAL(textChanged(QString)), this, SLOT(editChannelEpg(QString)));
    connect(ui->editLogo, SIGNAL(textChanged(QString)), this, SLOT(editChannelLogo(QString)));

    connect(ui->actionUp, SIGNAL(triggered()), this, SLOT(moveUp()));
    connect(ui->actionDown, SIGNAL(triggered()), this, SLOT(moveDown()));

    connect(ui->playlist, SIGNAL(itemSelected(Channel *)), this, SLOT(editItem(Channel *)));

#if EDITOR
    connect(_update, SIGNAL(newUpdate()), this, SLOT(updateAvailable()));
    connect(ui->actionUpdate, SIGNAL(triggered()), _update, SLOT(check()));
#endif

#if WITH_EDITOR_VLCQT
    connect(ui->buttonUpdate, SIGNAL(toggled(bool)), this, SLOT(refreshPlaylist(bool)));
#endif
}
Exemplo n.º 23
0
	bool Camera::update(int pixelsMovedHorizontal, int pixelsMovedVertical)
	{
		if ( GetAsyncKeyState(Qt::Key::Key_W))
		{
			moveForward();
		}
		if ( GetAsyncKeyState(Qt::Key::Key_S))
		{
			moveBackward();
		}
		if ( GetAsyncKeyState(Qt::Key::Key_A))
		{
			moveLeft();
		}	
		if ( GetAsyncKeyState(Qt::Key::Key_D))
		{
			moveRight();
		}	
		if ( GetAsyncKeyState(Qt::Key::Key_R))
		{
			moveUp();
		}	
		if ( GetAsyncKeyState(Qt::Key::Key_F))
		{
			moveDown();
		}	
		if ( GetAsyncKeyState(VK_OEM_MINUS))
		{
			stepMovement(-0.2f);
		}	
		if ( GetAsyncKeyState(VK_OEM_PLUS))
		{
			stepMovement(0.2f);
		}
		if ( GetAsyncKeyState(VK_RBUTTON))
		{
			turn(pixelsMovedHorizontal, pixelsMovedVertical);
		}
		return true;
	}
ICQStatusEditor::ICQStatusEditor( ICQStatusManager *statusManager, QWidget *parent )
: KDialog( parent ), mStatusManager( statusManager )
{
	setCaption( i18n( "Xtraz Status Editor" ) );
	setButtons( KDialog::Ok | KDialog::Cancel );

	mUi = new Ui::XtrazICQStatusEditorUI();
	QWidget *w = new QWidget( this );
	mUi->setupUi( w );
	setMainWidget( w );

	mUi->statusView->setAlternatingRowColors( true );
	mUi->statusView->setTabKeyNavigation( false );
	mUi->statusView->setSelectionBehavior( QAbstractItemView::SelectRows );
	mUi->statusView->setSelectionMode( QAbstractItemView::SingleSelection );
	mUi->statusView->horizontalHeader()->setClickable( false );
	mUi->statusView->horizontalHeader()->setStretchLastSection( true );

	QList<QIcon> icons;
	for ( int i = 0; i < Oscar::XSTAT_LAST; ++i )
		icons << KIcon( QString( "icq_xstatus%1" ).arg( i ) );

	mUi->statusView->setItemDelegate( new StatusDelegate( icons, this ) );

	mXtrazStatusModel = new Xtraz::StatusModel( this );
	mXtrazStatusModel->setStatuses( mStatusManager->xtrazStatuses() );
	mUi->statusView->setModel( mXtrazStatusModel );
	mUi->statusView->setCurrentIndex( mXtrazStatusModel->index( 0, 0 ) );

	connect( mUi->buttonAdd, SIGNAL(clicked()), this, SLOT(addStatus()) );
	connect( mUi->buttonDelete, SIGNAL(clicked()), this, SLOT(deleteStatus()) );
	connect( mUi->buttonUp, SIGNAL(clicked()), this, SLOT(moveUp()) );
	connect( mUi->buttonDown, SIGNAL(clicked()), this, SLOT(moveDown()) );
	connect( this, SIGNAL(okClicked()), this, SLOT(save()) );
	connect( mUi->statusView->selectionModel(), SIGNAL(currentRowChanged(QModelIndex,QModelIndex)),
	         this, SLOT(updateButtons()) );

	updateButtons();
	mUi->statusView->setFocus();
}
Exemplo n.º 25
0
void Character::moveToward(Character* aim, bool isDirFixed){
	//int aimPosX = aim->getPositionX();
	//MessageBox(Value(aimPosX).asString().c_str(), "test");
	int offX = aim->getPositionX() - this->getPositionX();
	int offY = aim->getPositionY() - this->getPositionY();
	if (abs(offY) >= abs(offX)){
		if (offY < 0){
			moveDown(isDirFixed);
		}
		else if (offY > 0){
			moveUp(isDirFixed);
		}
	}
	else{
		if (offX < 0){
			moveLeft(isDirFixed);
		}
		else if (offX > 0){
			moveRight(isDirFixed);
		}
	}
}
Exemplo n.º 26
0
void GameScene::onTouchEnded(Touch* touch, Event* event) {
    if (isWin() || isGameOver()) {
        return;
    }

    GestureDetector::GestureType gesture = mGestureDetector.endPoint(touch->getLocation());
    bool gestureValid = true;
    bool moved = false;
    switch (gesture) {
    case GestureDetector::MoveLeft:
        moved = moveLeft();
        break;
    case GestureDetector::MoveRight:
        moved = moveRight();
        break;
    case GestureDetector::MoveUp:
        moved = moveUp();
        break;
    case GestureDetector::MoveDown:
        moved = moveDown();
        break;
    case GestureDetector::Unknown:
    default:
        gestureValid = false;
        break;
    }

    if (gestureValid) {
        if (moved) {
            generateCard(true);
            CocosDenshion::SimpleAudioEngine::getInstance()->playEffect(
                    MOVE_SUCESS_SOUND, false);
        } else {
            CocosDenshion::SimpleAudioEngine::getInstance()->playEffect(
                    MOVE_FAILED_SOUND, false);
        }
        doCheck();
    }
}
Exemplo n.º 27
0
// 控制敌方向下一层地板移动
void Enemy::downFloor()
{
	log("Enemy::downFloor");
	//首先获取主角相对于敌人的位置
	RelativeDirection rd = getActorRD();

	if (canDownSuccess(getPosition())) {
		moveDown();
	}
	else if (isAboveFloor(getPosition())){
		if (rd == RD_LEFT ) {
			if (!isInOneFloor()) {
				moveLeft();
			}
		}
		else if (rd == RD_RIGHT) {
			if (!isInOneFloor()) {
				moveRight();
			}
		}
	}
}
Exemplo n.º 28
0
ManageActionsDialog::ManageActionsDialog(QWidget* parent) : KDialog(parent),
pageWidget(new KPageWidget(this)),
manageActionsAutorunWidget(new ManageActionsAutorunWidget(this)),
listConfiguration(new ListConfiguration(this))
{
  setCaption( i18n("Manage Actions") );
  setMainWidget( pageWidget );

  QWidget *baseWidget = new QWidget( this );
  ui.setupUi(baseWidget);

  KPageWidgetItem *generalItem = pageWidget->addPage(baseWidget, i18nc("General settings page", "General"));
  generalItem->setIcon(KIcon("fork"));
  generalItem->setHeader("");

  ui.pbApplyForAll->setIcon(KIcon("arrow-down-double"));

  ui.pbAdd->setIcon(KIcon("list-add"));
  ui.pbRemove->setIcon(KIcon("list-remove"));
  ui.pbUp->setIcon(KIcon("go-up"));
  ui.pbDown->setIcon(KIcon("go-down"));

  connect(ui.pbAdd, SIGNAL(clicked()), this, SLOT(add()));
  connect(ui.pbRemove, SIGNAL(clicked()), this, SLOT(remove()));
  connect(ui.pbUp, SIGNAL(clicked()), this, SLOT(moveUp()));
  connect(ui.pbDown, SIGNAL(clicked()), this, SLOT(moveDown()));
  connect(ui.leTrigger, SIGNAL(textChanged(QString)), this, SLOT(applyTrigger(QString)));
  connect(ui.pbApplyForAll, SIGNAL(clicked()), this, SLOT(applyTriggerToAll()));

  ui.lvPlugins->setIconSize(QSize(24,24));
  ui.lvPlugins->setSpacing(2);

  setButtons(KDialog::Ok);

  connect(ui.lvPlugins, SIGNAL(clicked(QModelIndex)), this, SLOT(currentSelectionChanged()));

  ui.twActionConfig->addTab(listConfiguration, i18n("Lists"));
  ui.twActionConfig->addTab(manageActionsAutorunWidget, i18n("Autorun"));
}
Exemplo n.º 29
0
void doallMoves(from)
{
    char game[ 36 ];
    memcpy(game, moves[ from ].game, 36);

    int level = moves[ from ].level + 1;

    char have[ 256 ];
    memset(have, 0, 256);

    for (int pos = 0; pos < 36; pos++)
    {
        int ccc = game[ pos ];

        if ((ccc == '_') || have[ ccc ]) continue;

        have[ ccc ] = 1;

        int len = blocks[ ccc ].len;
        int dir = blocks[ ccc ].dir;

        if (dir == 0)
        {
            moveLeft(game, from, level, pos, ccc, len, 1);
            if (solved) return;

            moveRight(game, from, level, pos, ccc, len, 1);
            if (solved) return;
        }
        else
        {
            moveUp(game, from, level, pos, ccc, len, 1);
            if (solved) return;

            moveDown(game, from, level, pos, ccc, len, 1);
            if (solved) return;
        }
    }
}
Exemplo n.º 30
0
QgsAttributeActionDialog::QgsAttributeActionDialog( QgsAttributeAction* actions,
    const QgsFields& fields,
    QWidget* parent ):
    QWidget( parent ), mActions( actions )
{
  setupUi( this );
  QHeaderView *header = attributeActionTable->horizontalHeader();
  header->setHighlightSections( false );
  header->setStretchLastSection( true );
  attributeActionTable->setColumnWidth( 0, 100 );
  attributeActionTable->setColumnWidth( 1, 230 );
  attributeActionTable->setCornerButtonEnabled( false );

  connect( attributeActionTable, SIGNAL( itemSelectionChanged() ),
           this, SLOT( itemSelectionChanged() ) );
  connect( actionName, SIGNAL( textChanged( QString ) ), this, SLOT( updateButtons() ) );
  connect( actionAction, SIGNAL( textChanged() ), this, SLOT( updateButtons() ) );

  connect( moveUpButton, SIGNAL( clicked() ), this, SLOT( moveUp() ) );
  connect( moveDownButton, SIGNAL( clicked() ), this, SLOT( moveDown() ) );
  connect( removeButton, SIGNAL( clicked() ), this, SLOT( remove() ) );
  connect( addDefaultActionsButton, SIGNAL( clicked() ), this, SLOT( addDefaultActions() ) );

  connect( browseButton, SIGNAL( clicked() ), this, SLOT( browse() ) );
  connect( insertButton, SIGNAL( clicked() ), this, SLOT( insert() ) );
  connect( updateButton, SIGNAL( clicked() ), this, SLOT( update() ) );
  connect( insertFieldButton, SIGNAL( clicked() ), this, SLOT( insertField() ) );
  connect( insertExpressionButton, SIGNAL( clicked() ), this, SLOT( insertExpression() ) );

  connect( chooseIconButton, SIGNAL( clicked() ), this, SLOT( chooseIcon() ) );

  init();
  // Populate the combo box with the field names. Will the field names
  // change? If so, they need to be passed into the init() call, or
  // some access to them retained in this class.
  for ( int idx = 0; idx < fields.count(); ++idx )
    fieldComboBox->addItem( fields[idx].name() );
}