Skip to content

Commit

Permalink
Fixed an issue that prevented saving
Browse files Browse the repository at this point in the history
  • Loading branch information
oblivioncth committed Sep 24, 2019
1 parent 380cf2b commit 62e3d77
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
19 changes: 11 additions & 8 deletions src/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -589,7 +589,7 @@ void MainWindow::updateStatusBar()
if(mCurrentFileName == "")
label_statusBarCurrentFile->setText(STATUS_BAR_NEW_FILE);
else
label_statusBarCurrentFile->setText(QDir::toNativeSeparators(mCurrentFileName));
label_statusBarCurrentFile->setText(QDir::toNativeSeparators(mCurrentFilePath));
}
else
label_statusBarCurrentFile->setText("");
Expand Down Expand Up @@ -641,8 +641,9 @@ void MainWindow::openBSCFile(QFile& bscFile)

if(openReport.wasSuccessful())
{
mCurrentFileName = bscFile.fileName();
mCurrentFileDir = QDir(bscFile.fileName()).absolutePath();
mCurrentFilePath = bscFile.fileName();
mCurrentFileName = QFileInfo(bscFile).fileName();
mCurrentFileDir = QFileInfo(bscFile).absolutePath();
mFileOpen = true;
mBSCPtr = std::make_unique<BSC>(fullFile);
updateBSCTopLevel();
Expand Down Expand Up @@ -978,17 +979,17 @@ void MainWindow::all_on_menuAction_triggered()
// Menu "File"
if(senderAction == ui->actionSave_As)
{
QString saveAsPath = QFileDialog::getSaveFileName(this, tr(MENU_SAVE_AS_TITLE.toStdString().c_str()), mCurrentFileDir,
tr(MENU_FILE_FILTER.toStdString().c_str()));
QString saveAsPath = QFileDialog::getSaveFileName(this, MENU_SAVE_AS_TITLE, mCurrentFilePath, MENU_FILE_FILTER);

if(saveAsPath != "")
{
QFile saveAsFile(saveAsPath);
Qx::IO::IOOpReport saveReport = Qx::IO::writeBytesAsFile(saveAsFile, mBSCPtr->rebuildRawFile(), true);
if(saveReport.wasSuccessful())
{
mCurrentFileDir = QDir(saveAsPath).absolutePath();
mCurrentFileName = saveAsFile.fileName();
mCurrentFilePath = saveAsFile.fileName();
mCurrentFileDir = QFileInfo(saveAsFile).absolutePath();
mCurrentFileName = QFileInfo(saveAsFile).fileName();
setChangesSavedState(true);
updateStatusBar();
QApplication::beep();
Expand All @@ -1009,7 +1010,7 @@ void MainWindow::all_on_menuAction_triggered()
ui->actionSave_As->trigger();
else
{
QString savePath = mCurrentFileDir + mCurrentFileName;
QString savePath = mCurrentFilePath;
QFile saveFile(savePath);
Qx::IO::IOOpReport saveReport = Qx::IO::writeBytesAsFile(saveFile, mBSCPtr->rebuildRawFile(), true);
if(saveReport.wasSuccessful())
Expand Down Expand Up @@ -1038,6 +1039,7 @@ void MainWindow::all_on_menuAction_triggered()

if(makeNew)
{
mCurrentFilePath = "";
mCurrentFileName = "";
mFileOpen = true;
mBSCPtr = std::make_unique<BSC>();
Expand Down Expand Up @@ -1076,6 +1078,7 @@ void MainWindow::all_on_menuAction_triggered()

if(closeFile)
{
mCurrentFilePath = "";
mCurrentFileName = "";
mFileOpen = false;
updateBSCTopLevel();
Expand Down
1 change: 1 addition & 0 deletions src/mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ class MainWindow : public QMainWindow
bool mGaveEffectContainerWarning = false;
QString mCurrentFileDir = QDir::currentPath();
QString mCurrentFileName = "";
QString mCurrentFilePath = QDir::currentPath();

//UI Enable Groups
QWidgetList mEnableGroupTopLevel;
Expand Down

0 comments on commit 62e3d77

Please sign in to comment.