mirror of https://github.com/vitalif/openscad
Clifford Wolf:
Fixed passing of new file as command line argument Some coding style fixes git-svn-id: http://svn.clifford.at/openscad/trunk@180 b57f626f-c46c-0410-a088-ec61d464b74cstl_dim
parent
880c8fcfc0
commit
2ae59b8d65
19
mainwin.cc
19
mainwin.cc
|
@ -294,12 +294,16 @@ MainWindow::~MainWindow()
|
|||
/*!
|
||||
Requests to open a file from an external event, e.g. by double-clicking a filename.
|
||||
*/
|
||||
#ifdef ENABLE_MDI
|
||||
void MainWindow::requestOpenFile(const QString &filename)
|
||||
{
|
||||
#ifdef ENABLE_MDI
|
||||
new MainWindow(filename.toUtf8());
|
||||
#endif
|
||||
}
|
||||
#else
|
||||
void MainWindow::requestOpenFile(const QString &)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
MainWindow::openFile(const QString &new_filename)
|
||||
|
@ -325,19 +329,22 @@ MainWindow::setFileName(const QString &filename)
|
|||
}
|
||||
else {
|
||||
QFileInfo fileinfo(filename);
|
||||
this->fileName = fileinfo.canonicalFilePath();
|
||||
QString infoFileName = fileinfo.canonicalFilePath();
|
||||
setWindowTitle("OpenSCAD - " + fileinfo.fileName() + "[*]");
|
||||
|
||||
// Check that the canonical file path exists - only update recent files
|
||||
// if it does. Should prevent empty list items on initial open etc.
|
||||
if (!this->fileName.isEmpty()) {
|
||||
if (!infoFileName.isEmpty()) {
|
||||
QSettings settings; // already set up properly via main.cpp
|
||||
QStringList files = settings.value("recentFileList").toStringList();
|
||||
files.removeAll(this->fileName);
|
||||
files.prepend(this->fileName);
|
||||
while (files.size() > maxRecentFiles) files.removeLast();
|
||||
|
||||
while (files.size() > maxRecentFiles)
|
||||
files.removeLast();
|
||||
settings.setValue("recentFileList", files);
|
||||
this->fileName = infoFileName;
|
||||
} else {
|
||||
this->fileName = fileinfo.fileName();
|
||||
}
|
||||
|
||||
QDir::setCurrent(fileinfo.dir().absolutePath());
|
||||
|
|
Loading…
Reference in New Issue