initial commit
This commit is contained in:
+20
-27
@@ -21,7 +21,8 @@
|
||||
|
||||
cImportDialog::cImportDialog(QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::cImportDialog)
|
||||
ui(new Ui::cImportDialog),
|
||||
m_bHasImported(false)
|
||||
{
|
||||
initUI();
|
||||
createActions();
|
||||
@@ -42,18 +43,15 @@ void cImportDialog::initUI()
|
||||
|
||||
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 iWidth = settings.value("import/width", QVariant::fromValue(-1)).toInt();
|
||||
qint32 iHeight = settings.value("import/height", QVariant::fromValue(-1)).toInt();
|
||||
qint32 iX = settings.value("import/x", QVariant::fromValue(-1)).toInt();
|
||||
qint32 iY = settings.value("import/y", 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)
|
||||
resize(iWidth, iHeight);
|
||||
if(iX != -1 && iY != -1)
|
||||
move(iX, iY);
|
||||
}
|
||||
if(iWidth != -1 && iHeight != -1)
|
||||
resize(iWidth, iHeight);
|
||||
if(iX != -1 && iY != -1)
|
||||
move(iX, iY);
|
||||
|
||||
qint32 iWidth1 = settings.value("import/splitter1", 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());
|
||||
}
|
||||
|
||||
bool cImportDialog::hasImported()
|
||||
{
|
||||
return(m_bHasImported);
|
||||
}
|
||||
|
||||
void cImportDialog::createActions()
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
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()
|
||||
{
|
||||
QSettings settings;
|
||||
@@ -103,6 +91,8 @@ void cImportDialog::onThumbnailSelected(const QItemSelection& /*selection*/, con
|
||||
{
|
||||
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)
|
||||
{
|
||||
lpToolBoxInfo->setPicture(nullptr);
|
||||
@@ -156,6 +146,7 @@ void cImportDialog::onRead()
|
||||
|
||||
void cImportDialog::onImport()
|
||||
{
|
||||
m_bHasImported = true;
|
||||
}
|
||||
|
||||
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));
|
||||
m_lpImportListModel->appendRow(lpItem);
|
||||
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();
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
bool hasImported();
|
||||
|
||||
private slots:
|
||||
/*!
|
||||
\brief
|
||||
@@ -63,6 +70,7 @@ private slots:
|
||||
private:
|
||||
Ui::cImportDialog* ui; /**< TODO: describe */
|
||||
QStandardItemModel* m_lpImportListModel; /**< TODO: describe */
|
||||
bool m_bHasImported; /**< TODO: describe */
|
||||
|
||||
void initUI();
|
||||
void createActions();
|
||||
@@ -92,13 +100,6 @@ private:
|
||||
*/
|
||||
void savePosition();
|
||||
protected:
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn closeEvent
|
||||
\param event
|
||||
*/
|
||||
void closeEvent(QCloseEvent* event);
|
||||
};
|
||||
|
||||
#endif // CIMPORTDIALOG_H
|
||||
|
||||
+48
-15
@@ -15,7 +15,7 @@
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<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>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
@@ -74,18 +74,40 @@
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="m_lpRead">
|
||||
<property name="text">
|
||||
<string>read</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="m_lpImport">
|
||||
<property name="text">
|
||||
<string>import</string>
|
||||
</property>
|
||||
</widget>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<widget class="QPushButton" name="m_lpRead">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>read</string>
|
||||
</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>
|
||||
<spacer name="horizontalSpacer">
|
||||
@@ -143,7 +165,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>69</width>
|
||||
<height>167</height>
|
||||
<height>134</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
@@ -155,6 +177,17 @@
|
||||
</widget>
|
||||
</widget>
|
||||
</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>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3" stretch="1,1">
|
||||
<item>
|
||||
@@ -179,7 +212,7 @@
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
<set>QDialogButtonBox::Close</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
+3
-4
@@ -396,8 +396,7 @@ void cMainWindow::onFileImport()
|
||||
{
|
||||
cImportDialog importDialog(this);
|
||||
|
||||
if(importDialog.exec() == QDialog::Rejected)
|
||||
return;
|
||||
|
||||
loadData();
|
||||
importDialog.exec();
|
||||
if(importDialog.hasImported())
|
||||
loadData();
|
||||
}
|
||||
|
||||
+1
-2
@@ -28,6 +28,5 @@ void cToolBoxInfo::setPicture(cPicture* lpPicture)
|
||||
ui->m_lpFileName->setText(lpPicture->fileName());
|
||||
ui->m_lpDate->setText(lpPicture->dateTime().toString());
|
||||
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").arg(lpPicture->imageOrientation()));
|
||||
ui->m_lpCamera->setText(QString("%1 %2").arg(lpPicture->cameraMake()).arg(lpPicture->cameraModel()));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user