void CameraMainWindow::updateActions() { bool p=false,v=false; QWidget *foc = focusWidget(); if ( foc == camera->photo ) { p = true; v = false; } else if ( foc == camera->video ) { v = true; p = false; } if(a_pview) a_pview->setVisible(p); if(a_timer) a_timer->setVisible(p); if ( video_supported && a_vview ) a_vview->setVisible(v); //a_settings->setVisible(p || v); bool th=!p && !v; if ( th ) { int i; for (i=0; i<nthumb; i++) { if ( thumb[i] == foc ) { selectThumb(i); break; } } if ( i==nthumb || thumb[i]->icon().isNull() ) selectThumb(-1); } else { selectThumb(-1); } }
void CameraMainWindow::delThumb() { if ( cur_thumb >= 0 ) { int d = cur_thumb; bool ret = delThumb(d); if ( cur_thumb > 0 && ret ) selectThumb(cur_thumb-1); } }
void CameraMainWindow::loadThumbs( bool resized ) { int i = 0; showWaitScreen(); for (; i < nthumb && i < m_photoModel->rowCount(); ++i) { QContent content = m_photoModel->content(i); if (resized || picturefile[i].id() != content.id() || picturefile[i].lastUpdated() != content.lastUpdated()) { picturefile[i] = content; thumb[i]->setIcon(QThumbnail(picturefile[i].fileName()).pixmap(QSize(thumbw, thumbh))); thumb[i]->setEnabled(true); } } for (; i < nthumb; ++i) { picturefile[i] = QContent(); thumb[i]->setIcon(QIcon()); thumb[i]->setEnabled(false); } if ( cur_thumb >= 0 ) selectThumb(cur_thumb); if ( !camera->videocaptureview->available() ) { if(settings) a_timer->setVisible(false); camera->photo->setEnabled(false); camera->video->setEnabled(false); if (m_photoModel->rowCount() == 0) { thumb[0]->setEnabled(false); } else { thumb[0]->setFocus(); thumb[0]->setEnabled(true); } } if(settings) updateActions(); hideWaitScreen(); }
FolderSettingDialog::FolderSettingDialog(QObject *parentw, XMLSettingsManager* manager) { //Initialize objects parentWindow = parentw; selectDestLabel = new QLabel(QObject::trUtf8("Select Destination")); selectThumbLabel = new QLabel(QObject::trUtf8("Select Thumbnail")); renameLabel = new QLabel(QObject::trUtf8("File prefix")); digitsLabel = new QLabel(QObject::trUtf8("Digits")); selectDestBtn = new QPushButton("..."); selectThumbBtn = new QPushButton("..."); clearThumbBtn = new QPushButton(QObject::trUtf8("Clear")); confirmBtn = new QPushButton(QObject::trUtf8("Confirm")); cancelBtn = new QPushButton(QObject::trUtf8("Cancel")); //folderRadioBtn = new QRadioButton(QObject::trUtf8("Folder")); //zipRadioBtn = new QRadioButton(QObject::trUtf8("Zip file")); renameCheck = new QCheckBox(QObject::trUtf8("Enable")); renamingOptions = new QGroupBox(QObject::trUtf8("Renaming Rules")); destEdit = new QLineEdit(); thumbEdit = new QLineEdit(); renameEdit = new QLineEdit(); digitsSpin = new QSpinBox(); //radioLayout = new QHBoxLayout(); layout = new QGridLayout(); renameLayout = new QGridLayout(); //destDlg = new QFileDialog(this,QObject::trUtf8("Select Destination")); //thumbDlg = new QFileDialog(this,QObject::trUtf8("Select Thumbnail")); //Arrange layout selectDestBtn->setMaximumWidth(60); selectThumbBtn->setMaximumWidth(60); clearThumbBtn->setMaximumWidth(60); //radioLayout->setAlignment(Qt::AlignHCenter); //radioLayout->addWidget(folderRadioBtn); //radioLayout->addWidget(zipRadioBtn); //layout->addLayout(radioLayout,0,0,1,12); layout->addWidget(selectDestLabel,1,0,1,12); layout->addWidget(destEdit,2,0,1,11); layout->addWidget(selectDestBtn,2,11,1,1); layout->addWidget(selectThumbLabel,3,0,1,12); layout->addWidget(thumbEdit,4,0,1,10); layout->addWidget(selectThumbBtn,4,10,1,1); layout->addWidget(clearThumbBtn,4,11,1,1); renameLayout->addWidget(renameCheck,0,0,1,4); renameLayout->addWidget(renameLabel,1,0,1,1); renameLayout->addWidget(renameEdit,1,1,1,2); renameLayout->addWidget(digitsLabel,2,0,1,1); renameLayout->addWidget(digitsSpin,2,1,1,2); renamingOptions->setLayout(renameLayout); layout->addWidget(renamingOptions,5,0,3,12); layout->addWidget(confirmBtn,8,0,1,6); layout->addWidget(cancelBtn,8,6,1,6); this->setLayout(layout); //Connect slots and signals //QObject::connect(folderRadioBtn,SIGNAL(toggled(bool)),this,SLOT(setDestFolderMode(bool))); //QObject::connect(zipRadioBtn,SIGNAL(toggled(bool)),this,SLOT(setDestZipMode(bool))); QObject::connect(selectDestBtn,SIGNAL(clicked()),this,SLOT(selectDest())); QObject::connect(selectThumbBtn,SIGNAL(clicked()),this,SLOT(selectThumb())); QObject::connect(clearThumbBtn,SIGNAL(clicked()),thumbEdit,SLOT(clear())); //QObject::connect(destDlg,SIGNAL(fileSelected(QString)),this,SLOT(setDest(QString))); //QObject::connect(thumbDlg,SIGNAL(fileSelected(QString)),this,SLOT(setThumb(QString))); QObject::connect(confirmBtn,SIGNAL(clicked()),this,SLOT(accept())); QObject::connect(cancelBtn,SIGNAL(clicked()),this,SLOT(close())); QObject::connect(renameCheck,SIGNAL(toggled(bool)),digitsSpin,SLOT(setEnabled(bool))); QObject::connect(renameCheck,SIGNAL(toggled(bool)),renameEdit,SLOT(setEnabled(bool))); xmlManager = manager; this->setModal(true); this->setWindowFlags(Qt::X11BypassWindowManagerHint); this->setWindowFlags(Qt::WindowStaysOnTopHint); this->setWindowTitle(QObject::trUtf8("Folder Setting")); this->setFixedSize(300,350); }
void ThumbnailWidget::toggleSelection() { selectThumb(!isThumbSelected()); update(); }
void CameraMainWindow::thumbClicked(int i) { selectThumb(i); }