prevent crash if no tab is present.
This commit is contained in:
@@ -2593,7 +2593,11 @@ void PTextEdit::musrView()
|
|||||||
}
|
}
|
||||||
|
|
||||||
QString cmd = fAdmin->getExecPath() + "/musrview";
|
QString cmd = fAdmin->getExecPath() + "/musrview";
|
||||||
QString workDir = QFileInfo(*fFilenames.find( currentEditor() )).absolutePath();
|
QString fln="./";
|
||||||
|
PSubTextEdit *ce = currentEditor();
|
||||||
|
if (ce != nullptr)
|
||||||
|
fln = *fFilenames.find(currentEditor());
|
||||||
|
QString workDir = QFileInfo(fln).absolutePath();
|
||||||
QStringList arg;
|
QStringList arg;
|
||||||
QString str;
|
QString str;
|
||||||
|
|
||||||
@@ -2662,7 +2666,11 @@ void PTextEdit::musrView2Dat()
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
QString cmd = fAdmin->getExecPath() + "/musrview";
|
QString cmd = fAdmin->getExecPath() + "/musrview";
|
||||||
QString workDir = QFileInfo(*fFilenames.find( currentEditor() )).absolutePath();
|
QString fln="./";
|
||||||
|
PSubTextEdit *ce = currentEditor();
|
||||||
|
if (ce != nullptr)
|
||||||
|
fln = *fFilenames.find(currentEditor());
|
||||||
|
QString workDir = QFileInfo(fln).absolutePath();
|
||||||
QStringList arg;
|
QStringList arg;
|
||||||
|
|
||||||
for (auto it : flns) {
|
for (auto it : flns) {
|
||||||
@@ -2729,7 +2737,7 @@ void PTextEdit::musrT0()
|
|||||||
}
|
}
|
||||||
|
|
||||||
QString cmd = fAdmin->getExecPath() + "/musrt0";
|
QString cmd = fAdmin->getExecPath() + "/musrt0";
|
||||||
QString workDir = QFileInfo(*fFilenames.find( currentEditor() )).absolutePath();
|
QString workDir = QFileInfo(*fFilenames.find(currentEditor())).absolutePath();
|
||||||
QStringList arg;
|
QStringList arg;
|
||||||
QString str;
|
QString str;
|
||||||
|
|
||||||
@@ -2782,6 +2790,9 @@ void PTextEdit::musrT0()
|
|||||||
*/
|
*/
|
||||||
void PTextEdit::musrFT()
|
void PTextEdit::musrFT()
|
||||||
{
|
{
|
||||||
|
PSubTextEdit *ce = currentEditor();
|
||||||
|
if (ce == nullptr)
|
||||||
|
return;
|
||||||
|
|
||||||
PGetMusrFTOptionsDialog *dlg = new PGetMusrFTOptionsDialog(*fFilenames.find( currentEditor() ), fMusrFTPrevCmd, fAdmin->getHelpUrl("musrFT"));
|
PGetMusrFTOptionsDialog *dlg = new PGetMusrFTOptionsDialog(*fFilenames.find( currentEditor() ), fMusrFTPrevCmd, fAdmin->getHelpUrl("musrFT"));
|
||||||
|
|
||||||
@@ -2903,7 +2914,7 @@ void PTextEdit::musrSetSteps()
|
|||||||
#if defined(Q_OS_DARWIN)
|
#if defined(Q_OS_DARWIN)
|
||||||
cmd = QString("/Applications/musrStep.app/Contents/MacOS/musrStep");
|
cmd = QString("/Applications/musrStep.app/Contents/MacOS/musrStep");
|
||||||
#endif
|
#endif
|
||||||
QString workDir = QFileInfo(*fFilenames.find( currentEditor() )).absolutePath();
|
QString workDir = QFileInfo(*fFilenames.find( currentEditor())).absolutePath();
|
||||||
QStringList arg;
|
QStringList arg;
|
||||||
QString str;
|
QString str;
|
||||||
|
|
||||||
@@ -3093,7 +3104,11 @@ void PTextEdit::mupp()
|
|||||||
|
|
||||||
QProcess *proc = new QProcess(this);
|
QProcess *proc = new QProcess(this);
|
||||||
|
|
||||||
QString workDir = QFileInfo(*fFilenames.find( currentEditor() )).absolutePath();
|
QString fln="./";
|
||||||
|
PSubTextEdit *ce = currentEditor();
|
||||||
|
if (ce != nullptr)
|
||||||
|
fln = *fFilenames.find(currentEditor());
|
||||||
|
QString workDir = QFileInfo(fln).absolutePath();
|
||||||
|
|
||||||
// make sure that the system environment variables are properly set
|
// make sure that the system environment variables are properly set
|
||||||
QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
|
QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
|
||||||
|
|||||||
@@ -2585,12 +2585,16 @@ void PTextEdit::musrView()
|
|||||||
}
|
}
|
||||||
|
|
||||||
QString cmd = fAdmin->getExecPath() + "/musrview";
|
QString cmd = fAdmin->getExecPath() + "/musrview";
|
||||||
QString workDir = QFileInfo(*fFilenames.find( currentEditor() )).absolutePath();
|
QString fln="./";
|
||||||
|
PSubTextEdit *ce = currentEditor();
|
||||||
|
if (ce != nullptr)
|
||||||
|
fln = *fFilenames.find(currentEditor());
|
||||||
|
QString workDir = QFileInfo(fln).absolutePath();
|
||||||
QStringList arg;
|
QStringList arg;
|
||||||
QString str;
|
QString str;
|
||||||
|
|
||||||
// file name
|
// file name
|
||||||
str = *fFilenames.find( currentEditor() );
|
str = fln;
|
||||||
int pos = str.lastIndexOf("/");
|
int pos = str.lastIndexOf("/");
|
||||||
if (pos != -1)
|
if (pos != -1)
|
||||||
str.remove(0, pos+1);
|
str.remove(0, pos+1);
|
||||||
@@ -2650,7 +2654,11 @@ void PTextEdit::musrView2Dat()
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
QString cmd = fAdmin->getExecPath() + "/musrview";
|
QString cmd = fAdmin->getExecPath() + "/musrview";
|
||||||
QString workDir = QFileInfo(*fFilenames.find( currentEditor() )).absolutePath();
|
QString fln="./";
|
||||||
|
PSubTextEdit *ce = currentEditor();
|
||||||
|
if (ce != nullptr)
|
||||||
|
fln = *fFilenames.find(currentEditor());
|
||||||
|
QString workDir = QFileInfo(fln).absolutePath();
|
||||||
QStringList arg;
|
QStringList arg;
|
||||||
|
|
||||||
for (auto it : flns) {
|
for (auto it : flns) {
|
||||||
@@ -2717,12 +2725,12 @@ void PTextEdit::musrT0()
|
|||||||
}
|
}
|
||||||
|
|
||||||
QString cmd = fAdmin->getExecPath() + "/musrt0";
|
QString cmd = fAdmin->getExecPath() + "/musrt0";
|
||||||
QString workDir = QFileInfo(*fFilenames.find( currentEditor() )).absolutePath();
|
QString workDir = QFileInfo(*fFilenames.find(currentEditor())).absolutePath();
|
||||||
QStringList arg;
|
QStringList arg;
|
||||||
QString str;
|
QString str;
|
||||||
|
|
||||||
// file name
|
// file name
|
||||||
str = *fFilenames.find( currentEditor() );
|
str = *fFilenames.find(currentEditor());
|
||||||
int pos = str.lastIndexOf("/");
|
int pos = str.lastIndexOf("/");
|
||||||
if (pos != -1)
|
if (pos != -1)
|
||||||
str.remove(0, pos+1);
|
str.remove(0, pos+1);
|
||||||
@@ -2763,8 +2771,11 @@ void PTextEdit::musrT0()
|
|||||||
*/
|
*/
|
||||||
void PTextEdit::musrFT()
|
void PTextEdit::musrFT()
|
||||||
{
|
{
|
||||||
|
PSubTextEdit *ce = currentEditor();
|
||||||
|
if (ce == nullptr)
|
||||||
|
return;
|
||||||
|
|
||||||
PGetMusrFTOptionsDialog *dlg = new PGetMusrFTOptionsDialog(*fFilenames.find( currentEditor() ), fMusrFTPrevCmd, fAdmin->getHelpUrl("musrFT"));
|
PGetMusrFTOptionsDialog *dlg = new PGetMusrFTOptionsDialog(*fFilenames.find(currentEditor()), fMusrFTPrevCmd, fAdmin->getHelpUrl("musrFT"));
|
||||||
|
|
||||||
if (dlg == nullptr) {
|
if (dlg == nullptr) {
|
||||||
QMessageBox::critical(this, "ERROR musrFT", "Couldn't invoke musrFT Options Dialog.");
|
QMessageBox::critical(this, "ERROR musrFT", "Couldn't invoke musrFT Options Dialog.");
|
||||||
@@ -2877,12 +2888,12 @@ void PTextEdit::musrSetSteps()
|
|||||||
#if defined(Q_OS_DARWIN)
|
#if defined(Q_OS_DARWIN)
|
||||||
cmd = QString("/Applications/musrStep.app/Contents/MacOS/musrStep");
|
cmd = QString("/Applications/musrStep.app/Contents/MacOS/musrStep");
|
||||||
#endif
|
#endif
|
||||||
QString workDir = QFileInfo(*fFilenames.find( currentEditor() )).absolutePath();
|
QString workDir = QFileInfo(*fFilenames.find(currentEditor())).absolutePath();
|
||||||
QStringList arg;
|
QStringList arg;
|
||||||
QString str;
|
QString str;
|
||||||
|
|
||||||
// get file name and feed it to the command queue
|
// get file name and feed it to the command queue
|
||||||
str = *fFilenames.find( currentEditor() );
|
str = *fFilenames.find(currentEditor());
|
||||||
int pos = str.lastIndexOf("/");
|
int pos = str.lastIndexOf("/");
|
||||||
if (pos != -1)
|
if (pos != -1)
|
||||||
str.remove(0, pos+1);
|
str.remove(0, pos+1);
|
||||||
@@ -3064,7 +3075,11 @@ void PTextEdit::mupp()
|
|||||||
|
|
||||||
QProcess *proc = new QProcess(this);
|
QProcess *proc = new QProcess(this);
|
||||||
|
|
||||||
QString workDir = QFileInfo(*fFilenames.find( currentEditor() )).absolutePath();
|
QString fln="./";
|
||||||
|
PSubTextEdit *ce = currentEditor();
|
||||||
|
if (ce != nullptr)
|
||||||
|
fln = *fFilenames.find(currentEditor());
|
||||||
|
QString workDir = QFileInfo(fln).absolutePath();
|
||||||
|
|
||||||
// make sure that the system environment variables are properly set
|
// make sure that the system environment variables are properly set
|
||||||
QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
|
QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
|
||||||
|
|||||||
Reference in New Issue
Block a user