Merged muonspin/musrfit:root6 into master
This commit is contained in:
commit
aa6579af41
@ -1061,9 +1061,9 @@ void PTextEdit::fileOpen()
|
|||||||
tr( "msr-Files (*.msr);;msr-Files (*.msr *.mlog);;All Files (*)" ));
|
tr( "msr-Files (*.msr);;msr-Files (*.msr *.mlog);;All Files (*)" ));
|
||||||
|
|
||||||
QStringList::Iterator it = flns.begin();
|
QStringList::Iterator it = flns.begin();
|
||||||
QFileInfo finfo1, finfo2;
|
QFileInfo finfo1;
|
||||||
QString tabFln;
|
|
||||||
bool alreadyOpen = false;
|
bool alreadyOpen = false;
|
||||||
|
int idx;
|
||||||
|
|
||||||
// if flns are present, keep the corresponding directory
|
// if flns are present, keep the corresponding directory
|
||||||
if (flns.size() > 0) {
|
if (flns.size() > 0) {
|
||||||
@ -1074,20 +1074,14 @@ void PTextEdit::fileOpen()
|
|||||||
while( it != flns.end() ) {
|
while( it != flns.end() ) {
|
||||||
// check if the file is not already open
|
// check if the file is not already open
|
||||||
finfo1.setFile(*it);
|
finfo1.setFile(*it);
|
||||||
for (int i=0; i<fTabWidget->count(); i++) {
|
alreadyOpen = fileAlreadyOpen(finfo1, idx);
|
||||||
tabFln = *fFilenames.find( dynamic_cast<PSubTextEdit*>(fTabWidget->widget(i)));
|
|
||||||
finfo2.setFile(tabFln);
|
|
||||||
if (finfo1.absoluteFilePath() == finfo2.absoluteFilePath()) {
|
|
||||||
alreadyOpen = true;
|
|
||||||
fTabWidget->setCurrentIndex(i);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!alreadyOpen)
|
if (!alreadyOpen) {
|
||||||
load(*it);
|
load(*it);
|
||||||
else
|
} else {
|
||||||
|
fTabWidget->setCurrentIndex(idx);
|
||||||
fileReload();
|
fileReload();
|
||||||
|
}
|
||||||
|
|
||||||
++it;
|
++it;
|
||||||
}
|
}
|
||||||
@ -1368,8 +1362,13 @@ void PTextEdit::filePrint()
|
|||||||
*/
|
*/
|
||||||
void PTextEdit::fileClose(const bool check)
|
void PTextEdit::fileClose(const bool check)
|
||||||
{
|
{
|
||||||
|
// first check if there is any tab present
|
||||||
|
if (fTabWidget->count()==0) // no tabs present
|
||||||
|
return;
|
||||||
|
|
||||||
// check if the has modification
|
// check if the has modification
|
||||||
int idx = fTabWidget->currentIndex();
|
int idx = fTabWidget->currentIndex();
|
||||||
|
|
||||||
if ((fTabWidget->tabText(idx).indexOf("*")>0) && check) {
|
if ((fTabWidget->tabText(idx).indexOf("*")>0) && check) {
|
||||||
int result = QMessageBox::warning(this, "**WARNING**",
|
int result = QMessageBox::warning(this, "**WARNING**",
|
||||||
"Do you really want to close this file.\nChanges will be lost",
|
"Do you really want to close this file.\nChanges will be lost",
|
||||||
@ -2053,7 +2052,6 @@ void PTextEdit::musrMsr2Data()
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (dlg->exec() == QDialog::Accepted) {
|
if (dlg->exec() == QDialog::Accepted) {
|
||||||
QString first, last;
|
|
||||||
QString runList;
|
QString runList;
|
||||||
QString runListFileName;
|
QString runListFileName;
|
||||||
QFileInfo fi;
|
QFileInfo fi;
|
||||||
@ -2246,6 +2244,9 @@ void PTextEdit::musrMsr2Data()
|
|||||||
QString fln;
|
QString fln;
|
||||||
QFile *file;
|
QFile *file;
|
||||||
QTextStream *stream;
|
QTextStream *stream;
|
||||||
|
QFileInfo finfo;
|
||||||
|
bool alreadOpen=false;
|
||||||
|
int idx=0;
|
||||||
|
|
||||||
if (!fMsr2DataParam->global) { // standard fits
|
if (!fMsr2DataParam->global) { // standard fits
|
||||||
switch(dlg->getRunTag()) {
|
switch(dlg->getRunTag()) {
|
||||||
@ -2264,7 +2265,14 @@ void PTextEdit::musrMsr2Data()
|
|||||||
if (fTabWidget->count() != 0) {
|
if (fTabWidget->count() != 0) {
|
||||||
workDir = QFileInfo(*fFilenames.find( currentEditor() )).absolutePath();
|
workDir = QFileInfo(*fFilenames.find( currentEditor() )).absolutePath();
|
||||||
}
|
}
|
||||||
|
finfo.setFile(workDir + "/" + fln);
|
||||||
|
alreadOpen = fileAlreadyOpen(finfo, idx);
|
||||||
|
if (!alreadOpen) {
|
||||||
load(workDir + "/" + fln);
|
load(workDir + "/" + fln);
|
||||||
|
} else {
|
||||||
|
fTabWidget->setCurrentIndex(idx);
|
||||||
|
fileReload();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 1: // run list file
|
case 1: // run list file
|
||||||
@ -2290,7 +2298,14 @@ void PTextEdit::musrMsr2Data()
|
|||||||
if (fTabWidget->count() != 0) {
|
if (fTabWidget->count() != 0) {
|
||||||
workDir = QFileInfo(*fFilenames.find( currentEditor() )).absolutePath();
|
workDir = QFileInfo(*fFilenames.find( currentEditor() )).absolutePath();
|
||||||
}
|
}
|
||||||
|
finfo.setFile(workDir + "/" + fln);
|
||||||
|
alreadOpen = fileAlreadyOpen(finfo, idx);
|
||||||
|
if (!alreadOpen) {
|
||||||
load(workDir + "/" + fln);
|
load(workDir + "/" + fln);
|
||||||
|
} else {
|
||||||
|
fTabWidget->setCurrentIndex(idx);
|
||||||
|
fileReload();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3196,6 +3211,32 @@ QStringList PTextEdit::getRunList(QString runListStr, bool &ok)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------------------------
|
||||||
|
/**
|
||||||
|
* @brief PTextEdit::fileAlreadyOpen
|
||||||
|
* @param finfo
|
||||||
|
* @param idx
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
bool PTextEdit::fileAlreadyOpen(QFileInfo &finfo, int &idx)
|
||||||
|
{
|
||||||
|
bool result = false;
|
||||||
|
QFileInfo finfo2;
|
||||||
|
QString tabFln;
|
||||||
|
|
||||||
|
for (int i=0; i<fTabWidget->count(); i++) {
|
||||||
|
tabFln = *fFilenames.find( dynamic_cast<PSubTextEdit*>(fTabWidget->widget(i)));
|
||||||
|
finfo2.setFile(tabFln);
|
||||||
|
if (finfo.absoluteFilePath() == finfo2.absoluteFilePath()) {
|
||||||
|
result = true;
|
||||||
|
idx = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------
|
||||||
// END
|
// END
|
||||||
//----------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------
|
||||||
|
@ -38,6 +38,7 @@
|
|||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QVector>
|
#include <QVector>
|
||||||
#include <QProcess>
|
#include <QProcess>
|
||||||
|
#include <QFileInfo>
|
||||||
|
|
||||||
#include <QtDebug>
|
#include <QtDebug>
|
||||||
|
|
||||||
@ -186,6 +187,7 @@ private:
|
|||||||
void getTheme();
|
void getTheme();
|
||||||
void fillRecentFiles();
|
void fillRecentFiles();
|
||||||
QStringList getRunList(QString runListStr, bool &ok);
|
QStringList getRunList(QString runListStr, bool &ok);
|
||||||
|
bool fileAlreadyOpen(QFileInfo &finfo, int &idx);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user