RawCameraDlg::RawCameraDlg(QWidget* const parent) : InfoDlg(parent), d(new Private) { setWindowTitle(i18n("List of supported RAW cameras")); QStringList list = RawEngine::DRawDecoder::supportedCamera(); // -------------------------------------------------------- d->header = new QLabel(this); d->searchBar = new SearchTextBar(this, QLatin1String("RawCameraDlgSearchBar")); updateHeader(); listView()->setColumnCount(1); listView()->setHeaderLabels(QStringList() << QLatin1String("Camera Model")); // Header is hidden. No i18n here. listView()->header()->hide(); for (QStringList::const_iterator it = list.constBegin() ; it != list.constEnd() ; ++it) { new QTreeWidgetItem(listView(), QStringList() << *it); } // -------------------------------------------------------- QGridLayout* const grid = dynamic_cast<QGridLayout*>(mainWidget()->layout()); grid->addWidget(d->header, 1, 0, 1, -1); grid->addWidget(d->searchBar, 3, 0, 1, -1); // -------------------------------------------------------- connect(d->searchBar, SIGNAL(signalSearchTextSettings(SearchTextSettings)), this, SLOT(slotSearchTextChanged(SearchTextSettings))); }
void SearchTextBar::setFilterModel(AlbumFilterModel* filterModel) { // if there already was a model, disconnect from this model if (d->filterModel) { disconnect(d->filterModel); } d->filterModel = filterModel; // connect to new model if desired if (d->filterModel) { connect(this, SIGNAL(signalSearchTextSettings(SearchTextSettings)), d->filterModel, SLOT(setSearchTextSettings(SearchTextSettings))); connect(d->filterModel, SIGNAL(hasSearchResult(bool)), this, SLOT(slotSearchResult(bool))); }
CameraSelection::CameraSelection(QWidget* const parent) : QDialog(parent), d(new Private) { qApp->setOverrideCursor(Qt::WaitCursor); setWindowTitle(i18n("Camera Configuration")); setModal(true); const int spacing = QApplication::style()->pixelMetric(QStyle::PM_DefaultLayoutSpacing); d->buttons = new QDialogButtonBox(QDialogButtonBox::Help | QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this); d->buttons->button(QDialogButtonBox::Ok)->setDefault(true); d->UMSCameraNameActual = QLatin1String("Directory Browse"); // Don't be i18n! d->UMSCameraNameShown = i18n("Mounted Camera"); d->PTPCameraNameShown = QLatin1String("USB PTP Class Camera"); d->PTPIPCameraNameShown = QLatin1String("PTP/IP Camera"); QWidget* const page = new QWidget(this); QGridLayout* mainBoxLayout = new QGridLayout(page); // -------------------------------------------------------------- d->listView = new QTreeWidget(page); d->listView->setRootIsDecorated(false); d->listView->setSelectionMode(QAbstractItemView::SingleSelection); d->listView->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); d->listView->setMinimumWidth(350); d->listView->setAllColumnsShowFocus(true); d->listView->setColumnCount(1); d->listView->setHeaderLabels(QStringList() << i18n("Camera List")); d->listView->setWhatsThis(i18n("<p>Select the camera name that you want to use here. All " "default settings on the right panel " "will be set automatically.</p><p>This list has been generated " "using the gphoto2 library installed on your computer.</p>")); d->searchBar = new SearchTextBar(page, QLatin1String("CameraSelectionSearchBar")); // -------------------------------------------------------------- QGroupBox* const titleBox = new QGroupBox(i18n("Camera Title"), page); QVBoxLayout* const gLayout1 = new QVBoxLayout(titleBox); d->titleEdit = new QLineEdit(titleBox); d->titleEdit->setWhatsThis(i18n("<p>Set here the name used in digiKam interface to " "identify this camera.</p>")); gLayout1->addWidget(d->titleEdit); gLayout1->setContentsMargins(spacing, spacing, spacing, spacing); gLayout1->setSpacing(spacing); // -------------------------------------------------------------- QGroupBox* const portPathBox = new QGroupBox(i18n("Camera Port Type"), page); QGridLayout* const gLayout2 = new QGridLayout(portPathBox); d->portButtonGroup = new QButtonGroup(portPathBox); d->portButtonGroup->setExclusive(true); d->usbButton = new QRadioButton(i18n("USB"), portPathBox); d->usbButton->setWhatsThis(i18n("<p>Select this option if your camera is connected to your " "computer using a USB cable.</p>")); d->serialButton = new QRadioButton(i18n("Serial"), portPathBox); d->serialButton->setWhatsThis(i18n("<p>Select this option if your camera is connected to your " "computer using a serial cable.</p>")); d->networkButton = new QRadioButton(i18n("Network"), portPathBox); d->networkButton->setWhatsThis(i18n("<p>Select this option if your camera is connected to your " "computer network.</p>")); d->portPathComboBox = new QComboBox(portPathBox); d->portPathComboBox->setDuplicatesEnabled(false); d->portPathComboBox->setWhatsThis(i18n("<p>Select the serial port to use on your computer here. " "This option is only required if you use a serial camera.</p>")); d->networkEdit = new QLineEdit(portPathBox); d->networkEdit->setWhatsThis(i18n("<p>Enter here the network address of your camera.</p>")); d->networkEdit->setInputMask(QLatin1String("000.000.000.000")); d->networkEdit->setText(QLatin1String("192.168.001.001")); d->portButtonGroup->addButton(d->usbButton); d->portButtonGroup->addButton(d->serialButton); d->portButtonGroup->addButton(d->networkButton); gLayout2->addWidget(d->usbButton, 0, 0, 1, 2); gLayout2->addWidget(d->serialButton, 1, 0, 1, 2); gLayout2->addWidget(d->portPathComboBox, 1, 1, 1, 2); gLayout2->addWidget(d->networkButton, 2, 0, 1, 2); gLayout2->addWidget(d->networkEdit, 2, 1, 1, 2); gLayout2->setContentsMargins(spacing, spacing, spacing, spacing); gLayout2->setSpacing(spacing); // -------------------------------------------------------------- QGroupBox* const umsMountBox = new QGroupBox(i18n("Camera Mount Path"), page); QVBoxLayout* const gLayout3 = new QVBoxLayout(umsMountBox); QLabel* const umsMountLabel = new QLabel(umsMountBox); umsMountLabel->setText(i18n("Note: only for USB/IEEE mass storage cameras.")); d->umsMountURL = new DFileSelector(umsMountBox); d->umsMountURL->setFileDlgPath(QLatin1String("/mnt/camera")); d->umsMountURL->setFileDlgMode(QFileDialog::Directory); d->umsMountURL->setWhatsThis(i18n("<p>Set here the mount path to use on your computer. This " "option is only required if you use a <b>USB Mass Storage</b> " "camera.</p>")); gLayout3->addWidget(umsMountLabel); gLayout3->addWidget(d->umsMountURL); gLayout3->setContentsMargins(spacing, spacing, spacing, spacing); gLayout3->setSpacing(spacing); // -------------------------------------------------------------- QWidget* const box2 = new QWidget(page); QGridLayout* const gLayout4 = new QGridLayout(box2); QLabel* const logo = new QLabel(box2); logo->setPixmap(QIcon::fromTheme(QLatin1String("digikam")).pixmap(QSize(48,48))); QLabel* const link = new QLabel(box2); link->setText(i18n("<p>To set a <b>USB Mass Storage</b> camera<br/>" "(which looks like a removable drive when mounted<br/>" "on your desktop), please use<br/>" "<a href=\"umscamera\">%1</a> from the camera list.</p>", d->UMSCameraNameShown)); QLabel* const link2 = new QLabel(box2); link2->setText(i18n("<p>To set a <b>Generic PTP USB Device</b><br/>" "(which uses Picture Transfer Protocol), please<br/>" "use <a href=\"ptpcamera\">%1</a> from the camera list.</p>", d->PTPCameraNameShown)); QLabel* const link3 = new QLabel(box2); link3->setText(i18n("<p>To set a <b>Generic PTP/IP Network Device</b><br/>" "(which uses Picture Transfer Protocol), please<br/>" "use <a href=\"ptpipcamera\">%1</a> from the camera list.</p>", d->PTPIPCameraNameShown)); QLabel* const explanation = new QLabel(box2); explanation->setOpenExternalLinks(true); explanation->setText(i18n("<p>A complete list of camera settings to use is<br/>" "available at <a href='http://www.teaser.fr/~hfiguiere/linux/digicam.html'>" "this URL</a>.</p>")); gLayout4->setContentsMargins(spacing, spacing, spacing, spacing); gLayout4->setSpacing(spacing); gLayout4->addWidget(logo, 0, 0, 1, 1); gLayout4->addWidget(link, 0, 1, 2, 1); gLayout4->addWidget(link2, 2, 1, 2, 1); gLayout4->addWidget(link3, 4, 1, 2, 1); gLayout4->addWidget(explanation, 6, 1, 2, 1); // -------------------------------------------------------------- mainBoxLayout->addWidget(d->listView, 0, 0, 6, 1); mainBoxLayout->addWidget(d->searchBar, 7, 0, 1, 1); mainBoxLayout->addWidget(titleBox, 0, 1, 1, 1); mainBoxLayout->addWidget(portPathBox, 1, 1, 1, 1); mainBoxLayout->addWidget(umsMountBox, 2, 1, 1, 1); mainBoxLayout->addWidget(box2, 3, 1, 2, 1); mainBoxLayout->setColumnStretch(0, 10); mainBoxLayout->setRowStretch(6, 10); mainBoxLayout->setContentsMargins(QMargins()); mainBoxLayout->setSpacing(spacing); QVBoxLayout* const vbx = new QVBoxLayout(this); vbx->addWidget(page); vbx->addWidget(d->buttons); setLayout(vbx); // Connections -------------------------------------------------- connect(link, SIGNAL(linkActivated(QString)), this, SLOT(slotUMSCameraLinkUsed())); connect(link2, SIGNAL(linkActivated(QString)), this, SLOT(slotPTPCameraLinkUsed())); connect(link3, SIGNAL(linkActivated(QString)), this, SLOT(slotPTPIPCameraLinkUsed())); connect(d->networkEdit, SIGNAL(textChanged(QString)), this, SLOT(slotNetworkEditChanged(QString))); connect(d->listView, SIGNAL(itemClicked(QTreeWidgetItem*,int)), this, SLOT(slotSelectionChanged(QTreeWidgetItem*,int))); connect(d->portButtonGroup, SIGNAL(buttonClicked(int)), this, SLOT(slotPortChanged())); connect(d->searchBar, SIGNAL(signalSearchTextSettings(SearchTextSettings)), this, SLOT(slotSearchTextChanged(SearchTextSettings))); connect(d->buttons->button(QDialogButtonBox::Ok), SIGNAL(clicked()), this, SLOT(slotOkClicked())); connect(d->buttons->button(QDialogButtonBox::Cancel), SIGNAL(clicked()), this, SLOT(reject())); connect(d->buttons->button(QDialogButtonBox::Help), SIGNAL(clicked()), this, SLOT(slotHelp())); // Initialize -------------------------------------------------- #ifndef HAVE_GPHOTO2 // If digiKam is compiled without Gphoto2 support, we hide widgets relevant. d->listView->hide(); d->searchBar->hide(); box2->hide(); slotUMSCameraLinkUsed(); #else getCameraList(); getSerialPortList(); #endif /* HAVE_GPHOTO2 */ qApp->restoreOverrideCursor(); }