bool Control::on_shortcut(GdkEventKey *event) { if (!event->state & GDK_CONTROL_MASK) return false; switch (event->keyval) { case GDK_KEY_S: case GDK_KEY_s: if (_last_filename.empty()) { on_save_as_clicked(); } else { if (event->state & GDK_SHIFT_MASK) on_save_as_clicked(); else on_save_clicked(); } return true; case GDK_KEY_O: case GDK_KEY_o: case GDK_KEY_A: case GDK_KEY_a: on_open_clicked(); return true; default: return false; } }
GLADE_CB gboolean on_gfm_dbox_delete_event (GtkWidget *widget, GdkEvent *event, gpointer user_data) { if(!GFMFile.saved) { int result; result = msgbox_three(_("Save"), _("Quit"), _("File has not been saved yet. Do you want to quit?")); switch(result) { case MSGBOX_BUTTON1: on_save_clicked(NULL, NULL); on_quit_clicked(NULL, NULL); return FALSE; break; case MSGBOX_BUTTON2: on_quit_clicked(NULL, NULL); return FALSE; break; case MSGBOX_NO: return TRUE; break; } } else on_quit_clicked(NULL, NULL); return FALSE; }
GLADE_CB void on_open_clicked (GtkToolButton *toolbutton, gpointer user_data) { gchar *fn; if(user_data == NULL) { if(GFMFile.contents.group || GFMFile.contents.tigroup) { int result = msgbox_two(MSGBOX_YESNO, _("Do you want to save previous file?")); if(result == MSGBOX_YES) on_save_clicked(toolbutton,user_data); } fn = (char *)create_fsel(inst_paths.home_dir, "", "*.73?;*.82?;*.83?;*.8X?;*.85?;*.86?;*.89?;*.92?;*.9x?;*.V2?;*.tig", FALSE); if(fn == NULL) return; } else { // command line fn = (char *)user_data; } if(tifiles_file_is_tigroup(fn)) GFMFile.type = TIFILE_TIGROUP; else if(tifiles_file_is_regular(fn)) GFMFile.type = TIFILE_GROUP; else return; file_load(fn); g_free(GFMFile.filename); GFMFile.filename = g_strdup(fn); enable_save(FALSE); enable_tree(TRUE); ctree_refresh(); labels_refresh(); g_free(inst_paths.home_dir); inst_paths.home_dir = g_path_get_dirname(GFMFile.filename); }
int setting::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QDialog::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: on_pushButton_2_clicked(); break; case 1: on_pushButton_3_clicked(); break; case 2: on_pushButton_4_clicked(); break; case 3: on_save_clicked(); break; case 4: on_reSetting_clicked(); break; case 5: on_pushButton_5_clicked(); break; case 6: on_pushButton_6_clicked(); break; case 7: on_pushButton_clicked(); break; case 8: on_pushButton_10_clicked(); break; case 9: on_pushButton_8_clicked(); break; case 10: on_pushButton_9_clicked(); break; default: ; } _id -= 11; } return _id; }
void MainWindow::SetupGameBoard() { this->gridLayout = new QGridLayout; this->gridLayout->setHorizontalSpacing(0); this->gridLayout->setVerticalSpacing(0); this->boardBoundX = 44; this->boardBoundY = 44; //Instantiating Qimages this->_path = QImage(":/PathRecent20x20.png"); this->_wall = QImage(":/WallRecent20x20.png"); this->_character = QImage(":/CharacterRecent20x20.png"); this->_coffin = QImage(":/CoffinRecent20x20.png"); //Considering using this as a pickup item - Miguel this->_topLeft = QImage(":/TopLeft.png"); //Upper Tile this->_topMiddle = QImage(":/TopMiddle.png"); //Upper Tile this->_topRight = QImage(":/TopRight.png"); //Upper Tile //Bottom Tiles this->_botLeft = QImage(":/BottomLeft.png"); this->_botRight = QImage(":/BottomRight.png"); //Left Most Tiles this->_midLeft = QImage(":/LeftMiddle.png"); this->_midRight = QImage(":/RightMiddle.png"); //Right Most Tiles //Define Enemy Map Images this->_enemyOne = QImage(":/EnemyMap.png"); this->_enemyTwo = QImage(":/EnemyMap2.png"); this->_enemyBoss = QImage(":/EnemyBoss.png"); for (int y = 0; y <= this->boardBoundY; y++) { for (int x = 0; x <= this->boardBoundX; x++) { QLabel *textBlock = new QLabel; if (y == this->_curY && x == this->_curX) { qDebug() << "Found characer!" << endl; textBlock->setPixmap(QPixmap::fromImage(this->_character)); } else if (this->boardMatrix[y][x] == 1) { textBlock->setPixmap(QPixmap::fromImage(this->_wall)); } else if (this->boardMatrix[y][x] == 2) { textBlock->setPixmap(QPixmap::fromImage(this->_coffin)); } else if (this->boardMatrix[y][x] == 3) { //Top left tile textBlock->setPixmap(QPixmap::fromImage(this->_topLeft)); } else if (this->boardMatrix[y][x] == 4) { //Top middle tile textBlock->setPixmap(QPixmap::fromImage(this->_topMiddle)); } else if (this->boardMatrix[y][x] == 5) { textBlock->setPixmap(QPixmap::fromImage(this->_topRight)); } else if (this->boardMatrix[y][x] == 6) { textBlock->setPixmap(QPixmap::fromImage(this->_botLeft)); } else if (this->boardMatrix[y][x] == 7) { textBlock->setPixmap(QPixmap::fromImage(this->_botRight)); } else if (this->boardMatrix[y][x] == 8) { textBlock->setPixmap(QPixmap::fromImage(this->_midLeft)); } else if (this->boardMatrix[y][x] == 9) { textBlock->setPixmap(QPixmap::fromImage(this->_midRight)); } else if (this->boardMatrix[y][x] == 91) { textBlock->setPixmap(QPixmap::fromImage(this->_enemyOne)); } else if (this->boardMatrix[y][x] == 93) { textBlock->setPixmap(QPixmap::fromImage(this->_enemyTwo)); } else if (this->boardMatrix[y][x] == 90) { textBlock->setPixmap(QPixmap::fromImage(this->_enemyBoss)); } else textBlock->setPixmap(QPixmap::fromImage(this->_path)); gridLayout->addWidget(textBlock, y, x, 1, 1, Qt::AlignCenter); } QPushButton *backButton = new QPushButton; backButton->setText("EXIT"); backButton->setStyleSheet("background-color:blue; color:yellow; font-family: Terminal; font-size:20px;"); gridLayout->addWidget(backButton, 46, 0, 1, 5, Qt::AlignCenter | Qt::AlignVCenter); QLabel *healthStatusLabel = new QLabel("CURRENT HEALTH: "); healthStatusLabel->setStyleSheet("color:yellow; font-family: Terminal; font-size:20px;"); gridLayout->addWidget(healthStatusLabel, 46, 5, 1, 20, Qt::AlignRight | Qt::AlignVCenter); healthStatus = new QLabel(""); healthStatus->setStyleSheet("color:yellow; font-family: Terminal; font-size:20px;"); gridLayout->addWidget(healthStatus, 46, 25, 1, 14, Qt::AlignLeft | Qt::AlignVCenter); QPushButton *saveButton = new QPushButton("SAVE"); saveButton->setStyleSheet("background-color:blue; color:yellow; font-family: Terminal; font-size:20px;"); gridLayout->addWidget(saveButton, 46, 39, 1, 5, Qt::AlignCenter | Qt::AlignVCenter); connect(backButton, SIGNAL(clicked()), this, SLOT(on_back_clicked())); connect(saveButton, SIGNAL(clicked()), this, SLOT(on_save_clicked())); } gameBoardWidget = new QWidget; this->updateHealth(this->mainChar->get_hero_health()); gameBoardWidget->setLayout(gridLayout); gameBoardWidget->setWindowTitle("Dungeon"); }