void MainWindow::updateImage(int current) { //clear image ui_.image->setPixmap(QPixmap()); //update index current_ = current; if (current_==images_.count()) return; //reset file watcher watcher_.clearFile(); //update image pixmap_ = images_[current_].pixmap(); updateImageSize(); //set file watcher watcher_.setFile(images_[current_].filename()); //status bar ui_.statusBar->showMessage(images_[current_].filename() + " (" + QString::number(current_+1) + "\\" + QString::number(images_.count()) + ")"); //cache/uncache images clearCache(current_-3); cache(current_-2); cache(current_-1); cache(current_+1); cache(current_+2); clearCache(current_+3); }
ToolbarButton::ToolbarButton(ImageManager& im, std::string _filename, int x, int y, pixelType _pixelTypeToSelect, bool _displayed): filename(_filename), pixelTypeToSelect(_pixelTypeToSelect), displayed(_displayed){ center.x = x; center.y = y; updateImageSize(im); updateSizeAndHalfsize(); hasText = false; }
Gui::Gui ( int argc, char** argv, QWidget *parent ) : QMainWindow ( parent ), ui ( new Ui::Gui ) { ui->setupUi ( this ); cvWindow = new CvWindow ( QString ( "cvWindow" ), CV_WINDOW_AUTOSIZE ); // set the location of 'cvWindow' cvWindow->setParent ( ui->frame ); readSettings(); social_robot_gui = new SocialRobotGui ( argc, argv ); qRegisterMetaType< Mat > ( "Mat" ); connect ( social_robot_gui, SIGNAL ( update_image ( Mat ) ), this, SLOT ( updateImage ( Mat ) ) ); social_robot_gui->init(); // If the frame resizes, update the image size connect ( ui->frame, SIGNAL ( resizeImage ( QSize ) ), this, SLOT ( updateImageSize ( QSize ) ) ); updateImageSize ( ui->frame->size() ); }
void MainWindow::on_actionRotateLeft_triggered(bool) { //no nothing without images if (images_.count()==0) return; //transform image QTransform transform; transform.rotate(270); pixmap_ = pixmap_.transformed(transform); //store it storeCurrentImage(false); //update GUI updateImageSize(); }
void MainWindow::on_actionResize_triggered(bool) { //no nothing without images if (images_.count()==0) return; //show dialog ResizeDialog dlg(this); dlg.setSize(pixmap_.width(), pixmap_.height()); if (dlg.exec()!=QDialog::Accepted) return; //transform image pixmap_ = pixmap_.scaled(dlg.width(), dlg.height(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation); //store it storeCurrentImage(true); //update GUI updateImageSize(); }
K3bIsoImageWritingDialog::K3bIsoImageWritingDialog( QWidget* parent, const char* name, bool modal ) : K3bInteractionDialog( parent, name, i18n("Burn Iso9660 Image"), i18n("to DVD"), START_BUTTON|CANCEL_BUTTON, START_BUTTON, "DVD image writing", modal ) { d = new Private(); setAcceptDrops(true); setupGui(); m_writerSelectionWidget->setWantedMediumType( K3bDevice::MEDIA_WRITABLE_DVD ); m_writerSelectionWidget->setWantedMediumState( K3bDevice::STATE_EMPTY ); m_writerSelectionWidget->setSupportedWritingApps( K3b::GROWISOFS ); m_writingModeWidget->setSupportedModes( K3b::DAO|K3b::WRITING_MODE_INCR_SEQ|K3b::WRITING_MODE_RES_OVWR ); m_md5Job = new K3bMd5Job( 0, this ); connect( m_md5Job, SIGNAL(finished(bool)), this, SLOT(slotMd5JobFinished(bool)) ); connect( m_md5Job, SIGNAL(percent(int)), this, SLOT(slotMd5JobPercent(int)) ); updateImageSize( imagePath() ); connect( m_writerSelectionWidget, SIGNAL(writerChanged()), this, SLOT(slotWriterChanged()) ); connect( m_writerSelectionWidget, SIGNAL(writingAppChanged(int)), this, SLOT(slotWriterChanged()) ); connect( m_writingModeWidget, SIGNAL(writingModeChanged(int)), this, SLOT(slotWriterChanged()) ); connect( m_editImagePath, SIGNAL(textChanged(const QString&)), this, SLOT(updateImageSize(const QString&)) ); connect( m_checkDummy, SIGNAL(toggled(bool)), this, SLOT(slotWriterChanged()) ); }
MainWindow::MainWindow(QWidget* parent) : QMainWindow(parent) , ui_() , images_() , timer_() { ui_.setupUi(this); setWindowTitle(QApplication::applicationName()); setWindowState(Qt::WindowMaximized); //set reload action group QActionGroup* group = new QActionGroup(this); group->addAction(ui_.actionReloadAsk); group->addAction(ui_.actionReloadNo); group->addAction(ui_.actionReloadAuto); ui_.actionReloadAuto->setChecked(true); //init file watcher watcher_.setDelayInSeconds(0.001); connect(&watcher_, SIGNAL(fileChanged()), this, SLOT(reloadFile())); //start timer for image size update connect(&timer_, SIGNAL(timeout()), this, SLOT(updateImageSize())); timer_.start(250); //init images QStringList args = QApplication::arguments(); if (args.count()>1 && QFile::exists(args[1])) { QFileInfo file_info(args[1]); updateImageList(file_info.canonicalPath(), file_info.fileName()); } else { updateImageList(Settings::path("folder")); } }