ILuint TextureControl::getImageHandle() { ILuint newImageHandle; ilGenImages(1,&newImageHandle); if(!selectImage(newImageHandle)) return 0; return newImageHandle; }
ImageEffectConfigWidget::ImageEffectConfigWidget(QWidget *parent) : KoFilterEffectConfigWidgetBase(parent), m_effect(0) { QGridLayout * g = new QGridLayout(this); m_image = new QLabel(this); QPushButton * button = new QPushButton(i18n("Select image..."), this); g->addWidget(m_image, 0, 0, Qt::AlignCenter); g->addWidget(button, 0, 1); setLayout(g); connect(button, SIGNAL(clicked()), this, SLOT(selectImage())); }
void MainWindow::useOldUI() { #if (QT_VERSION < 0x040400) QGridLayout *mainLayout; QHBoxLayout *fileSelectLayout, *buttonLayout; QLabel *file, *device, *version; QPushButton *fileSelectButton, *exitButton, *writeButton; fileLine = new QLineEdit; deviceComboBox = new QComboBox; fileSelectButton = new QPushButton(tr("Select")); connect(fileSelectButton, SIGNAL(clicked()), this, SLOT(selectImage())); exitButton = new QPushButton(tr("Exit")); connect(exitButton, SIGNAL(clicked()), qApp, SLOT(quit())); writeButton = new QPushButton(tr("Write")); connect(writeButton, SIGNAL(clicked()), this, SLOT(write())); file = new QLabel(tr("File")); device = new QLabel(tr("Device")); version = new QLabel(QString("SUSE Studio Imagewriter %1").arg(APP_VERSION)); buttonLayout = new QHBoxLayout; buttonLayout->addWidget(exitButton); buttonLayout->addWidget(writeButton); fileSelectLayout = new QHBoxLayout; fileSelectLayout->addWidget(fileLine); fileSelectLayout->addWidget(fileSelectButton); mainLayout = new QGridLayout; mainLayout->addWidget(file, 0, 0); mainLayout->addLayout(fileSelectLayout, 0, 1); mainLayout->addWidget(device, 1, 0); mainLayout->addWidget(deviceComboBox, 1, 1); mainLayout->addLayout(buttonLayout, 2, 0, Qt::AlignRight); setLayout(mainLayout); if (!mMaximized) resize(600,170); #endif return; }
// Main function int main( void ) { char command[MAXLENGTH]; char c; /******************************************************************** * YOU WILL NEED TO COMPLETE THE FOLLOWING SECTION FOR STAGES 2 - 5 * *******************************************************************/ printPrompt(); while( fgets( command, MAXLENGTH, stdin ) != NULL ) { int imgNum; char *p; if(( p=strrchr( command, '\n')) != NULL ) { *p = '\0'; // remove '\n' at end of line } // find the first non-space character in the command p = command; while(isspace(*p)) { p++; } c = tolower(*p); if( isdigit(c)) // Command k { if( sscanf( command, "%d", &imgNum ) == 1 ) { //Checks to see if there's images in the album. if(first != NULL) { //Retrieves the image. found = getCurrentImage(first); found2 = selectImage(found, imgNum); //Checks to see if the requested image exist in the album. if(found2 != NULL) { found->current = FALSE; found2->current = TRUE; printNodeInfos(found2); last_action = 'k'; location = found->index; //Index of the previous image found = NULL; found2 = NULL; } } } } else switch( c ) { case 'h': // help printf(" A - Add image\n" ); printf(" I - Index\n" ); printf(" P - Print image\n" ); printf(" F - Forward\n" ); printf(" B - Back\n" ); printf("<k>- make image number k the current image\n"); printf(" D - Delete image\n" ); printf(" L - Look for image\n" ); printf(" R - Rotate image counterclockwise\n" ); printf(" M - Mirror image (reflect vertically)\n" ); printf("NE - zoom into North East corner\n" ); printf("NW - zoom into North West corner\n" ); printf("SW - zoom into South West corner\n" ); printf("SE - zoom into South East corner\n" ); printf(" O - zoom Out\n" ); printf(" U - Undo\n" ); printf(" H - Help\n" ); printf(" Q - Quit\n" ); break; // INSERT CODE FOR OTHER COMMANDS case 'a': p++; //Moves cursor away from 'a' while(isspace(*p)) { p++; } int *dim; QTnode* qt = getImage(p, dim); if(qt != NULL) { insertNode(qt, dim, p); printNodeInfos(getCurrentImage(first)); //Whenever a node is added, it becomes the selected node } last_action = 'a'; break; case 'i': if(first != NULL) { printIndex(first); } break; case 'p': { ListNode* currentImage = getCurrentImage(first); if(currentImage != NULL) { printImage(currentImage->image, currentImage->size); } break; } case 'f': { ListNode* currentImage = getCurrentImage(first); if(currentImage != NULL && (currentImage->next != NULL)) { currentImage->current = FALSE; currentImage = currentImage->next; currentImage->current = TRUE; printNodeInfos(currentImage); last_action = 'f'; } break; } case 'b': { ListNode* currentImage = getCurrentImage(first); if(currentImage != NULL && (currentImage->previous != NULL)) { currentImage->current = FALSE; currentImage = currentImage->previous; currentImage->current = TRUE; printNodeInfos(currentImage); last_action = 'b'; } break; } //'K' command is treated in the upper portion of the code case 'd': removeNode(); if(first != NULL) { printNodeInfos(getCurrentImage(first)); } last_action = 'd'; break; case 'l': if(first != NULL) { p++; //Moves cursor away from 'a' while(isspace(*p)) { p++; } ListNode* foundImage = findBySubString(first, p); //Image with the substring was found if(foundImage != NULL) { ListNode* currentImage = getCurrentImage(first); currentImage->current = FALSE; foundImage->current = TRUE; printNodeInfos(getCurrentImage(first)); last_action = 'l'; location = currentImage->index; } } break; case 'r': { ListNode* currentImage = getCurrentImage(first); if(currentImage != NULL) { rotateImage(currentImage->image); printImage(currentImage->image, currentImage->size); } last_action = 'r'; break; } case 'm': { ListNode* currentImage = getCurrentImage(first); if(currentImage != NULL) { mirrorImage(currentImage->image); printImage(currentImage->image, currentImage->size); } last_action = 'm'; break; } case 'n': { ListNode* currentImage = getCurrentImage(first); if(currentImage == NULL) { break; } //This line gets the next character of the command, so it can be //treated accordingly. char c2 = *(++p); //Dereferencing the pointer and moving it to the next char of the string if(c2 == 'e') { if(currentImage->image->ne == NULL) { break; } currentImage->image = currentImage->image->ne; printImage(currentImage->image, currentImage->size); last_action = 'w'; //because "ne" does not work, find a letter that is not used location = 'w'; } else if(c2 == 'w') { if(currentImage->image->nw == NULL) { break; } currentImage->image = currentImage->image->nw; printImage(currentImage->image, currentImage->size); last_action = 'x'; location = 'x'; } break; } case 's': { ListNode* currentImage = getCurrentImage(first); if(currentImage == NULL) { break; } //This line gets the next character of the command, so it can be //treated accordingly. char c2 = *(++p); //Dereferencing the pointer and moving it to the next char of the string if(c2 == 'e') { if(currentImage->image->se == NULL) { break; } currentImage->image = currentImage->image->se; printImage(currentImage->image, currentImage->size); last_action = 'y'; location = 'y'; } else if(c2 == 'w') { if(currentImage->image->sw == NULL) { break; } currentImage->image = currentImage->image->sw; printImage(currentImage->image, currentImage->size); last_action = 'z'; location = 'z'; } break; } case 'o': { ListNode* currentImage = getCurrentImage(first); if(currentImage == NULL || (currentImage->image->out == NULL)) { break; } currentImage->image = currentImage->image->out; printImage(currentImage->image, currentImage->size); last_action = 'o'; break; } case 'u': if(last_action == 'm'){ ListNode* currentImage = getCurrentImage(first); if(currentImage != NULL) { mirrorImage(currentImage->image); printImage(currentImage->image, currentImage->size); } break; } else if(last_action == 'r'){ ListNode* currentImage = getCurrentImage(first); if(currentImage != NULL) { rotateImage(currentImage->image); rotateImage(currentImage->image); rotateImage(currentImage->image); printImage(currentImage->image, currentImage->size); break; } } else if(last_action == 'a'){ removeNode(); if(first != NULL) { printNodeInfos(getCurrentImage(first)); } break; } else if(last_action == 'd'){ //todo me no smart break; } else if(last_action == 'w' || (last_action == 'x') || (last_action == 'y') || (last_action == 'z')){ ListNode* currentImage = getCurrentImage(first); if(currentImage == NULL || (currentImage->image->out == NULL)) { break; } currentImage->image = currentImage->image->out; printImage(currentImage->image, currentImage->size); break; } else if(last_action == 'o'){ ListNode* currentImage = getCurrentImage(first); if(location == 'w') { if(currentImage->image->ne == NULL) { break; } currentImage->image = currentImage->image->ne; printImage(currentImage->image, currentImage->size); break; } else if(location == 'x') { if(currentImage->image->nw == NULL) { break; } currentImage->image = currentImage->image->nw; printImage(currentImage->image, currentImage->size); break; } else if(location == 'y') { if(currentImage->image->se == NULL) { break; } currentImage->image = currentImage->image->se; printImage(currentImage->image, currentImage->size); break; } else if(location == 'z') { if(currentImage->image->sw == NULL) { break; } currentImage->image = currentImage->image->sw; printImage(currentImage->image, currentImage->size); break; } } else if(last_action == 'b'){ ListNode* currentImage = getCurrentImage(first); if(currentImage != NULL && (currentImage->next != NULL)) { currentImage->current = FALSE; currentImage = currentImage->next; currentImage->current = TRUE; printNodeInfos(currentImage); } break; } else if(last_action == 'f'){ ListNode* currentImage = getCurrentImage(first); if(currentImage != NULL && (currentImage->previous != NULL)) { currentImage->current = FALSE; currentImage = currentImage->previous; currentImage->current = TRUE; printNodeInfos(currentImage); } break; } else if(last_action == 'k' || (last_action == 'l')){ //Retrieves the image. found = getCurrentImage(first); found2 = selectImage(found, location); //Checks to see if the requested image exist in the album. if(found2 != NULL) { found->current = FALSE; found2->current = TRUE; printNodeInfos(found2); found = NULL; found2 = NULL; } break; } case 'q': // quit program printf("Bye!\n"); return 0; break; default: printf("Unrecognized command: %s\n", command ); break; } printPrompt(); } return 0; }
// Validate Values on change connect(ui.tableResources, SIGNAL(itemChanged( QTableWidgetItem* )), this, SLOT(validateValues())); connect(ui.tableModifiers, SIGNAL(itemChanged( QTableWidgetItem* )), this, SLOT(validateValues())); // Connect Change Listener connect(ui.editCardName, SIGNAL(editingFinished()), this, SLOT(somethingChanged())); connect(ui.spinDamageOpponent, SIGNAL(valueChanged(int)), this, SLOT(somethingChanged())); connect(ui.spinDamageSelf, SIGNAL(valueChanged(int)), this, SLOT(somethingChanged())); connect(ui.checkAddTurn, SIGNAL(clicked()), this, SLOT(somethingChanged())); connect(ui.checkDiscard, SIGNAL(clicked()), this, SLOT(somethingChanged())); connect(ui.checkNotDiscardable, SIGNAL(clicked()), this, SLOT(somethingChanged())); connect(ui.tableResources, SIGNAL(itemDoubleClicked( QTableWidgetItem* )), this, SLOT(somethingChanged())); connect(ui.tableModifiers, SIGNAL(itemDoubleClicked( QTableWidgetItem* )), this, SLOT(somethingChanged())); connect(ui.buttonRemoveCard, SIGNAL(clicked()), this, SLOT(removeCard())); connect(ui.buttonAddCard, SIGNAL(clicked()), this, SLOT(addCard())); connect(ui.buttonOpenImage, SIGNAL(clicked()), this, SLOT(selectImage())); } // ----------------------------------------------------------------------------- void CardEditor::populateTree() { // If we're simply loading a new Project, refresh the view if(!ui.cardList->size().isEmpty()) { ui.cardList->clear(); reset(); } // Populate List int i = 0; foreach(Arcomage::Card* c, cards) { addCardToList(c, i); i++;
ImageUploadDialog::ImageUploadDialog(QWidget *parent) : QDialog(parent), ui(new Ui::ImageUploadDialog){ ui->setupUi(this); connect(ui->pushButtonChoose, SIGNAL(clicked()), this, SLOT(selectImage())); connect(ui->pushButtonTest, SIGNAL(clicked()), this, SLOT(testImage())); }