initial commit
This commit is contained in:
+2
-1
@@ -12,6 +12,7 @@
|
||||
#include <QFileInfo>
|
||||
|
||||
#include <QDebug>
|
||||
#include <QElapsedTimer>
|
||||
|
||||
|
||||
cImage::cImage() :
|
||||
@@ -98,7 +99,6 @@ bool cImage::load(const QString &fileName, const char *format)
|
||||
return(loadRAW(fileName));
|
||||
}
|
||||
|
||||
|
||||
bool cImage::openBuffer(const QString &fileName, const QSharedPointer<QByteArray>& ba, LibRaw& iProcessor)
|
||||
{
|
||||
int error = LIBRAW_DATA_ERROR;
|
||||
@@ -378,6 +378,7 @@ bool cImage::loadRAW(const QString &fileName)
|
||||
detectSpecialCamera(iProcessor);
|
||||
|
||||
int error = iProcessor.unpack();
|
||||
|
||||
if(strcmp(iProcessor.version(), "0.13.5") != 0) // fixes a bug specific to libraw 13 - version call is UNTESTED
|
||||
iProcessor.raw2image();
|
||||
|
||||
|
||||
+92
-18
@@ -16,29 +16,84 @@
|
||||
#include <QList>
|
||||
#include <QStandardItem>
|
||||
|
||||
#include <QImageReader>
|
||||
#include <QImageWriter>
|
||||
|
||||
|
||||
void cMainWindow::addImageFormat(const char* shortName, const char* extension)
|
||||
{
|
||||
QList<QByteArray> readList = QImageReader::supportedImageFormats();
|
||||
QList<QByteArray> writeList = QImageWriter::supportedImageFormats();
|
||||
|
||||
bool r = readList.contains(QByteArray(shortName));
|
||||
bool w = writeList.contains(QByteArray(shortName));
|
||||
|
||||
if(QString(shortName).isEmpty())
|
||||
r = true;
|
||||
|
||||
IMAGEFORMAT i;
|
||||
i.shortName = shortName;
|
||||
i.extension = extension;
|
||||
i.read = r;
|
||||
i.write = w;
|
||||
m_imageFormats.append(i);
|
||||
}
|
||||
|
||||
cMainWindow::cMainWindow(cSplashScreen* lpSplashScreen, QWidget *parent) :
|
||||
QMainWindow(parent),
|
||||
ui(new Ui::cMainWindow),
|
||||
m_lpSplashScreen(lpSplashScreen)
|
||||
{
|
||||
// QImageWriter writer;
|
||||
// QList<QByteArray> list = writer.supportedImageFormats();
|
||||
|
||||
// writer.setFormat("jpg");
|
||||
// QList<QByteArray> list1 = writer.supportedSubTypes();
|
||||
|
||||
// bool b;
|
||||
|
||||
// b = writer.supportsOption(QImageIOHandler::CompressionRatio);
|
||||
// b = writer.supportsOption(QImageIOHandler::Quality);
|
||||
|
||||
initUI();
|
||||
createActions();
|
||||
|
||||
onClearList();
|
||||
|
||||
addImageFormat("bmp", "Windows Bitmap (*.bmp)");
|
||||
addImageFormat("gif", "Graphic Interchange Format (optional) (*.gif)");
|
||||
addImageFormat("jpg", "Joint Photographic Experts Group (*.jpg)");
|
||||
addImageFormat("png", "Portable Network Graphics (*.png)");
|
||||
addImageFormat("pbm", "Portable Bitmap (*.pbm)");
|
||||
addImageFormat("pgm", "Portable Graymap (*.pgm)");
|
||||
addImageFormat("ppm", "Portable Pixmap (*.ppm)");
|
||||
addImageFormat("xbm", "X11 Bitmap (*.xbm)");
|
||||
addImageFormat("xpm", "X11 Pixmap (*.xpm)");
|
||||
addImageFormat("svg", "Scalable Vector Graphics (*.svg)");
|
||||
addImageFormat("icns", "Apple Icon Image (*.icns)");
|
||||
addImageFormat("jp2", "Joint Photographic Experts Group 2000 (*.jp2)");
|
||||
addImageFormat("mng", "Multiple-image Network Graphics (*.mng)");
|
||||
addImageFormat("tga", "Truevision Graphics Adapter (*.tga)");
|
||||
addImageFormat("tiff", "Tagged Image File Format (*.tiff)");
|
||||
addImageFormat("wbmp", "Wireless Bitmap (*.wbmp)");
|
||||
addImageFormat("webp", "WebP (*.webp)");
|
||||
addImageFormat("", "Hasselblad (*.3fr)");
|
||||
addImageFormat("", "Arri_Alexa (*.ari)");
|
||||
addImageFormat("", "Sony (*.arw *.srf *.sr2)");
|
||||
addImageFormat("", "Casio (*.bay)");
|
||||
addImageFormat("", "Blackmagic Design (*.braw)");
|
||||
addImageFormat("", "Cintel (*.cri)");
|
||||
addImageFormat("", "Canon (*.crw *.cr2 *.cr3)");
|
||||
addImageFormat("", "Phase_One (*.cap *.iiq *.eip)");
|
||||
addImageFormat("", "Kodak (*.dcs *.dcr *.drf *.k25 *.kdc)");
|
||||
addImageFormat("", "Adobe (*.dng)");
|
||||
addImageFormat("", "Epson (*.erf)");
|
||||
addImageFormat("", "Imacon/Hasselblad raw (*.fff)");
|
||||
addImageFormat("", "GoPro (*.gpr)");
|
||||
addImageFormat("", "Mamiya (*.mef)");
|
||||
addImageFormat("", "Minolta, Agfa (*.mdc)");
|
||||
addImageFormat("", "Leaf (*.mos)");
|
||||
addImageFormat("", "Minolta, Konica Minolta (*.mrw)");
|
||||
addImageFormat("", "Nikon (*.nef *.nrw)");
|
||||
addImageFormat("", "Olympus (*.orf)");
|
||||
addImageFormat("", "Pentax (*.pef *.ptx)");
|
||||
addImageFormat("", "Logitech (*.pxn)");
|
||||
addImageFormat("", "RED Digital Cinema (*.R3D)");
|
||||
addImageFormat("", "Fuji (*.raf)");
|
||||
addImageFormat("", "Panasonic (*.raw *.rw2)");
|
||||
addImageFormat("", "Leica (*.raw *.rwl *.dng)");
|
||||
addImageFormat("", "Rawzor (*.rwz)");
|
||||
addImageFormat("", "Samsung (*.srw)");
|
||||
addImageFormat("", "Sigma (*.x3f)");
|
||||
}
|
||||
|
||||
cMainWindow::~cMainWindow()
|
||||
@@ -58,20 +113,25 @@ void cMainWindow::closeEvent(QCloseEvent *event)
|
||||
else
|
||||
settings.setValue("main/maximized", QVariant::fromValue(false));
|
||||
|
||||
settings.setValue("main/thumbnailSize", QVariant::fromValue(ui->m_lpThumbnailSize->value()));
|
||||
|
||||
event->accept();
|
||||
}
|
||||
|
||||
void cMainWindow::initUI()
|
||||
{
|
||||
QSettings settings;
|
||||
|
||||
ui->setupUi(this);
|
||||
|
||||
ui->m_lpThumbnailSize->setValue(settings.value("main/thumbnailSize", QVariant::fromValue(128)).toInt());
|
||||
onThumbnailSize(ui->m_lpThumbnailSize->value());
|
||||
|
||||
QIcon::setThemeName("TangoMFK");
|
||||
|
||||
m_lpFileListModel = new QStandardItemModel;
|
||||
ui->m_lpFileList->setModel(m_lpFileListModel);
|
||||
|
||||
QSettings settings;
|
||||
|
||||
if(!settings.value("main/maximized").toBool())
|
||||
{
|
||||
qint32 iX = settings.value("main/x", QVariant::fromValue(-1)).toInt();
|
||||
@@ -101,6 +161,8 @@ void cMainWindow::createActions()
|
||||
connect(ui->m_lpConvert, &QPushButton::clicked, this, &cMainWindow::onConvert);
|
||||
|
||||
connect(ui->m_lpFileList, &cTreeView::addEntry, this, &cMainWindow::onAddEntry);
|
||||
|
||||
connect(ui->m_lpThumbnailSize, &QSlider::valueChanged, this, &cMainWindow::onThumbnailSize);
|
||||
}
|
||||
|
||||
void cMainWindow::createContextActions()
|
||||
@@ -144,6 +206,9 @@ void cMainWindow::onAddEntry(const QString& file)
|
||||
if(mimeType.name().startsWith("image"))
|
||||
addFile(file);
|
||||
}
|
||||
|
||||
for(int i = 0;i < m_lpFileListModel->columnCount();i++)
|
||||
ui->m_lpFileList->resizeColumnToContents(i);
|
||||
}
|
||||
|
||||
void cMainWindow::addPath(const QString& path)
|
||||
@@ -177,14 +242,17 @@ void cMainWindow::addFile(const QString& file)
|
||||
|
||||
items.append(new QStandardItem(info.path()));
|
||||
items.append(new QStandardItem(info.fileName()));
|
||||
items.append(new QStandardItem(QString::number(info.size())));
|
||||
items.append(new QStandardItem(info.birthTime().toString("dd.MM.yyyy hh:mm:ss")));
|
||||
items.append(new QStandardItem(QString::number(info.size()/1024)+" kb"));
|
||||
items.append(new QStandardItem(lpExif->dateTime().toString("dd.MM.yyyy hh:mm:ss")));
|
||||
items.append(new QStandardItem(QString::number(lpExif->imageWidth())));
|
||||
items.append(new QStandardItem(QString::number(lpExif->imageHeight())));
|
||||
|
||||
items[3]->setTextAlignment(Qt::AlignRight);
|
||||
items[4]->setTextAlignment(Qt::AlignRight);
|
||||
items[5]->setTextAlignment(Qt::AlignRight);
|
||||
items[0]->setIcon(QIcon(QPixmap::fromImage(lpExif->thumbnail())));
|
||||
items[0]->setCheckable(true);
|
||||
items[2]->setTextAlignment(Qt::AlignRight | Qt::AlignCenter);
|
||||
items[3]->setTextAlignment(Qt::AlignRight | Qt::AlignCenter);
|
||||
items[4]->setTextAlignment(Qt::AlignRight | Qt::AlignCenter);
|
||||
items[5]->setTextAlignment(Qt::AlignRight | Qt::AlignCenter);
|
||||
|
||||
items[0]->setData(QVariant::fromValue(lpExif), Qt::UserRole+1);
|
||||
|
||||
@@ -232,3 +300,9 @@ void cMainWindow::onConvert()
|
||||
image.save(newFile);
|
||||
}
|
||||
}
|
||||
|
||||
void cMainWindow::onThumbnailSize(int size)
|
||||
{
|
||||
ui->m_lpThumbnailSizeValue->setText(QString::number(size));
|
||||
ui->m_lpFileList->setIconSize(QSize(size, size));
|
||||
}
|
||||
|
||||
@@ -15,6 +15,16 @@ QT_BEGIN_NAMESPACE
|
||||
namespace Ui { class cMainWindow; }
|
||||
QT_END_NAMESPACE
|
||||
|
||||
|
||||
typedef struct tagIMAGEFORMAT
|
||||
{
|
||||
QString shortName;
|
||||
QString extension;
|
||||
bool read;
|
||||
bool write;
|
||||
} IMAGEFORMAT;
|
||||
|
||||
|
||||
class cMainWindow : public QMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -29,6 +39,7 @@ private:
|
||||
QStandardItemModel* m_lpFileListModel;
|
||||
|
||||
QMimeDatabase m_mimeDB;
|
||||
QList<IMAGEFORMAT> m_imageFormats;
|
||||
|
||||
|
||||
void initUI();
|
||||
@@ -48,9 +59,11 @@ private slots:
|
||||
void onClearList();
|
||||
void onConvert();
|
||||
|
||||
void onThumbnailSize(int size);
|
||||
void onAddEntry(const QString& file);
|
||||
|
||||
protected:
|
||||
void closeEvent(QCloseEvent* event);
|
||||
void addImageFormat(const char* shortName, const char* extension);
|
||||
};
|
||||
#endif // CMAINWINDOW_H
|
||||
|
||||
+58
-9
@@ -11,7 +11,7 @@
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>cMainWindow</string>
|
||||
<string/>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralwidget">
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
@@ -80,19 +80,21 @@
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="selectionMode">
|
||||
<enum>QAbstractItemView::MultiSelection</enum>
|
||||
<enum>QAbstractItemView::ExtendedSelection</enum>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="rootIsDecorated">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="m_lpPicturePreview">
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="m_lpPictureData">
|
||||
<property name="text">
|
||||
@@ -106,6 +108,53 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>thumbnail size:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSlider" name="m_lpThumbnailSize">
|
||||
<property name="minimum">
|
||||
<number>16</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>150</number>
|
||||
</property>
|
||||
<property name="pageStep">
|
||||
<number>16</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="m_lpThumbnailSizeValue">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QMenuBar" name="menubar">
|
||||
|
||||
Reference in New Issue
Block a user