initial commit
This commit is contained in:
+20
-27
@@ -21,7 +21,8 @@
|
|||||||
|
|
||||||
cImportDialog::cImportDialog(QWidget *parent) :
|
cImportDialog::cImportDialog(QWidget *parent) :
|
||||||
QDialog(parent),
|
QDialog(parent),
|
||||||
ui(new Ui::cImportDialog)
|
ui(new Ui::cImportDialog),
|
||||||
|
m_bHasImported(false)
|
||||||
{
|
{
|
||||||
initUI();
|
initUI();
|
||||||
createActions();
|
createActions();
|
||||||
@@ -42,18 +43,15 @@ void cImportDialog::initUI()
|
|||||||
|
|
||||||
QSettings settings;
|
QSettings settings;
|
||||||
|
|
||||||
if(settings.value("main/maximized").toBool())
|
qint32 iX = settings.value("import/x", QVariant::fromValue(-1)).toInt();
|
||||||
{
|
qint32 iY = settings.value("import/y", QVariant::fromValue(-1)).toInt();
|
||||||
qint32 iX = settings.value("import/x", QVariant::fromValue(-1)).toInt();
|
qint32 iWidth = settings.value("import/width", QVariant::fromValue(-1)).toInt();
|
||||||
qint32 iY = settings.value("import/y", QVariant::fromValue(-1)).toInt();
|
qint32 iHeight = settings.value("import/height", QVariant::fromValue(-1)).toInt();
|
||||||
qint32 iWidth = settings.value("import/width", QVariant::fromValue(-1)).toInt();
|
|
||||||
qint32 iHeight = settings.value("import/height", QVariant::fromValue(-1)).toInt();
|
|
||||||
|
|
||||||
if(iWidth != -1 && iHeight != -1)
|
if(iWidth != -1 && iHeight != -1)
|
||||||
resize(iWidth, iHeight);
|
resize(iWidth, iHeight);
|
||||||
if(iX != -1 && iY != -1)
|
if(iX != -1 && iY != -1)
|
||||||
move(iX, iY);
|
move(iX, iY);
|
||||||
}
|
|
||||||
|
|
||||||
qint32 iWidth1 = settings.value("import/splitter1", QVariant::fromValue(-1)).toInt();
|
qint32 iWidth1 = settings.value("import/splitter1", QVariant::fromValue(-1)).toInt();
|
||||||
qint32 iWidth2 = settings.value("import/splitter2", QVariant::fromValue(-1)).toInt();
|
qint32 iWidth2 = settings.value("import/splitter2", QVariant::fromValue(-1)).toInt();
|
||||||
@@ -63,6 +61,11 @@ void cImportDialog::initUI()
|
|||||||
ui->m_lpPath->setText(settings.value("import/path", QDir::homePath()).toString());
|
ui->m_lpPath->setText(settings.value("import/path", QDir::homePath()).toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool cImportDialog::hasImported()
|
||||||
|
{
|
||||||
|
return(m_bHasImported);
|
||||||
|
}
|
||||||
|
|
||||||
void cImportDialog::createActions()
|
void cImportDialog::createActions()
|
||||||
{
|
{
|
||||||
connect(ui->m_lpPathSelect, &QPushButton::clicked, this, &cImportDialog::onPathSelect);
|
connect(ui->m_lpPathSelect, &QPushButton::clicked, this, &cImportDialog::onPathSelect);
|
||||||
@@ -71,21 +74,6 @@ void cImportDialog::createActions()
|
|||||||
connect(ui->m_lpImportList->selectionModel(), &QItemSelectionModel::selectionChanged, this, &cImportDialog::onThumbnailSelected);
|
connect(ui->m_lpImportList->selectionModel(), &QItemSelectionModel::selectionChanged, this, &cImportDialog::onThumbnailSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
void cImportDialog::closeEvent(QCloseEvent *event)
|
|
||||||
{
|
|
||||||
QSettings settings;
|
|
||||||
settings.setValue("import/width", QVariant::fromValue(size().width()));
|
|
||||||
settings.setValue("import/height", QVariant::fromValue(size().height()));
|
|
||||||
settings.setValue("import/x", QVariant::fromValue(x()));
|
|
||||||
settings.setValue("import/y", QVariant::fromValue(y()));
|
|
||||||
if(this->isMaximized())
|
|
||||||
settings.setValue("import/maximized", QVariant::fromValue(true));
|
|
||||||
else
|
|
||||||
settings.setValue("import/maximized", QVariant::fromValue(false));
|
|
||||||
|
|
||||||
event->accept();
|
|
||||||
}
|
|
||||||
|
|
||||||
void cImportDialog::onPathSelect()
|
void cImportDialog::onPathSelect()
|
||||||
{
|
{
|
||||||
QSettings settings;
|
QSettings settings;
|
||||||
@@ -103,6 +91,8 @@ void cImportDialog::onThumbnailSelected(const QItemSelection& /*selection*/, con
|
|||||||
{
|
{
|
||||||
cToolBoxInfo* lpToolBoxInfo = ui->m_lpInfo;
|
cToolBoxInfo* lpToolBoxInfo = ui->m_lpInfo;
|
||||||
|
|
||||||
|
ui->m_lpCount->setText(QString("count: %1, selected: %2").arg(m_lpImportListModel->rowCount()).arg(ui->m_lpImportList->selectionModel()->selectedRows().count()));
|
||||||
|
|
||||||
if(ui->m_lpImportList->selectionModel()->selectedIndexes().count() != 1)
|
if(ui->m_lpImportList->selectionModel()->selectedIndexes().count() != 1)
|
||||||
{
|
{
|
||||||
lpToolBoxInfo->setPicture(nullptr);
|
lpToolBoxInfo->setPicture(nullptr);
|
||||||
@@ -156,6 +146,7 @@ void cImportDialog::onRead()
|
|||||||
|
|
||||||
void cImportDialog::onImport()
|
void cImportDialog::onImport()
|
||||||
{
|
{
|
||||||
|
m_bHasImported = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void cImportDialog::readDirectory(const QString& szPath, bool bRecursive)
|
void cImportDialog::readDirectory(const QString& szPath, bool bRecursive)
|
||||||
@@ -207,6 +198,8 @@ void cImportDialog::readDirectory(const QString& szPath, bool bRecursive)
|
|||||||
lpItem->setData(QVariant::fromValue(lpPicture));
|
lpItem->setData(QVariant::fromValue(lpPicture));
|
||||||
m_lpImportListModel->appendRow(lpItem);
|
m_lpImportListModel->appendRow(lpItem);
|
||||||
qApp->processEvents();
|
qApp->processEvents();
|
||||||
|
|
||||||
|
ui->m_lpCount->setText(QString("count: %1, selected: %2").arg(m_lpImportListModel->rowCount()).arg(ui->m_lpImportList->selectionModel()->selectedRows().count()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+8
-7
@@ -33,6 +33,13 @@ public:
|
|||||||
*/
|
*/
|
||||||
~cImportDialog();
|
~cImportDialog();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
bool hasImported();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
/*!
|
/*!
|
||||||
\brief
|
\brief
|
||||||
@@ -63,6 +70,7 @@ private slots:
|
|||||||
private:
|
private:
|
||||||
Ui::cImportDialog* ui; /**< TODO: describe */
|
Ui::cImportDialog* ui; /**< TODO: describe */
|
||||||
QStandardItemModel* m_lpImportListModel; /**< TODO: describe */
|
QStandardItemModel* m_lpImportListModel; /**< TODO: describe */
|
||||||
|
bool m_bHasImported; /**< TODO: describe */
|
||||||
|
|
||||||
void initUI();
|
void initUI();
|
||||||
void createActions();
|
void createActions();
|
||||||
@@ -92,13 +100,6 @@ private:
|
|||||||
*/
|
*/
|
||||||
void savePosition();
|
void savePosition();
|
||||||
protected:
|
protected:
|
||||||
/*!
|
|
||||||
\brief
|
|
||||||
|
|
||||||
\fn closeEvent
|
|
||||||
\param event
|
|
||||||
*/
|
|
||||||
void closeEvent(QCloseEvent* event);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CIMPORTDIALOG_H
|
#endif // CIMPORTDIALOG_H
|
||||||
|
|||||||
+48
-15
@@ -15,7 +15,7 @@
|
|||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout_2">
|
<layout class="QGridLayout" name="gridLayout_2">
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2" stretch="0,0,1,0,0">
|
<layout class="QVBoxLayout" name="verticalLayout_2" stretch="0,0,1,0,0,0">
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
<item>
|
<item>
|
||||||
@@ -74,18 +74,40 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="m_lpRead">
|
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||||
<property name="text">
|
<item>
|
||||||
<string>read</string>
|
<widget class="QPushButton" name="m_lpRead">
|
||||||
</property>
|
<property name="minimumSize">
|
||||||
</widget>
|
<size>
|
||||||
</item>
|
<width>100</width>
|
||||||
<item>
|
<height>0</height>
|
||||||
<widget class="QPushButton" name="m_lpImport">
|
</size>
|
||||||
<property name="text">
|
</property>
|
||||||
<string>import</string>
|
<property name="text">
|
||||||
</property>
|
<string>read</string>
|
||||||
</widget>
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="m_lpImport">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>100</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="baseSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>import</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<spacer name="horizontalSpacer">
|
<spacer name="horizontalSpacer">
|
||||||
@@ -143,7 +165,7 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>69</width>
|
<width>69</width>
|
||||||
<height>167</height>
|
<height>134</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
@@ -155,6 +177,17 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="m_lpCount">
|
||||||
|
<property name="text">
|
||||||
|
<string>TextLabel</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_3" stretch="1,1">
|
<layout class="QHBoxLayout" name="horizontalLayout_3" stretch="1,1">
|
||||||
<item>
|
<item>
|
||||||
@@ -179,7 +212,7 @@
|
|||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="standardButtons">
|
<property name="standardButtons">
|
||||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
<set>QDialogButtonBox::Close</set>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|||||||
+3
-4
@@ -396,8 +396,7 @@ void cMainWindow::onFileImport()
|
|||||||
{
|
{
|
||||||
cImportDialog importDialog(this);
|
cImportDialog importDialog(this);
|
||||||
|
|
||||||
if(importDialog.exec() == QDialog::Rejected)
|
importDialog.exec();
|
||||||
return;
|
if(importDialog.hasImported())
|
||||||
|
loadData();
|
||||||
loadData();
|
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-2
@@ -28,6 +28,5 @@ void cToolBoxInfo::setPicture(cPicture* lpPicture)
|
|||||||
ui->m_lpFileName->setText(lpPicture->fileName());
|
ui->m_lpFileName->setText(lpPicture->fileName());
|
||||||
ui->m_lpDate->setText(lpPicture->dateTime().toString());
|
ui->m_lpDate->setText(lpPicture->dateTime().toString());
|
||||||
ui->m_lpSize->setText(QString("%1x%2").arg(lpPicture->imageWidth()).arg(lpPicture->imageHeight()));
|
ui->m_lpSize->setText(QString("%1x%2").arg(lpPicture->imageWidth()).arg(lpPicture->imageHeight()));
|
||||||
// ui->m_lpCamera->setText(QString("%1 %2").arg(lpPicture->cameraMake()).arg(lpPicture->cameraModel()));
|
ui->m_lpCamera->setText(QString("%1 %2").arg(lpPicture->cameraMake()).arg(lpPicture->cameraModel()));
|
||||||
ui->m_lpCamera->setText(QString("%1").arg(lpPicture->imageOrientation()));
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user