import dialog
This commit is contained in:
@@ -0,0 +1,62 @@
|
||||
#include "cimportdialog.h"
|
||||
#include "ui_cimportdialog.h"
|
||||
|
||||
#include <QSettings>
|
||||
#include <QDir>
|
||||
#include <QFileDialog>
|
||||
|
||||
|
||||
cImportDialog::cImportDialog(QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::cImportDialog)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
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();
|
||||
|
||||
if(iWidth != -1 && iHeight != -1)
|
||||
resize(iWidth, iHeight);
|
||||
if(iX != -1 && iY != -1)
|
||||
move(iX, iY);
|
||||
}
|
||||
}
|
||||
|
||||
cImportDialog::~cImportDialog()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void cImportDialog::on_m_lpPathSelect_clicked()
|
||||
{
|
||||
QSettings settings;
|
||||
QString szPath = settings.value("import/path", QDir::homePath()).toString();
|
||||
szPath = QFileDialog::getExistingDirectory(this, tr("Import Directory"), szPath, QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks);
|
||||
|
||||
if(szPath.isEmpty())
|
||||
return;
|
||||
|
||||
ui->m_lpPath->setText(szPath);
|
||||
settings.setValue("import/path", szPath);
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
#ifndef CIMPORTDIALOG_H
|
||||
#define CIMPORTDIALOG_H
|
||||
|
||||
|
||||
#include <QDialog>
|
||||
#include <QCloseEvent>
|
||||
|
||||
|
||||
namespace Ui {
|
||||
class cImportDialog;
|
||||
}
|
||||
|
||||
class cImportDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit cImportDialog(QWidget *parent = nullptr);
|
||||
~cImportDialog();
|
||||
|
||||
private slots:
|
||||
void on_m_lpPathSelect_clicked();
|
||||
|
||||
private:
|
||||
Ui::cImportDialog *ui;
|
||||
|
||||
protected:
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn closeEvent
|
||||
\param event
|
||||
*/
|
||||
void closeEvent(QCloseEvent* event);
|
||||
};
|
||||
|
||||
#endif // CIMPORTDIALOG_H
|
||||
@@ -0,0 +1,159 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>cImportDialog</class>
|
||||
<widget class="QDialog" name="cImportDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>653</width>
|
||||
<height>563</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Import</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Path:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="m_lpPath"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="m_lpPathSelect">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="m_lpRecursive">
|
||||
<property name="text">
|
||||
<string>recursive</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QRadioButton" name="m_lpCopy">
|
||||
<property name="text">
|
||||
<string>copy</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<attribute name="buttonGroup">
|
||||
<string notr="true">copy_or_move</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="m_lpMove">
|
||||
<property name="text">
|
||||
<string>move</string>
|
||||
</property>
|
||||
<attribute name="buttonGroup">
|
||||
<string notr="true">copy_or_move</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<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>
|
||||
<item>
|
||||
<widget class="QListView" name="m_lpImportList">
|
||||
<property name="selectionMode">
|
||||
<enum>QAbstractItemView::ExtendedSelection</enum>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>160</width>
|
||||
<height>120</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="viewMode">
|
||||
<enum>QListView::IconMode</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QDialogButtonBox" name="m_lpButtonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>m_lpButtonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>cImportDialog</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>248</x>
|
||||
<y>254</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>m_lpButtonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>cImportDialog</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>316</x>
|
||||
<y>260</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
<buttongroups>
|
||||
<buttongroup name="copy_or_move"/>
|
||||
</buttongroups>
|
||||
</ui>
|
||||
+285
-2
@@ -1,6 +1,8 @@
|
||||
#include "common.h"
|
||||
|
||||
#include "cmainwindow.h"
|
||||
#include "cimportdialog.h"
|
||||
|
||||
#include "ui_cmainwindow.h"
|
||||
|
||||
#include <QDebug>
|
||||
@@ -18,11 +20,16 @@
|
||||
cMainWindow::cMainWindow(cSplashScreen* lpSplashScreen, QWidget *parent) :
|
||||
QMainWindow(parent),
|
||||
ui(new Ui::cMainWindow),
|
||||
m_lpSplashScreen(lpSplashScreen)
|
||||
m_lpSplashScreen(lpSplashScreen),
|
||||
m_lpFileMenu(nullptr),
|
||||
m_lpFileToolBar(nullptr)
|
||||
{
|
||||
initUI();
|
||||
createActions();
|
||||
loadData();
|
||||
|
||||
updateRecentFileActions();
|
||||
|
||||
// cPicture picture;
|
||||
// picture.fromFile(QDir::homePath() + "\\OneDrive - WINDESIGN\\exif-samples-master\\IMG_1371.CR2");
|
||||
// picture.toDB();
|
||||
@@ -63,13 +70,34 @@ void cMainWindow::initUI()
|
||||
ui->m_lpThumbnailView->setModel(m_lpThumbnailViewModel);
|
||||
|
||||
QIcon::setThemeName("TangoMFK");
|
||||
|
||||
QSettings settings;
|
||||
|
||||
if(!settings.value("main/maximized").toBool())
|
||||
{
|
||||
qint32 iX = settings.value("main/x", QVariant::fromValue(-1)).toInt();
|
||||
qint32 iY = settings.value("main/y", QVariant::fromValue(-1)).toInt();
|
||||
qint32 iWidth = settings.value("main/width", QVariant::fromValue(-1)).toInt();
|
||||
qint32 iHeight = settings.value("main/height", QVariant::fromValue(-1)).toInt();
|
||||
|
||||
if(iWidth != -1 && iHeight != -1)
|
||||
resize(iWidth, iHeight);
|
||||
if(iX != -1 && iY != -1)
|
||||
move(iX, iY);
|
||||
}
|
||||
|
||||
qint32 iWidth1 = settings.value("main/splitter1", QVariant::fromValue(-1)).toInt();
|
||||
qint32 iWidth2 = settings.value("main/splitter2", QVariant::fromValue(-1)).toInt();
|
||||
qint32 iWidth3 = settings.value("main/splitter3", QVariant::fromValue(-1)).toInt();
|
||||
|
||||
ui->m_lpSplitter->setSizes(QList<int>() << iWidth1 << iWidth2 << iWidth3);
|
||||
}
|
||||
|
||||
void cMainWindow::createActions()
|
||||
{
|
||||
setToolButtonStyle(Qt::ToolButtonFollowStyle);
|
||||
|
||||
// createFileActions();
|
||||
createFileActions();
|
||||
// createEditActions();
|
||||
// createTextActions();
|
||||
// createToolsActions();
|
||||
@@ -138,9 +166,84 @@ void cMainWindow::closeEvent(QCloseEvent *event)
|
||||
else
|
||||
settings.setValue("main/maximized", QVariant::fromValue(false));
|
||||
|
||||
QList<qint32> sizes = ui->m_lpSplitter->sizes();
|
||||
|
||||
for(int x = 0;x < sizes.count();x++)
|
||||
settings.setValue(QString("main/splitter%1").arg(x+1), QVariant::fromValue(sizes[x]));
|
||||
|
||||
event->accept();
|
||||
}
|
||||
|
||||
void cMainWindow::createFileActions()
|
||||
{
|
||||
m_lpFileMenu = menuBar()->addMenu(tr("&File"));
|
||||
m_lpFileToolBar = addToolBar(tr("File Actions"));
|
||||
|
||||
const QIcon newIcon = QIcon::fromTheme("document-new");
|
||||
m_lpFileNewAction = m_lpFileMenu->addAction(newIcon, tr("&New"), this, &cMainWindow::onFileNew);
|
||||
m_lpFileToolBar->addAction(m_lpFileNewAction);
|
||||
m_lpFileNewAction->setPriority(QAction::LowPriority);
|
||||
m_lpFileNewAction->setShortcut(QKeySequence::New);
|
||||
|
||||
const QIcon openIcon = QIcon::fromTheme("document-open");
|
||||
m_lpFileOpenAction = m_lpFileMenu->addAction(openIcon, tr("&Open..."), this, &cMainWindow::onFileOpen);
|
||||
m_lpFileOpenAction->setShortcut(QKeySequence::Open);
|
||||
m_lpFileToolBar->addAction(m_lpFileOpenAction);
|
||||
|
||||
m_lpFileMenu->addSeparator();
|
||||
|
||||
m_lpFileImportAction = m_lpFileMenu->addAction(tr("&Import..."), this, &cMainWindow::onFileImport);
|
||||
m_lpFileToolBar->addAction(m_lpFileImportAction);
|
||||
|
||||
m_lpFileMenu->addSeparator();
|
||||
|
||||
// const QIcon saveIcon = QIcon::fromTheme("document-save");
|
||||
// m_lpFileSaveAction = m_lpFileMenu->addAction(saveIcon, tr("&Save"), this, &cMainWindow::onFileSave);
|
||||
// m_lpFileSaveAction->setShortcut(QKeySequence::Save);
|
||||
// m_lpFileSaveAction->setEnabled(false);
|
||||
// m_lpFileToolBar->addAction(m_lpFileSaveAction);
|
||||
|
||||
// m_lpFileSaveAsAction = m_lpFileMenu->addAction(tr("Save &As..."), this, &cMainWindow::onFileSaveAs);
|
||||
// m_lpFileSaveAsAction->setPriority(QAction::LowPriority);
|
||||
// m_lpFileMenu->addSeparator();
|
||||
|
||||
//#ifndef QT_NO_PRINTER
|
||||
// const QIcon printIcon = QIcon::fromTheme("document-print");
|
||||
// m_lpFilePrintAction = m_lpFileMenu->addAction(printIcon, tr("&Print..."), this, &cMainWindow::onFilePrint);
|
||||
// m_lpFilePrintAction->setPriority(QAction::LowPriority);
|
||||
// m_lpFilePrintAction->setShortcut(QKeySequence::Print);
|
||||
// m_lpFileToolBar->addAction(m_lpFilePrintAction);
|
||||
|
||||
// const QIcon filePrintIcon = QIcon::fromTheme("document-print");
|
||||
// m_lpFilePrintPreviewAction = m_lpFileMenu->addAction(filePrintIcon, tr("Print Preview..."), this, &cMainWindow::onFilePrintPreview);
|
||||
|
||||
// const QIcon exportPdfIcon = QIcon::fromTheme("document-pdf");
|
||||
// m_lpFileExportPDFAction = m_lpFileMenu->addAction(exportPdfIcon, tr("&Export PDF..."), this, &cMainWindow::onFilePrintPdf);
|
||||
// m_lpFileExportPDFAction->setPriority(QAction::LowPriority);
|
||||
// m_lpFileExportPDFAction->setShortcut(Qt::CTRL + Qt::Key_D);
|
||||
// m_lpFileToolBar->addAction(m_lpFileExportPDFAction);
|
||||
|
||||
// m_lpFileMenu->addSeparator();
|
||||
//#endif
|
||||
|
||||
// m_lpFilePropertiesAction = m_lpFileMenu->addAction(tr("P&roperties..."), this, &cMainWindow::onFileProperties);
|
||||
// m_lpFilePropertiesAction->setPriority(QAction::LowPriority);
|
||||
// m_lpFileMenu->addSeparator();
|
||||
|
||||
for(int i = 0; i < MaxRecentFiles;i++)
|
||||
{
|
||||
m_lpRecentFileAction[i] = new QAction(this);
|
||||
m_lpRecentFileAction[i]->setVisible(false);
|
||||
m_lpFileMenu->addAction(m_lpRecentFileAction[i]);
|
||||
connect(m_lpRecentFileAction[i], &QAction::triggered, this, &cMainWindow::openRecentFile);
|
||||
}
|
||||
m_lpSeparatorRecent = m_lpFileMenu->addSeparator();
|
||||
m_lpSeparatorRecent->setVisible(false);
|
||||
|
||||
m_lpFileQuitAction = m_lpFileMenu->addAction(tr("&Quit"), this, &QWidget::close);
|
||||
m_lpFileQuitAction->setShortcut(Qt::CTRL + Qt::Key_Q);
|
||||
}
|
||||
|
||||
void cMainWindow::onThumbnailSelected(const QItemSelection& /*selection*/, const QItemSelection& /*previous*/)
|
||||
{
|
||||
cToolBoxInfo* lpToolBoxInfo = static_cast<cToolBoxInfo*>(ui->m_lpToolBox->widget(0));
|
||||
@@ -155,3 +258,183 @@ void cMainWindow::onThumbnailSelected(const QItemSelection& /*selection*/, const
|
||||
cPicture* lpPicture = lpItem->data().value<cPicture*>();
|
||||
lpToolBoxInfo->setPicture(lpPicture);
|
||||
}
|
||||
|
||||
void cMainWindow::setCurrentFile(const QString& fileName)
|
||||
{
|
||||
QSettings settings;
|
||||
QStringList files = settings.value("file/recentFiles").toStringList();
|
||||
files.removeAll(fileName);
|
||||
files.prepend(fileName);
|
||||
while(files.size() > MaxRecentFiles)
|
||||
files.removeLast();
|
||||
|
||||
settings.setValue("file/recentFiles", files);
|
||||
|
||||
updateRecentFileActions();
|
||||
}
|
||||
|
||||
void cMainWindow::updateRecentFileActions()
|
||||
{
|
||||
QSettings settings;
|
||||
QStringList files = settings.value("file/recentFiles").toStringList();
|
||||
|
||||
int numRecentFiles = qMin(files.size(), (int)MaxRecentFiles);
|
||||
|
||||
for(int i = 0; i < numRecentFiles; i++)
|
||||
{
|
||||
QString text = tr("&%1 %2").arg(i + 1).arg(QFileInfo(files[i]).fileName());
|
||||
m_lpRecentFileAction[i]->setText(text);
|
||||
m_lpRecentFileAction[i]->setData(files[i]);
|
||||
m_lpRecentFileAction[i]->setVisible(true);
|
||||
}
|
||||
|
||||
for(int j = numRecentFiles; j < MaxRecentFiles; j++)
|
||||
m_lpRecentFileAction[j]->setVisible(false);
|
||||
|
||||
m_lpSeparatorRecent->setVisible(numRecentFiles > 0);
|
||||
}
|
||||
|
||||
void cMainWindow::openRecentFile()
|
||||
{
|
||||
QAction* lpAction = qobject_cast<QAction*>(sender());
|
||||
if(lpAction)
|
||||
{
|
||||
// if(m_lpStoryBook)
|
||||
// {
|
||||
// if(m_bSomethingChanged)
|
||||
// {
|
||||
// switch(QMessageBox::question(this, tr("Save"), m_lpStoryBook->title() + tr(" has been changed.\nDo you want to save?"), QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel))
|
||||
// {
|
||||
// case QMessageBox::Yes:
|
||||
// if(!onFileSave())
|
||||
// return;
|
||||
// break;
|
||||
// case QMessageBox::No:
|
||||
// break;
|
||||
// case QMessageBox::Cancel:
|
||||
// return;
|
||||
// default:
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// QString szProjectName = lpAction->data().toString();
|
||||
// if(szProjectName.isEmpty())
|
||||
// return;
|
||||
|
||||
// delete m_lpStoryBook;
|
||||
|
||||
// m_lpStoryBook = new cStoryBook(szProjectName);
|
||||
|
||||
// m_lpStoryBook->fillOutlineList(ui->m_lpOutlineList);
|
||||
// m_lpStoryBook->fillCharacterList(ui->m_lpCharacterList);
|
||||
// m_lpStoryBook->fillPlaceList(ui->m_lpPlaceList);
|
||||
// m_lpStoryBook->fillObjectList(ui->m_lpObjectList);
|
||||
// m_lpStoryBook->fillRechercheList(ui->m_lpRechercheList);
|
||||
|
||||
// setCurrentFile(szProjectName);
|
||||
// updateWindowTitle();
|
||||
}
|
||||
}
|
||||
void cMainWindow::onFileNew()
|
||||
{
|
||||
// if(m_bSomethingChanged)
|
||||
// {
|
||||
// switch(QMessageBox::question(this, tr("Save"), m_lpStoryBook->title() + tr(" has been changed.\nDo you want to save?"), QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel))
|
||||
// {
|
||||
// case QMessageBox::Yes:
|
||||
// if(!onFileSave())
|
||||
// return;
|
||||
// break;
|
||||
// case QMessageBox::No:
|
||||
// break;
|
||||
// case QMessageBox::Cancel:
|
||||
// return;
|
||||
// default:
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
|
||||
// ui->m_lpMdiArea->closeAllSubWindows();
|
||||
|
||||
// if(m_lpStoryBook)
|
||||
// delete m_lpStoryBook;
|
||||
|
||||
// m_lpStoryBook = new cStoryBook;
|
||||
|
||||
// m_lpStoryBook->fillOutlineList(ui->m_lpOutlineList);
|
||||
// m_lpStoryBook->fillCharacterList(ui->m_lpCharacterList);
|
||||
// m_lpStoryBook->fillPlaceList(ui->m_lpPlaceList);
|
||||
// m_lpStoryBook->fillObjectList(ui->m_lpObjectList);
|
||||
// m_lpStoryBook->fillRechercheList(ui->m_lpRechercheList);
|
||||
|
||||
// updateWindowTitle();
|
||||
}
|
||||
|
||||
void cMainWindow::onFileOpen()
|
||||
{
|
||||
// if(m_lpStoryBook)
|
||||
// {
|
||||
// if(m_bSomethingChanged)
|
||||
// {
|
||||
// switch(QMessageBox::question(this, tr("Save"), m_lpStoryBook->title() + tr(" has been changed.\nDo you want to save?"), QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel))
|
||||
// {
|
||||
// case QMessageBox::Yes:
|
||||
// if(!onFileSave())
|
||||
// return;
|
||||
// break;
|
||||
// case QMessageBox::No:
|
||||
// break;
|
||||
// case QMessageBox::Cancel:
|
||||
// return;
|
||||
// default:
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// QString szProjectName = getProjectLoadName();
|
||||
// if(szProjectName.isEmpty())
|
||||
// return;
|
||||
|
||||
// ui->m_lpMdiArea->closeAllSubWindows();
|
||||
|
||||
// if(m_lpStoryBook)
|
||||
// delete m_lpStoryBook;
|
||||
|
||||
// m_lpStoryBook = new cStoryBook(szProjectName);
|
||||
|
||||
// m_lpStoryBook->fillOutlineList(ui->m_lpOutlineList);
|
||||
// m_lpStoryBook->fillCharacterList(ui->m_lpCharacterList);
|
||||
// m_lpStoryBook->fillPlaceList(ui->m_lpPlaceList);
|
||||
// m_lpStoryBook->fillObjectList(ui->m_lpObjectList);
|
||||
// m_lpStoryBook->fillRechercheList(ui->m_lpRechercheList);
|
||||
|
||||
// setCurrentFile(szProjectName);
|
||||
// updateWindowTitle();
|
||||
}
|
||||
|
||||
void cMainWindow::onFileImport()
|
||||
{
|
||||
cImportDialog importDialog(this);
|
||||
|
||||
QSettings settings;
|
||||
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(iX != -1 && iY != -1)
|
||||
importDialog.move(iX, iY);
|
||||
if(iWidth != -1 && iHeight != -1)
|
||||
importDialog.resize(iWidth, iHeight);
|
||||
|
||||
if(importDialog.exec() == QDialog::Rejected)
|
||||
return;
|
||||
|
||||
settings.setValue("import/width", QVariant::fromValue(importDialog.size().width()));
|
||||
settings.setValue("import/height", QVariant::fromValue(importDialog.size().height()));
|
||||
settings.setValue("import/x", QVariant::fromValue(importDialog.x()));
|
||||
settings.setValue("import/y", QVariant::fromValue(importDialog.y()));
|
||||
}
|
||||
|
||||
@@ -14,6 +14,9 @@
|
||||
#include <QStandardItemModel>
|
||||
#include <QItemSelection>
|
||||
|
||||
#include <QMenu>
|
||||
#include <QToolBar>
|
||||
|
||||
|
||||
namespace Ui {
|
||||
class cMainWindow;
|
||||
@@ -48,6 +51,19 @@ private:
|
||||
cPictureLibrary m_pictureLibrary; /**< TODO: describe */
|
||||
cPictureList m_pictureList; /**< TODO: describe */
|
||||
|
||||
QMenu* m_lpFileMenu; /*!< Pointer to the file menu */
|
||||
|
||||
QToolBar* m_lpFileToolBar; /*!< Pointer to the file toolbar */
|
||||
|
||||
QAction* m_lpFileNewAction; /*!< TODO: describe */
|
||||
QAction* m_lpFileOpenAction; /*!< TODO: describe */
|
||||
QAction* m_lpFileImportAction; /*!< TODO: describe */
|
||||
QAction* m_lpFileQuitAction; /*!< TODO: describe */
|
||||
|
||||
QAction* m_lpSeparatorRecent; /*!< TODO: describe */
|
||||
enum { MaxRecentFiles = 5 }; /*!< TODO: describe */
|
||||
QAction* m_lpRecentFileAction[MaxRecentFiles]; /*!< TODO: describe */
|
||||
|
||||
/*!
|
||||
\brief
|
||||
|
||||
@@ -60,6 +76,33 @@ private:
|
||||
\fn createActions
|
||||
*/
|
||||
void createActions();
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn createFileActions
|
||||
*/
|
||||
void createFileActions();
|
||||
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn setCurrentFile
|
||||
\param szFileName
|
||||
*/
|
||||
void setCurrentFile(const QString& szFileName);
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn updateRecentFileActions
|
||||
*/
|
||||
void updateRecentFileActions();
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn openRecentFile
|
||||
*/
|
||||
void openRecentFile();
|
||||
|
||||
/*!
|
||||
\brief
|
||||
|
||||
@@ -77,7 +120,31 @@ protected:
|
||||
void closeEvent(QCloseEvent* event);
|
||||
|
||||
private slots:
|
||||
/*!
|
||||
\brief
|
||||
\param selection
|
||||
\param previous
|
||||
\fn onThumbnailSelected
|
||||
*/
|
||||
void onThumbnailSelected(const QItemSelection& selection, const QItemSelection& previous);
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn onFileNew
|
||||
*/
|
||||
void onFileNew();
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn onFileOpen
|
||||
*/
|
||||
void onFileOpen();
|
||||
/*!
|
||||
\brief
|
||||
|
||||
\fn onFileImport
|
||||
*/
|
||||
void onFileImport();
|
||||
};
|
||||
|
||||
#endif // CMAINWINDOW_H
|
||||
|
||||
+1
-1
@@ -35,7 +35,7 @@ public:
|
||||
\fn rootPath
|
||||
\return QString
|
||||
*/
|
||||
QString rootPath();
|
||||
QString rootPath();
|
||||
|
||||
/*!
|
||||
\brief
|
||||
|
||||
+7
-4
@@ -33,7 +33,7 @@ win32-g++ {
|
||||
|
||||
unix {
|
||||
message("*nix")
|
||||
-lraw -lexiv2
|
||||
LIBS += -lraw -lexiv2
|
||||
}
|
||||
|
||||
QMAKE_CXXFLAGS += -DLIBRAW_NODLL -DLIBRAW_NOTHREADS
|
||||
@@ -61,7 +61,8 @@ SOURCES += \
|
||||
cpicturelibrary.cpp \
|
||||
cpicture.cpp \
|
||||
cimage.cpp \
|
||||
ctoolboxinfo.cpp
|
||||
ctoolboxinfo.cpp \
|
||||
cimportdialog.cpp
|
||||
|
||||
HEADERS += \
|
||||
cmainwindow.h \
|
||||
@@ -71,11 +72,13 @@ HEADERS += \
|
||||
cpicturelibrary.h \
|
||||
cpicture.h \
|
||||
cimage.h \
|
||||
ctoolboxinfo.h
|
||||
ctoolboxinfo.h \
|
||||
cimportdialog.h
|
||||
|
||||
FORMS += \
|
||||
cmainwindow.ui \
|
||||
ctoolboxinfo.ui
|
||||
ctoolboxinfo.ui \
|
||||
cimportdialog.ui
|
||||
|
||||
# Default rules for deployment.
|
||||
qnx: target.path = /tmp/$${TARGET}/bin
|
||||
|
||||
Reference in New Issue
Block a user