Create new process when you open new pattern and have usaved chages in current.

--HG--
branch : develop
This commit is contained in:
dismine 2014-10-23 12:13:18 +03:00
parent a5e980e369
commit 5545eafb6e
5 changed files with 24 additions and 16 deletions

View File

@ -80,7 +80,14 @@ void VApplication::NewValentina(const QString &fileName)
QProcess *v = new QProcess();
QStringList arguments;
arguments << fileName;
v->startDetached(QCoreApplication::applicationFilePath(), arguments);
if (fileName.isEmpty())
{
v->startDetached(QCoreApplication::applicationFilePath());
}
else
{
v->startDetached(QCoreApplication::applicationFilePath(), arguments);
}
delete v;
}

View File

@ -55,7 +55,7 @@ class VApplication : public QApplication
public:
VApplication(int &argc, char ** argv);
virtual ~VApplication() {}
static void NewValentina(const QString &fileName);
static void NewValentina(const QString &fileName = QString());
static void CheckFactor(qreal &oldFactor, const qreal &Newfactor);
virtual bool notify(QObject * receiver, QEvent * event);
Unit patternUnit() const;

View File

@ -195,14 +195,7 @@ int main(int argc, char *argv[])
for (int i=0;i<args.size();++i)
{
if (i == 0)
{
w.LoadPattern(args.at(i));
}
else
{
VApplication::NewValentina(args.at(i));
}
w.LoadPattern(args.at(i));
}
return app.exec();

View File

@ -1616,12 +1616,7 @@ void MainWindow::UpdateSizesList(const QStringList &list)
*/
void MainWindow::NewPattern()
{
if (this->isWindowModified() || curFile.isEmpty() == false)
{
QProcess *v = new QProcess(this);
v->startDetached(QCoreApplication::applicationFilePath ());
delete v;
}
OpenNewValentina();
}
//---------------------------------------------------------------------------------------------------------------------
@ -2058,6 +2053,15 @@ void MainWindow::PropertyBrowser()
connect(doc, &VPattern::FullUpdateFromFile, toolOptions, &VToolOptionsPropertyBrowser::UpdateOptions);
}
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::OpenNewValentina(const QString &fileName) const
{
if (this->isWindowModified() || curFile.isEmpty() == false)
{
VApplication::NewValentina(fileName);
}
}
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::CreateActions()
{
@ -2166,6 +2170,9 @@ MainWindow::~MainWindow()
*/
void MainWindow::LoadPattern(const QString &fileName)
{
//We have unsaved changes or load more then one file per time
OpenNewValentina(fileName);
// On this stage scene empty. Fit scene size to view size
VAbstractTool::NewSceneRect(sceneDraw, ui->view);
VAbstractTool::NewSceneRect(sceneDetails, ui->view);

View File

@ -252,6 +252,7 @@ private:
void AddDocks();
void PropertyBrowser();
void OpenNewValentina(const QString &fileName = QString())const;
};
#endif // MAINWINDOW_H