Skip to content

Commit

Permalink
Updated recording to propt when user is asked to save.
Browse files Browse the repository at this point in the history
  • Loading branch information
mdfeist committed Jun 21, 2013
1 parent 5ce499a commit 5d65501
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 7 deletions.
8 changes: 8 additions & 0 deletions BlinkAnalysis/MainFormController.cpp
Expand Up @@ -74,3 +74,11 @@ void MainFormController::getFilePath(std::string& pathBuffer, std::string defaul
} }
} }


bool MainFormController::propt(LPCTSTR title, LPCTSTR msg) {
if (MessageBox::Show(gcnew String(msg), gcnew String(title), MessageBoxButtons::YesNo) == DialogResult::Yes) {
return true;
} else {
return false;
}
}

2 changes: 2 additions & 0 deletions BlinkAnalysis/MainFormController.h
Expand Up @@ -46,5 +46,7 @@ public ref class MainFormController sealed :
std::string getSpecialFolderMyDocuments(); std::string getSpecialFolderMyDocuments();
void getFilePath(std::string& pathBuffer); void getFilePath(std::string& pathBuffer);
void getFilePath(std::string& pathBuffer, std::string defaultPath); void getFilePath(std::string& pathBuffer, std::string defaultPath);

bool propt(LPCTSTR title, LPCTSTR msg);
}; };


27 changes: 20 additions & 7 deletions BlinkAnalysis/Recording.cpp
Expand Up @@ -253,15 +253,28 @@ void Recording::closeRecording() {
fileStream.close(); fileStream.close();
} }


std::string filePath; bool save = true;
MainFormController::getInstance()->getFilePath(filePath, Settings::getInstance()->getDefaultProjectDirectory());


if (filePath != "") { if (!MainFormController::getInstance()->propt(L"Save Recording", L"Would you like to save the recording?"))
TCHAR destination[MAX_PATH + 1]; save = false;
MultiByteToWideChar(CP_ACP, 0, filePath.c_str(), -1, destination, filePath.length());


destination[filePath.length()] = 0; while (save) {
std::string filePath;
MainFormController::getInstance()->getFilePath(filePath, Settings::getInstance()->getDefaultProjectDirectory());


MoveFileEx(szTempFileName, destination, MOVEFILE_REPLACE_EXISTING); if (filePath != "") {
TCHAR destination[MAX_PATH + 1];
MultiByteToWideChar(CP_ACP, 0, filePath.c_str(), -1, destination, filePath.length());

destination[filePath.length()] = 0;

MoveFileEx(szTempFileName, destination, MOVEFILE_REPLACE_EXISTING);

save = false;
} else {
if (MainFormController::getInstance()->propt(L"Save Recording", L"Are you sure you would like to continue without saving the recording?")) {
save = false;
}
}
} }
} }

0 comments on commit 5d65501

Please sign in to comment.