1
/* ============================================================
3
* This file is a part of digiKam project
4
* http://www.digikam.org
7
* Description : Raw camera list dialog
9
* Copyright (C) 2008 by Gilles Caulier <caulier dot gilles at gmail dot com>
11
* This program is free software; you can redistribute it
12
* and/or modify it under the terms of the GNU General
13
* Public License as published by the Free Software Foundation;
14
* either version 2, or (at your option)
17
* This program is distributed in the hope that it will be useful,
18
* but WITHOUT ANY WARRANTY; without even the implied warranty of
19
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20
* GNU General Public License for more details.
22
* ============================================================ */
27
#include <qstringlist.h>
30
#include <qlistview.h>
36
#include <kiconloader.h>
37
#include <kapplication.h>
38
#include <kaboutdata.h>
40
// LibKDcraw includes.
42
#include <libkdcraw/kdcraw.h>
43
#include <libkdcraw/dcrawbinary.h>
47
#include "searchtextbar.h"
48
#include "rawcameradlg.h"
49
#include "rawcameradlg.moc"
54
class RawCameraDlgPriv
66
SearchTextBar *searchBar;
69
RawCameraDlg::RawCameraDlg(QWidget *parent)
70
: KDialogBase(parent, 0, true, QString(), Help|Ok, Ok, true)
72
setHelp("digitalstillcamera.anchor", "digikam");
73
setCaption(i18n("List of supported RAW camera"));
75
d = new RawCameraDlgPriv;
77
QWidget *page = makeMainWidget();
78
QGridLayout* grid = new QGridLayout(page, 2, 2, 0, spacingHint());
80
QStringList list = KDcrawIface::DcrawBinary::instance()->supportedCamera();
81
QString dcrawVer = KDcrawIface::DcrawBinary::instance()->internalVersion();
82
QString KDcrawVer = KDcrawIface::KDcraw::version();
84
// --------------------------------------------------------
86
QLabel *logo = new QLabel(page);
87
KIconLoader* iconLoader = KApplication::kApplication()->iconLoader();
89
if (KApplication::kApplication()->aboutData()->appName() == QString("digikam"))
90
logo->setPixmap(iconLoader->loadIcon("digikam", KIcon::NoGroup, 96, KIcon::DefaultState, 0, true));
92
logo->setPixmap(iconLoader->loadIcon("showfoto", KIcon::NoGroup, 96, KIcon::DefaultState, 0, true));
94
// --------------------------------------------------------
96
QLabel *header = new QLabel(page);
97
header->setText(i18n("<p>Using KDcraw library version %1"
98
"<p>Using Dcraw program version %2"
99
"<p>%3 models in the list")
100
.arg(KDcrawVer).arg(dcrawVer).arg(list.count()));
102
// --------------------------------------------------------
104
d->searchBar = new SearchTextBar(page, "RawCameraDlgSearchBar");
105
d->listView = new QListView(page);
106
d->listView->addColumn("Camera Model"); // Header is hiden. No i18n here.
107
d->listView->setSorting(1);
108
d->listView->header()->hide();
109
d->listView->setResizeMode(QListView::LastColumn);
111
for (QStringList::Iterator it = list.begin() ; it != list.end() ; ++it)
112
new QListViewItem(d->listView, *it);
114
// --------------------------------------------------------
117
grid->addMultiCellWidget(logo, 0, 0, 0, 0);
118
grid->addMultiCellWidget(header, 0, 0, 1, 2);
119
grid->addMultiCellWidget(d->listView, 1, 1, 0, 2);
120
grid->addMultiCellWidget(d->searchBar, 2, 2, 0, 2);
121
grid->setColStretch(1, 10);
122
grid->setRowStretch(1, 10);
124
// --------------------------------------------------------
126
connect(d->searchBar, SIGNAL(signalTextChanged(const QString&)),
127
this, SLOT(slotSearchTextChanged(const QString&)));
132
RawCameraDlg::~RawCameraDlg()
137
void RawCameraDlg::slotSearchTextChanged(const QString& filter)
140
QString search = filter.lower();
142
QListViewItemIterator it(d->listView);
144
for ( ; it.current(); ++it )
146
QListViewItem *item = it.current();
148
if (item->text(0).lower().contains(search))
151
item->setVisible(true);
155
item->setVisible(false);
159
d->searchBar->slotSearchResult(query);
162
} // NameSpace Digikam