MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent),ui(new Ui::MainWindow),options(new channelOptions(this)),modOptions(new moduleDialog(this)),serialPortOpt(new serialPortOptions(this)),thePlaylist(new playlist(this))//thePlayer(new QMediaPlayer), { thePlayer = NULL; ui->setupUi(this); playbackRate=1; serialPortName="COM3"; //serialPortName="/dev/ttyUSB0"; //thePort.setPortName("/dev/ttyACM0"); thePort.setPortName(serialPortName); thePort.setBaudRate(QSerialPort::Baud9600); serialOutputOn=0; connect(ui->label_2,SIGNAL(playScroll(int)),ui->horizontalScrollBar,SLOT(setValue(int))); connect(ui->label_2,SIGNAL(trackSelected(uint,QColor)),this,SLOT(channelSelected(uint,QColor))); connect(ui->label_2,SIGNAL(updatePicture(binaryTrack)),ui->label,SLOT(whatToLightUp(binaryTrack))); connect(ui->label_2,SIGNAL(updatePicture(binaryTrack)),this,SLOT(writeToSerialPort(binaryTrack))); connect(ui->actionExit,SIGNAL(triggered()),this,SLOT(close())); connect(options,SIGNAL(removeChannel(int)),this,SLOT(removeChannel(int))); connect(options,SIGNAL(theColorChanged(uint,QColor)),this,SLOT(channelColorHasChanged(uint,QColor))); connect(options,SIGNAL(changeEditMode(bool)),ui->label,SLOT(changeEditMode(bool))); connect(options,SIGNAL(channelEnableButtonPushed(int,bool)),this,SLOT(channelEnabledButtonPushed(int,bool))); connect(serialPortOpt,SIGNAL(setNewSerialPort(QString)),this,SLOT(serialPortNameChanged(QString))); connect(thePlaylist,SIGNAL(changeSong(QString)),this,SLOT(playlistChangeSong(QString))); tempTrackCount=0; }
void MainWindow::previousImage() { theCurImageIndex = (theCurImageIndex - 1); if (theCurImageIndex == -1) theCurImageIndex = theImageFiles.count() - 1; updatePicture(); }
void PicturePile::updatePicturesIfNeeded(PicturePainter* painter) { applyWebkitInvals(); for (size_t i = 0; i < m_pile.size(); i++) { PictureContainer& pc = m_pile[i]; if (pc.dirty) updatePicture(painter, pc); } }
void gTrayIcon::setVisible(bool vl) { if (vl) { if (!plug) { _loopLevel = gApplication::loopLevel() + 1; plug = gtk_status_icon_new(); updatePicture(); updateTooltip(); #ifdef GDK_WINDOWING_X11 // Needed, otherwise the icon does not appear in Gnome or XFCE notification area! XSizeHints hints; hints.flags = PMinSize; hints.min_width = _iconw; hints.min_height = _iconh; XSetWMNormalHints(gdk_x11_display_get_xdisplay(gdk_display_get_default()), gtk_status_icon_get_x11_window_id(plug), &hints); #endif gtk_status_icon_set_visible(plug, TRUE); //g_signal_connect(G_OBJECT(plug), "destroy", G_CALLBACK(cb_destroy),(gpointer)this); g_signal_connect(G_OBJECT(plug), "button-press-event", G_CALLBACK(cb_button_press), (gpointer)this); g_signal_connect(G_OBJECT(plug), "button-release-event", G_CALLBACK(cb_button_release),(gpointer)this); //g_signal_connect(G_OBJECT(plug), "activate", G_CALLBACK(cb_activate),(gpointer)this); //g_signal_connect(G_OBJECT(plug),"focus-in-event",G_CALLBACK(tray_focus_In),(gpointer)this); //g_signal_connect(G_OBJECT(plug),"focus-out-event",G_CALLBACK(tray_focus_Out),(gpointer)this); //g_signal_connect(G_OBJECT(plug),"enter-notify-event",G_CALLBACK(tray_enterleave),(gpointer)this); //g_signal_connect(G_OBJECT(plug),"leave-notify-event",G_CALLBACK(tray_enterleave),(gpointer)this); g_signal_connect(G_OBJECT(plug), "popup-menu", G_CALLBACK(cb_menu), (gpointer)this); g_signal_connect(G_OBJECT(plug), "scroll-event", G_CALLBACK(cb_scroll), (gpointer)this); //g_signal_connect(G_OBJECT(plug),"expose-event", G_CALLBACK(cb_expose), (gpointer)this); _visible_count++; usleep(10000); // BUG: Embedding too fast sometimes fails with GTK+ } } else { if (plug) { GB.Post((void (*)())hide_icon, (intptr_t)plug); plug = NULL; _visible_count--; } } }
void PokeEdit::changeShiny(bool shiny) { if (shiny == poke().shiny()) { return; } if (poke().gen().num == 2) { if (shiny) { poke().setDV(Speed, 10); poke().setDV(Attack, 15); poke().setDV(Defense, 10); poke().setDV(SpAttack, 10); } else { poke().setDV(Speed, 15); poke().setDV(Attack, 15); poke().setDV(SpAttack, 15); } updateStats(); ui->ivbox->updateAll(); } else { poke().shiny() = shiny; } updatePicture(); }
void MainWindow::loadImagePath(QString imagePath) { if (imagePath.isEmpty()) { qDebug() << __PRETTY_FUNCTION__ << "called with an empty string directory"; return; } theImagePath = imagePath; QStringList filters; filters << "*.jpg" << "*.jpeg" << "*.png" << "*.bmp" << "*.ppm" << "*.xbm" << "*.xpm"; QDir fileListing(imagePath); if (!fileListing.exists()) { QMessageBox::critical(this, "Directory Does Not Exist", QString("Path %1 does not exist").arg(imagePath)); return; } theImageFiles = fileListing.entryList(filters, QDir::Files | QDir::NoDotAndDotDot,QDir::Name); qDebug() << "Scanning the direcotry " << fileListing.absolutePath() << " for files"; qDebug() << "Found the follwoing files: " << theImageFiles; if (fileListing.count() == 0) { QMessageBox::critical(this, "No images found", QString("Path %1 does not have any images").arg(imagePath)); return; } theCurImageIndex = 0; updatePicture(); ui->theImagesFoundLabel->setText(QString("Images Found: %1").arg(theImageFiles.count())); }
PokeEdit::PokeEdit(TeamBuilderWidget *master, PokeTeam *poke, QAbstractItemModel *pokeModel, QAbstractItemModel *itemsModel, QAbstractItemModel *natureModel) : ui(new Ui::PokeEdit), pokemonModel(pokeModel), m_poke(poke), master(master) { ui->setupUi(this); ui->itemSprite->raise(); ui->item->setModel(itemsModel); ui->nature->setModel(natureModel); ui->levelSettings->setPoke(poke); ui->evbox->setPoke(poke); ui->ivbox->setPoke(poke); if (0) { master->getDock(EVDock)->setWidget(ui->evbox); master->getDock(IVDock)->setWidget(ui->ivbox); master->getDock(LevelDock)->setWidget(ui->levelSettings); master->getDock(MoveDock)->setWidget(ui->moveContainer); } else { QCloseDockWidget *hi = new QCloseDockWidget(tr("Advanced"), this); hi->setObjectName("AdvancedTab"); hi->setWidget(ui->ivbox); hi->setFeatures(QDockWidget::DockWidgetClosable|QDockWidget::DockWidgetMovable); ui->horizontalMove->addWidget(hi); if (advancedWindowClosed) { hi->close(); } connect(hi, SIGNAL(closed()), SIGNAL(closeAdvanced())); // QDockWidget *hi2 = new QDockWidget(tr("Level"), this); // hi2->setWidget(ui->levelSettings); // hi2->setFeatures(QDockWidget::DockWidgetClosable|QDockWidget::DockWidgetMovable); // ui->horizontalPoke->addWidget(hi2); } QSortFilterProxyModel *pokeFilter = new QSortFilterProxyModel(this); pokeFilter->setFilterRegExp("."); pokeFilter->setSourceModel(pokemonModel); QCompleter *completer = new QCompleter(pokeFilter, ui->nickname); completer->setCompletionColumn(1); completer->setCompletionRole(Qt::DisplayRole); completer->setCaseSensitivity(Qt::CaseInsensitive); completer->setCompletionMode(QCompleter::PopupCompletion); ui->nickname->setCompleter(completer); connect(completer, SIGNAL(activated(QString)), SLOT(setNum(QString))); /* 20 characters for the name. Longest name: Vivillon-Archipelago = 20 characters */ ui->nickname->setValidator(new QNickValidator(ui->nickname, 20)); fillMoves(); connect(ui->levelSettings, SIGNAL(levelUpdated()), this, SLOT(updateStats())); connect(ui->levelSettings, SIGNAL(levelUpdated()), ui->ivbox, SLOT(updateStats())); connect(ui->levelSettings, SIGNAL(genderUpdated()), this, SLOT(updatePicture())); connect(ui->levelSettings, SIGNAL(genderUpdated()), this, SLOT(updateGender())); connect(ui->ivbox, SIGNAL(genderUpdated()), SLOT(updateGender())); connect(ui->ivbox, SIGNAL(genderUpdated()), ui->levelSettings, SLOT(updateGender())); connect(ui->ivbox, SIGNAL(shinyUpdated()), SLOT(updatePicture())); connect(ui->happiness, SIGNAL(valueChanged(int)), this, SLOT(changeHappiness(int))); connect(ui->nature, SIGNAL(currentIndexChanged(int)), this, SLOT(changeNature(int))); connect(ui->item, SIGNAL(currentIndexChanged(QString)), this, SLOT(changeItem(QString))); connect(ui->evbox, SIGNAL(natureChanged(int)), this, SLOT(setNature(int))); connect(ui->evbox, SIGNAL(natureBoostChanged()), ui->ivbox, SLOT(updateStats())); connect(ui->ivbox, SIGNAL(statsUpdated()), ui->evbox, SLOT(updateEVs())); updateAll(); }
PokeEdit::PokeEdit(PokeTeam *poke, QAbstractItemModel *pokeModel, QAbstractItemModel *itemsModel, QAbstractItemModel *natureModel) : ui(new Ui::PokeEdit), pokemonModel(pokeModel), m_poke(poke) { ui->setupUi(this); ui->itemSprite->raise(); ui->item->setModel(itemsModel); ui->nature->setModel(natureModel); ui->levelSettings->setPoke(poke); ui->evbox->setPoke(poke); ui->ivbox->setPoke(poke); movesModel = new PokeMovesModel(poke->num(), poke->gen(), this); QSortFilterProxyModel *filter = new QSortFilterProxyModel(this); filter->setSourceModel(movesModel); ui->moveChoice->setModel(filter); ui->moveChoice->horizontalHeader()->setResizeMode(PokeMovesModel::PP, QHeaderView::ResizeToContents); ui->moveChoice->horizontalHeader()->setResizeMode(PokeMovesModel::Pow, QHeaderView::ResizeToContents); ui->moveChoice->horizontalHeader()->setResizeMode(PokeMovesModel::Acc, QHeaderView::ResizeToContents); ui->moveChoice->horizontalHeader()->setResizeMode(PokeMovesModel::Name, QHeaderView::Fixed); ui->moveChoice->horizontalHeader()->resizeSection(PokeMovesModel::Name, 125); ui->moveChoice->horizontalHeader()->resizeSection(PokeMovesModel::Type, Theme::TypePicture(Type::Normal).width()+5); ui->moveChoice->setIconSize(Theme::TypePicture(Type::Normal).size()); ui->moveChoice->sortByColumn(PokeMovesModel::Name, Qt::AscendingOrder); m_moves[0] = ui->move1; m_moves[1] = ui->move2; m_moves[2] = ui->move3; m_moves[3] = ui->move4; connect(ui->speciesLabel, SIGNAL(clicked()), SLOT(on_pokemonFrame_clicked())); connect(ui->moveChoice, SIGNAL(activated(QModelIndex)), SLOT(moveEntered(QModelIndex))); /* the four move choice items */ for (int i = 0; i < 4; i++) { QCompleter *completer = new QCompleter(m_moves[i]); completer->setModel(ui->moveChoice->model()); completer->setCompletionColumn(PokeMovesModel::Name); completer->setCaseSensitivity(Qt::CaseInsensitive); completer->setCompletionMode(QCompleter::PopupCompletion); completer->setCompletionRole(Qt::DisplayRole); m_moves[i]->setCompleter(completer); completer->setProperty("move", i); m_moves[i]->setProperty("move", i); connect(completer, SIGNAL(activated(QString)), SLOT(changeMove())); connect(m_moves[i], SIGNAL(returnPressed()), SLOT(changeMove())); connect(m_moves[i], SIGNAL(editingFinished()), SLOT(changeMove())); } connect(ui->levelSettings, SIGNAL(levelUpdated()), this, SLOT(updateStats())); connect(ui->levelSettings, SIGNAL(levelUpdated()), ui->ivbox, SLOT(updateStats())); connect(ui->levelSettings, SIGNAL(shinyUpdated()), this, SLOT(updatePicture())); connect(ui->levelSettings, SIGNAL(genderUpdated()), this, SLOT(updatePicture())); connect(ui->levelSettings, SIGNAL(genderUpdated()), this, SLOT(updateGender())); connect(ui->ivbox, SIGNAL(genderUpdated()), SLOT(updateGender())); connect(ui->ivbox, SIGNAL(genderUpdated()), ui->levelSettings, SLOT(updateGender())); connect(ui->ivbox, SIGNAL(shinyUpdated()), SLOT(updatePicture())); connect(ui->ivbox, SIGNAL(shinyUpdated()), ui->levelSettings, SLOT(updateShiny())); connect(ui->happiness, SIGNAL(valueChanged(int)), this, SLOT(changeHappiness(int))); connect(ui->nature, SIGNAL(currentIndexChanged(int)), this, SLOT(changeNature(int))); connect(ui->item, SIGNAL(currentIndexChanged(QString)), this, SLOT(changeItem(QString))); connect(ui->evbox, SIGNAL(natureChanged(int)), this, SLOT(setNature(int))); connect(ui->evbox, SIGNAL(natureBoostChanged()), ui->ivbox, SLOT(updateStats())); connect(ui->ivbox, SIGNAL(statsUpdated()), ui->evbox, SLOT(updateEVs())); updateAll(); }
void gTrayIcon::setPicture(gPicture *picture) { gPicture::assign(&_icon, picture); updatePicture(); }
void MainWindow::nextImage() { theCurImageIndex = (theCurImageIndex + 1) % theImageFiles.count(); updatePicture(); }
void ChessBoardPiece::setColor(CBW::WidgetColor color) { this->_color = color; updatePicture(); }
void ChessBoardPiece::setType(CBW::WidgetType type) { this->_type = type; updatePicture(); }