reworked progress dialog with percent and check abort to reflect old logics
This commit is contained in:
parent
050153f389
commit
43c10ef42f
@ -150,7 +150,7 @@ int At89sxx::Probe(int probe_size)
|
||||
|
||||
qDebug() << "At89sxx::Probe(" << probe_size << ") IN";
|
||||
|
||||
if (E2Profile::GetIgnoreFlag())
|
||||
if (cmdWin->GetIgnoreFlag())
|
||||
{
|
||||
rv = GetSize();
|
||||
}
|
||||
|
@ -331,7 +331,7 @@ int At90sxx::Probe(int probe_size)
|
||||
|
||||
qDebug() << "At90sxx::Probe(" << probe_size << ") IN";
|
||||
|
||||
if ( E2Profile::GetIgnoreFlag() )
|
||||
if (cmdWin->GetIgnoreFlag())
|
||||
{
|
||||
rv = GetSize();
|
||||
}
|
||||
|
@ -7,8 +7,6 @@
|
||||
// http://ponyprog.sourceforge.net //
|
||||
// //
|
||||
//-------------------------------------------------------------------------//
|
||||
// $Id: busio.cpp,v 1.4 2008/02/04 17:18:20 lancos Exp $
|
||||
//-------------------------------------------------------------------------//
|
||||
// //
|
||||
// This program is free software; you can redistribute it and/or //
|
||||
// modify it under the terms of the GNU General Public License //
|
||||
@ -46,17 +44,17 @@ BusIO::BusIO(BusInterface *p)
|
||||
// it's possible only from one QObject
|
||||
int BusIO::CheckAbort(int progress)
|
||||
{
|
||||
int abort = E2Profile::GetAbortFlag();
|
||||
int abort = cmdWin->GetAbortFlag();
|
||||
|
||||
if (!abort)
|
||||
{
|
||||
if ( (progress == 0 && old_progress != 0) ||
|
||||
progress > old_progress + 4 )
|
||||
{
|
||||
// THEAPP->SetProgress(progress);
|
||||
cmdWin->SetProgress(progress);
|
||||
old_progress = progress;
|
||||
// if (progress == 100)
|
||||
// THEAPP->CheckEvents();
|
||||
//if (progress == 100)
|
||||
// THEAPP->CheckEvents();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -55,7 +55,6 @@
|
||||
//=========================>>> e2App::e2App <<<==========================
|
||||
e2App::e2App() :
|
||||
awip(0),
|
||||
app_status(AppReady),
|
||||
port_number(1)
|
||||
{
|
||||
// Constructor
|
||||
@ -390,114 +389,6 @@ vWindow* e2App::NewAppWin(vWindow* win, char* name,
|
||||
|
||||
#endif
|
||||
|
||||
int e2App::exit_ok = 0;
|
||||
|
||||
//============================>>> e2App::Exit <<<===========================
|
||||
void e2App::Exit()
|
||||
{
|
||||
// This is called to close all windows.
|
||||
|
||||
qDebug() << "e2App::Exit()";
|
||||
|
||||
if ( !IsAppReady() )
|
||||
{
|
||||
//06/09/99
|
||||
E2Profile::SetAbortFlag();
|
||||
// SendWindowCommandAll(idCloseAllDialog, 0, C_Button);
|
||||
// CheckEvents();
|
||||
// SetAppReady();
|
||||
}
|
||||
|
||||
if ( IsAppReady() )
|
||||
{
|
||||
if (!scriptMode)
|
||||
{
|
||||
// EK 2017
|
||||
// TODO
|
||||
// SendWindowCommandAll(idAskToSave, 0, C_Button);
|
||||
}
|
||||
|
||||
exit_ok = 1;
|
||||
|
||||
// Close All registered windows and exit
|
||||
#if 0
|
||||
WindList *curWin;
|
||||
vWindow *tmp;
|
||||
|
||||
bool inExit = true;
|
||||
|
||||
for (curWin = _WindowList ; curWin != 0 ; curWin = _WindowList)
|
||||
{
|
||||
int retv;
|
||||
|
||||
tmp = curWin->window;
|
||||
|
||||
if (IsHelpWin(tmp))
|
||||
{
|
||||
retv = CloseHelpWin(tmp);
|
||||
}
|
||||
else
|
||||
{
|
||||
retv = CloseAppWin(tmp); // use local or derived close app
|
||||
}
|
||||
|
||||
if (!retv)
|
||||
{
|
||||
inExit = false;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (inExit)
|
||||
{
|
||||
AppExit(returnValue);
|
||||
}
|
||||
|
||||
#else
|
||||
qApp->quit();
|
||||
// vApp::Exit(); // Default behavior
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
void e2App::DropFile(const char *fn)
|
||||
{
|
||||
if ( fn && strlen(fn) )
|
||||
{
|
||||
// NewAppWin(0, (char*)fn, DefaultWidth(), DefaultHeight(), 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//=====================>>> e2App::SetAppBusy <<<==============================
|
||||
void e2App::SetAppBusy()
|
||||
{
|
||||
app_status = AppBusy;
|
||||
// EK 2017
|
||||
// TODO
|
||||
// SendWindowCommandAll(idEnableToolBar, 0, C_Button);
|
||||
}
|
||||
|
||||
//=====================>>> e2App::SetAppReady <<<==============================
|
||||
void e2App::SetAppReady()
|
||||
{
|
||||
app_status = AppReady;
|
||||
// EK 2017
|
||||
// TODO
|
||||
// SendWindowCommandAll(idEnableToolBar, 1, C_Button);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//Update the progress bar
|
||||
//=====================>>> e2App::SetProgress <<<==============================
|
||||
void e2App::SetProgress(int progress)
|
||||
{
|
||||
// EK 2017
|
||||
// TODO
|
||||
// SendWindowCommandAll(pbrProgress, progress, C_Button); // The horizontal bar
|
||||
}
|
||||
|
||||
//=====================>>> e2App::Calibration <<<==============================
|
||||
int e2App::Calibration()
|
||||
{
|
||||
|
@ -74,7 +74,6 @@ enum AppStatus
|
||||
AppBusy
|
||||
};
|
||||
|
||||
|
||||
class e2App
|
||||
{
|
||||
public: //---------------------------------------- public
|
||||
@ -87,14 +86,9 @@ public: //---------------------------------------- public
|
||||
// virtual vWindow* NewAppWin(vWindow* win, char* name, int w, int h,
|
||||
// vAppWinInfo* winInfo = 0);
|
||||
|
||||
virtual void Exit();
|
||||
|
||||
// replace about signal - slots
|
||||
// virtual void AppCommand(vWindow* win, ItemVal id, ItemVal val, CmdType cType);
|
||||
|
||||
virtual void DropFile(const char *fn);
|
||||
|
||||
|
||||
// virtual void KeyIn(vWindow*, vKey, unsigned int);
|
||||
|
||||
// New routines for this particular app
|
||||
@ -145,8 +139,6 @@ public: //---------------------------------------- public
|
||||
return err_soundfile.toLatin1();
|
||||
}
|
||||
|
||||
void SetProgress(int progress = 0);
|
||||
|
||||
uint8_t GetPolarity() const
|
||||
{
|
||||
return polarity_control;
|
||||
@ -166,19 +158,6 @@ public: //---------------------------------------- public
|
||||
port_number = port;
|
||||
}
|
||||
}
|
||||
int IsAppBusy()
|
||||
{
|
||||
return (app_status == AppBusy);
|
||||
}
|
||||
int IsAppReady()
|
||||
{
|
||||
return (app_status == AppReady);
|
||||
}
|
||||
|
||||
void SetAppBusy();
|
||||
void SetAppReady();
|
||||
|
||||
|
||||
|
||||
int LoadDriver(int start);
|
||||
|
||||
@ -192,18 +171,15 @@ public: //---------------------------------------- public
|
||||
return awip;
|
||||
}
|
||||
|
||||
|
||||
bool scriptMode; //Script Mode
|
||||
int returnValue; //return value in Command Line mode
|
||||
|
||||
QString script_name;
|
||||
|
||||
protected: //--------------------------------------- protected
|
||||
// AppWinInfo associated with this window
|
||||
e2AppWinInfo* awip;
|
||||
|
||||
protected: //--------------------------------------- protected
|
||||
static int exit_ok;
|
||||
|
||||
private: //--------------------------------------- private
|
||||
void initSettings();
|
||||
void LookForBogoMips(); //should get bogomips
|
||||
@ -220,7 +196,6 @@ private: //--------------------------------------- private
|
||||
BusInterface *busIntp; //pointer to current interface type
|
||||
|
||||
uint8_t polarity_control; //polarity for control lines
|
||||
AppStatus app_status; //tell if the App is busy (reading, writing, ...) or can react to user events
|
||||
|
||||
//AutoTag
|
||||
//List of available interface types
|
||||
|
@ -62,7 +62,7 @@ e2AppWinInfo::e2AppWinInfo(e2CmdWindow *p, const QString &name, BusIO** busvptr)
|
||||
qDebug() << "e2AppWinInfo::e2AppWinInfo()";
|
||||
|
||||
// Constructor
|
||||
cmdWin = static_cast<e2CmdWindow*>(p);
|
||||
// cmdWin = static_cast<e2CmdWindow*>(p);
|
||||
|
||||
fname = "",
|
||||
|
||||
|
@ -286,7 +286,7 @@ public: //---------------------------------------- public
|
||||
}
|
||||
|
||||
protected: //--------------------------------------- protected
|
||||
e2CmdWindow* cmdWin;
|
||||
// e2CmdWindow* cmdWin;
|
||||
|
||||
private: //--------------------------------------- private
|
||||
int OpenBus();
|
||||
|
@ -77,6 +77,8 @@ static QString STR_TITLE = APPNAME + " - ";
|
||||
|
||||
class e2AppWinInfo;
|
||||
|
||||
//Global e2CmdWindow pointer
|
||||
e2CmdWindow *cmdWin;
|
||||
|
||||
// EK 2017
|
||||
// TODO insert this into class
|
||||
@ -97,9 +99,14 @@ void e2CmdWindow::About()
|
||||
e2CmdWindow::e2CmdWindow(QWidget *parent ) :
|
||||
QMainWindow(parent),
|
||||
e2App(),
|
||||
ignoreFlag(false),
|
||||
abortFlag(false),
|
||||
app_status(AppReady),
|
||||
editbuf_enabled(0),
|
||||
verbose(verboseAll)
|
||||
{
|
||||
cmdWin = this;
|
||||
|
||||
setupUi(this);
|
||||
qDebug() << "e2CmdWindow::e2CmdWindow(" << APPNAME << ")";
|
||||
|
||||
@ -252,21 +259,21 @@ e2CmdWindow::~e2CmdWindow()
|
||||
|
||||
|
||||
|
||||
|
||||
#if 0
|
||||
//======================>>> e2CmdWindow::CloseAppWin <<<===========================
|
||||
int e2CmdWindow::CloseAppWin()
|
||||
{
|
||||
if ( !IsAppReady() )
|
||||
if (!IsAppReady())
|
||||
{
|
||||
//06/09/99
|
||||
E2Profile::SetAbortFlag();
|
||||
// SendWindowCommandAll(idCloseAllDialog, 0, C_Button);
|
||||
// CheckEvents();
|
||||
SetAbortFlag();
|
||||
//SendWindowCommandAll(idCloseAllDialog, 0, C_Button);
|
||||
//CheckEvents();
|
||||
|
||||
// SetAppReady();
|
||||
SetAppReady();
|
||||
}
|
||||
|
||||
if ( IsAppReady() )
|
||||
if (IsAppReady())
|
||||
{
|
||||
// This will be called BEFORE a window has been unregistered or
|
||||
// closed. Default behavior: unregister and close the window.
|
||||
@ -274,7 +281,7 @@ int e2CmdWindow::CloseAppWin()
|
||||
|
||||
qDebug() << "e2App::CloseAppWin()";
|
||||
|
||||
if ( !exit_ok && IsBufChanged() )
|
||||
if (!e2CmdWindow::exit_ok && IsBufChanged())
|
||||
{
|
||||
int ret = QMessageBox::warning(this, "PonyProg",
|
||||
STR_MSGCLOSEWINSAVE,
|
||||
@ -288,7 +295,7 @@ int e2CmdWindow::CloseAppWin()
|
||||
|
||||
// EK 2017
|
||||
// TODO now is the winCounter deactivated
|
||||
if (/*winCounter > 1 || */exit_ok)
|
||||
if (/*winCounter > 1 || */ e2CmdWindow::exit_ok)
|
||||
{
|
||||
really_close = 1;
|
||||
}
|
||||
@ -338,6 +345,7 @@ int e2CmdWindow::CloseAppWin()
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
// EK 2017
|
||||
@ -1055,11 +1063,9 @@ void e2CmdWindow::doProgress(const QString &text)
|
||||
return;
|
||||
}
|
||||
|
||||
e2Prg = new QProgressDialog(text, "Abort", 0, 0, this);
|
||||
e2Prg->setRange(0, 0); // for not percentage progress
|
||||
e2Prg = new QProgressDialog(text, "Abort", 0, 100, this);
|
||||
e2Prg->setWindowModality(Qt::WindowModal);
|
||||
connect (e2Prg, SIGNAL(canceled()), this, SLOT(onEndProgress()));
|
||||
e2Prg->show();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1558,7 +1564,8 @@ void e2CmdWindow::onExit()
|
||||
|
||||
void e2CmdWindow::onClose()
|
||||
{
|
||||
CloseAppWin();
|
||||
// CloseAppWin();
|
||||
Exit();
|
||||
}
|
||||
|
||||
|
||||
@ -1679,29 +1686,24 @@ void e2CmdWindow::onWrite()
|
||||
|
||||
void e2CmdWindow::onRead( )
|
||||
{
|
||||
QAction *a = static_cast<QAction*>(sender());
|
||||
|
||||
SetAppBusy();
|
||||
|
||||
if (a == actionReadAll)
|
||||
{
|
||||
SetAppBusy();
|
||||
QAction *a = static_cast<QAction*>(sender());
|
||||
|
||||
if (a == actionReadAll)
|
||||
{
|
||||
CmdRead(ALL_TYPE );
|
||||
return;
|
||||
}
|
||||
|
||||
if (a == actionReadFlash)
|
||||
{
|
||||
CmdRead(PROG_TYPE );
|
||||
return;
|
||||
}
|
||||
|
||||
if (a == actionReadEep)
|
||||
{
|
||||
CmdRead(DATA_TYPE );
|
||||
}
|
||||
|
||||
SetAppReady();
|
||||
CmdRead(ALL_TYPE );
|
||||
}
|
||||
else if (a == actionReadFlash)
|
||||
{
|
||||
CmdRead(PROG_TYPE );
|
||||
}
|
||||
else if (a == actionReadEep)
|
||||
{
|
||||
CmdRead(DATA_TYPE );
|
||||
}
|
||||
|
||||
SetAppReady();
|
||||
}
|
||||
|
||||
|
||||
@ -2396,9 +2398,6 @@ int e2CmdWindow::CmdWrite(int type)
|
||||
//====================>>> e2CmdWindow::CmdRead <<<====================
|
||||
int e2CmdWindow::CmdRead(int type)
|
||||
{
|
||||
|
||||
SetAppBusy();
|
||||
|
||||
if ( IsBufChanged() && awip->IsBufferValid() && verbose == verboseAll)
|
||||
{
|
||||
int ret = QMessageBox::warning(this, "PonyProg",
|
||||
@ -2412,7 +2411,7 @@ int e2CmdWindow::CmdRead(int type)
|
||||
}
|
||||
}
|
||||
|
||||
E2Profile::ClearIgnoreFlag();
|
||||
ClearIgnoreFlag();
|
||||
|
||||
int result;
|
||||
int rval;
|
||||
@ -2441,9 +2440,7 @@ int e2CmdWindow::CmdRead(int type)
|
||||
if ( rval > 0 )
|
||||
{
|
||||
first_line = 0;
|
||||
// curIndex = 0;
|
||||
// EK 2017
|
||||
// TODO
|
||||
//curIndex = 0;
|
||||
Draw();
|
||||
|
||||
QString sp;
|
||||
@ -2469,9 +2466,7 @@ int e2CmdWindow::CmdRead(int type)
|
||||
else
|
||||
{
|
||||
first_line = 0;
|
||||
// curIndex = 0;
|
||||
// EK 2017
|
||||
// TODO
|
||||
//curIndex = 0;
|
||||
Draw();
|
||||
|
||||
qDebug() << "CmdWindow->Read -- Error";
|
||||
@ -2485,26 +2480,24 @@ int e2CmdWindow::CmdRead(int type)
|
||||
if (rval == QMessageBox::Cancel) //Abort
|
||||
{
|
||||
retry_flag = 0;
|
||||
E2Profile::ClearIgnoreFlag();
|
||||
ClearIgnoreFlag();
|
||||
}
|
||||
|
||||
if (rval == QMessageBox::Ok) //Retry
|
||||
{
|
||||
retry_flag = 1;
|
||||
E2Profile::ClearIgnoreFlag();
|
||||
ClearIgnoreFlag();
|
||||
}
|
||||
else if (rval == QMessageBox::Ignore) //Ignore
|
||||
{
|
||||
retry_flag = 1;
|
||||
E2Profile::SetIgnoreFlag();
|
||||
SetIgnoreFlag();
|
||||
}
|
||||
}
|
||||
}
|
||||
} //while (retry_flag)
|
||||
|
||||
E2Profile::ClearIgnoreFlag();
|
||||
|
||||
SetAppReady();
|
||||
ClearIgnoreFlag();
|
||||
|
||||
return result;
|
||||
}
|
||||
@ -2543,7 +2536,7 @@ int e2CmdWindow::CmdWrite(int type, bool verify)
|
||||
int rval;
|
||||
int retry_flag = 1;
|
||||
|
||||
E2Profile::ClearIgnoreFlag();
|
||||
ClearIgnoreFlag();
|
||||
|
||||
while (retry_flag)
|
||||
{
|
||||
@ -2663,24 +2656,24 @@ int e2CmdWindow::CmdWrite(int type, bool verify)
|
||||
if (rval == QMessageBox::Cancel) //Abort
|
||||
{
|
||||
retry_flag = 0;
|
||||
E2Profile::ClearIgnoreFlag();
|
||||
ClearIgnoreFlag();
|
||||
}
|
||||
|
||||
if (rval == QMessageBox::Ok) //Retry
|
||||
{
|
||||
retry_flag = 1;
|
||||
E2Profile::ClearIgnoreFlag();
|
||||
ClearIgnoreFlag();
|
||||
}
|
||||
else if (rval == QMessageBox::Ignore) //Ignore
|
||||
{
|
||||
retry_flag = 1;
|
||||
E2Profile::SetIgnoreFlag();
|
||||
SetIgnoreFlag();
|
||||
}
|
||||
} // if (verbose != verboseNo)
|
||||
}
|
||||
} // while (retry_flag)
|
||||
|
||||
E2Profile::ClearIgnoreFlag();
|
||||
ClearIgnoreFlag();
|
||||
|
||||
//e2Prg->close();
|
||||
emit onEndProgress();
|
||||
@ -2693,7 +2686,7 @@ int e2CmdWindow::CmdWrite(int type, bool verify)
|
||||
//====================>>> e2CmdWindow::CmdReadCalibration <<<====================
|
||||
int e2CmdWindow::CmdReadCalibration(int idx)
|
||||
{
|
||||
E2Profile::ClearIgnoreFlag();
|
||||
ClearIgnoreFlag();
|
||||
|
||||
int result;
|
||||
int rval = 0xFF;
|
||||
@ -2761,18 +2754,18 @@ int e2CmdWindow::CmdReadCalibration(int idx)
|
||||
if (rval == QMessageBox::Cancel) //Abort
|
||||
{
|
||||
retry_flag = 0;
|
||||
E2Profile::ClearIgnoreFlag();
|
||||
ClearIgnoreFlag();
|
||||
}
|
||||
|
||||
if (rval == QMessageBox::Ok) //Retry
|
||||
{
|
||||
retry_flag = 1;
|
||||
E2Profile::ClearIgnoreFlag();
|
||||
ClearIgnoreFlag();
|
||||
}
|
||||
else if (rval == QMessageBox::Ignore) //Ignore
|
||||
{
|
||||
retry_flag = 1;
|
||||
E2Profile::SetIgnoreFlag();
|
||||
SetIgnoreFlag();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2788,31 +2781,31 @@ int e2CmdWindow::CmdReadCalibration(int idx)
|
||||
if (rval == QMessageBox::Cancel) //Abort
|
||||
{
|
||||
retry_flag = 0;
|
||||
E2Profile::ClearIgnoreFlag();
|
||||
ClearIgnoreFlag();
|
||||
}
|
||||
|
||||
if (rval == QMessageBox::Ok) //Retry
|
||||
{
|
||||
retry_flag = 1;
|
||||
E2Profile::ClearIgnoreFlag();
|
||||
ClearIgnoreFlag();
|
||||
}
|
||||
else if (rval == QMessageBox::Ignore) //Ignore
|
||||
{
|
||||
retry_flag = 1;
|
||||
E2Profile::SetIgnoreFlag();
|
||||
SetIgnoreFlag();
|
||||
}
|
||||
}
|
||||
}
|
||||
} //while (retry_flag)
|
||||
|
||||
E2Profile::ClearIgnoreFlag();
|
||||
ClearIgnoreFlag();
|
||||
return result;
|
||||
}
|
||||
|
||||
//====================>>> e2CmdWindow::CmdErase <<<====================
|
||||
int e2CmdWindow::CmdErase(int type)
|
||||
{
|
||||
E2Profile::ClearIgnoreFlag();
|
||||
ClearIgnoreFlag();
|
||||
|
||||
int result;
|
||||
int rval;
|
||||
@ -2865,24 +2858,24 @@ int e2CmdWindow::CmdErase(int type)
|
||||
if (rval == QMessageBox::Cancel) //Abort
|
||||
{
|
||||
retry_flag = 0;
|
||||
E2Profile::ClearIgnoreFlag();
|
||||
ClearIgnoreFlag();
|
||||
}
|
||||
|
||||
if (rval == QMessageBox::Ok) //Retry
|
||||
{
|
||||
retry_flag = 1;
|
||||
E2Profile::ClearIgnoreFlag();
|
||||
ClearIgnoreFlag();
|
||||
}
|
||||
else if (rval == QMessageBox::Ignore) //Ignore
|
||||
{
|
||||
retry_flag = 1;
|
||||
E2Profile::SetIgnoreFlag();
|
||||
SetIgnoreFlag();
|
||||
}
|
||||
}
|
||||
}
|
||||
} //while (retry_flag)
|
||||
|
||||
E2Profile::ClearIgnoreFlag();
|
||||
ClearIgnoreFlag();
|
||||
|
||||
return result;
|
||||
}
|
||||
@ -4483,7 +4476,7 @@ int e2CmdWindow::CmdWriteLock()
|
||||
int rval;
|
||||
int retry_flag = 1;
|
||||
|
||||
E2Profile::ClearIgnoreFlag();
|
||||
ClearIgnoreFlag();
|
||||
|
||||
while (retry_flag)
|
||||
{
|
||||
@ -4529,24 +4522,24 @@ int e2CmdWindow::CmdWriteLock()
|
||||
if (rval == QMessageBox::Cancel) //Abort
|
||||
{
|
||||
retry_flag = 0;
|
||||
E2Profile::ClearIgnoreFlag();
|
||||
ClearIgnoreFlag();
|
||||
}
|
||||
|
||||
if (rval == QMessageBox::Ok) //Retry
|
||||
{
|
||||
retry_flag = 1;
|
||||
E2Profile::ClearIgnoreFlag();
|
||||
ClearIgnoreFlag();
|
||||
}
|
||||
else if (rval == QMessageBox::Ignore) //Ignore
|
||||
{
|
||||
retry_flag = 1;
|
||||
E2Profile::SetIgnoreFlag();
|
||||
SetIgnoreFlag();
|
||||
}
|
||||
} // if (verbose != verboseNo)
|
||||
} // else
|
||||
} // while (retry_flag)
|
||||
|
||||
E2Profile::ClearIgnoreFlag();
|
||||
ClearIgnoreFlag();
|
||||
}
|
||||
|
||||
return result;
|
||||
@ -4558,7 +4551,7 @@ int e2CmdWindow::CmdReadLock()
|
||||
int result = OK;
|
||||
uint32_t bits;
|
||||
|
||||
E2Profile::ClearIgnoreFlag();
|
||||
ClearIgnoreFlag();
|
||||
|
||||
int rval;
|
||||
int retry_flag = 1;
|
||||
@ -4611,24 +4604,24 @@ int e2CmdWindow::CmdReadLock()
|
||||
if (rval == QMessageBox::Cancel) //Abort
|
||||
{
|
||||
retry_flag = 0;
|
||||
E2Profile::ClearIgnoreFlag();
|
||||
ClearIgnoreFlag();
|
||||
}
|
||||
|
||||
if (rval == QMessageBox::Ok) //Retry
|
||||
{
|
||||
retry_flag = 1;
|
||||
E2Profile::ClearIgnoreFlag();
|
||||
ClearIgnoreFlag();
|
||||
}
|
||||
else if (rval == QMessageBox::Ignore) //Ignore
|
||||
{
|
||||
retry_flag = 1;
|
||||
E2Profile::SetIgnoreFlag();
|
||||
SetIgnoreFlag();
|
||||
}
|
||||
}
|
||||
} // else
|
||||
} // while (retry_flag)
|
||||
|
||||
E2Profile::ClearIgnoreFlag();
|
||||
ClearIgnoreFlag();
|
||||
|
||||
return result;
|
||||
}
|
||||
@ -4639,7 +4632,7 @@ int e2CmdWindow::CmdReadSpecial()
|
||||
int result = OK;
|
||||
uint32_t bits;
|
||||
|
||||
E2Profile::ClearIgnoreFlag();
|
||||
ClearIgnoreFlag();
|
||||
|
||||
int rval;
|
||||
int retry_flag = 1;
|
||||
@ -4695,24 +4688,24 @@ int e2CmdWindow::CmdReadSpecial()
|
||||
if (rval == QMessageBox::Cancel) //Abort
|
||||
{
|
||||
retry_flag = 0;
|
||||
E2Profile::ClearIgnoreFlag();
|
||||
ClearIgnoreFlag();
|
||||
}
|
||||
|
||||
if (rval == QMessageBox::Ok) //Retry
|
||||
{
|
||||
retry_flag = 1;
|
||||
E2Profile::ClearIgnoreFlag();
|
||||
ClearIgnoreFlag();
|
||||
}
|
||||
else if (rval == QMessageBox::Ignore) //Ignore
|
||||
{
|
||||
retry_flag = 1;
|
||||
E2Profile::SetIgnoreFlag();
|
||||
SetIgnoreFlag();
|
||||
}
|
||||
}
|
||||
} // else
|
||||
} // while (retry_flag)
|
||||
|
||||
E2Profile::ClearIgnoreFlag();
|
||||
ClearIgnoreFlag();
|
||||
|
||||
return result;
|
||||
}
|
||||
@ -4764,7 +4757,7 @@ int e2CmdWindow::CmdWriteSpecial()
|
||||
{
|
||||
int rval;
|
||||
int retry_flag = 1;
|
||||
E2Profile::ClearIgnoreFlag();
|
||||
ClearIgnoreFlag();
|
||||
|
||||
while (retry_flag)
|
||||
{
|
||||
@ -4816,24 +4809,24 @@ int e2CmdWindow::CmdWriteSpecial()
|
||||
if (rval == QMessageBox::Cancel) //Abort
|
||||
{
|
||||
retry_flag = 0;
|
||||
E2Profile::ClearIgnoreFlag();
|
||||
ClearIgnoreFlag();
|
||||
}
|
||||
|
||||
if (rval == QMessageBox::Ok) //Retry
|
||||
{
|
||||
retry_flag = 1;
|
||||
E2Profile::ClearIgnoreFlag();
|
||||
ClearIgnoreFlag();
|
||||
}
|
||||
else if (rval == QMessageBox::Ignore) //Ignore
|
||||
{
|
||||
retry_flag = 1;
|
||||
E2Profile::SetIgnoreFlag();
|
||||
SetIgnoreFlag();
|
||||
}
|
||||
}
|
||||
} // else
|
||||
} // while (retry_flag)
|
||||
|
||||
E2Profile::ClearIgnoreFlag();
|
||||
ClearIgnoreFlag();
|
||||
}
|
||||
|
||||
return result;
|
||||
@ -6219,3 +6212,121 @@ HIDDEN int FileExist(const QString &name)
|
||||
{
|
||||
return QFile::exists(name);
|
||||
}
|
||||
|
||||
|
||||
bool e2CmdWindow::GetAbortFlag()
|
||||
{
|
||||
//CheckEvents();
|
||||
|
||||
if (e2Prg && e2Prg->wasCanceled())
|
||||
{
|
||||
abortFlag = true;
|
||||
}
|
||||
bool a = abortFlag;
|
||||
abortFlag = false;
|
||||
return a;
|
||||
}
|
||||
|
||||
bool e2CmdWindow::GetIgnoreFlag()
|
||||
{
|
||||
return ignoreFlag;
|
||||
}
|
||||
|
||||
void e2CmdWindow::SetIgnoreFlag()
|
||||
{
|
||||
ignoreFlag = true;
|
||||
}
|
||||
|
||||
void e2CmdWindow::ClearIgnoreFlag()
|
||||
{
|
||||
ignoreFlag = false;
|
||||
}
|
||||
|
||||
//Update the progress bar
|
||||
//=====================>>> e2App::SetProgress <<<==============================
|
||||
void e2CmdWindow::SetProgress(int progress)
|
||||
{
|
||||
// EK 2017
|
||||
// TODO
|
||||
//SendWindowCommandAll(pbrProgress, progress, C_Button); // The horizontal bar
|
||||
e2Prg->setValue(progress);
|
||||
}
|
||||
|
||||
//void e2CmdWindow::DropFile(const char *fn)
|
||||
//{
|
||||
// if ( fn && strlen(fn) )
|
||||
// {
|
||||
// NewAppWin(0, (char*)fn, DefaultWidth(), DefaultHeight(), 0);
|
||||
// }
|
||||
//}
|
||||
|
||||
void e2CmdWindow::SetAppBusy()
|
||||
{
|
||||
app_status = AppBusy;
|
||||
// EK 2017
|
||||
// TODO
|
||||
//SendWindowCommandAll(idEnableToolBar, 0, C_Button);
|
||||
}
|
||||
|
||||
void e2CmdWindow::SetAppReady()
|
||||
{
|
||||
app_status = AppReady;
|
||||
// EK 2017
|
||||
// TODO
|
||||
//SendWindowCommandAll(idEnableToolBar, 1, C_Button);
|
||||
}
|
||||
|
||||
void e2CmdWindow::Exit()
|
||||
{
|
||||
// This is called to close all windows.
|
||||
|
||||
qDebug() << "e2App::Exit()";
|
||||
|
||||
if (!IsAppReady())
|
||||
{
|
||||
//06/09/99
|
||||
SetAbortFlag();
|
||||
//SendWindowCommandAll(idCloseAllDialog, 0, C_Button);
|
||||
//CheckEvents();
|
||||
SetAppReady();
|
||||
}
|
||||
|
||||
if (IsAppReady())
|
||||
{
|
||||
if (!scriptMode)
|
||||
{
|
||||
qDebug() << "e2App::CloseAppWin()";
|
||||
|
||||
if (IsBufChanged())
|
||||
{
|
||||
int ret = QMessageBox::warning(this, "PonyProg",
|
||||
STR_MSGCLOSEWINSAVE,
|
||||
QMessageBox::Yes | QMessageBox::No);
|
||||
|
||||
if ( ret == QMessageBox::Yes )
|
||||
{
|
||||
CmdSave();
|
||||
}
|
||||
}
|
||||
|
||||
// EK 2017
|
||||
// TODO now is the winCounter deactivated
|
||||
//if (winCounter > 1 || exit_ok)
|
||||
//{
|
||||
// really_close = true;
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// int ret = QMessageBox::warning(this, "PonyProg",
|
||||
// STR_MSGCLOSEWINEXIT,
|
||||
// QMessageBox::Yes | QMessageBox::No);
|
||||
// if ( ret == QMessageBox::Yes )
|
||||
// {
|
||||
// really_close = true;
|
||||
// }
|
||||
//}
|
||||
}
|
||||
|
||||
qApp->quit();
|
||||
}
|
||||
}
|
||||
|
@ -88,7 +88,7 @@ class e2CmdWindow : public QMainWindow, public e2App, public Ui::MainWindow
|
||||
public: //---------------------------------------- public
|
||||
e2CmdWindow(QWidget *parent = 0);
|
||||
virtual ~e2CmdWindow();
|
||||
virtual int CloseAppWin();
|
||||
// virtual int CloseAppWin();
|
||||
|
||||
// virtual void WindowCommand(ItemVal id, ItemVal val, CmdType cType);
|
||||
// virtual void KeyIn(vKey keysym, unsigned int shift);
|
||||
@ -114,6 +114,31 @@ public: //---------------------------------------- public
|
||||
return e2Prg;
|
||||
}
|
||||
|
||||
bool GetIgnoreFlag();
|
||||
void SetIgnoreFlag();
|
||||
|
||||
void ClearIgnoreFlag();
|
||||
|
||||
bool GetAbortFlag();
|
||||
void SetAbortFlag(bool a = true)
|
||||
{
|
||||
abortFlag = a;
|
||||
}
|
||||
|
||||
void SetProgress(int progress = 0);
|
||||
|
||||
int IsAppBusy()
|
||||
{
|
||||
return (app_status == AppBusy);
|
||||
}
|
||||
int IsAppReady()
|
||||
{
|
||||
return (app_status == AppReady);
|
||||
}
|
||||
|
||||
void SetAppBusy();
|
||||
void SetAppReady();
|
||||
|
||||
long GetCurrentChipType()
|
||||
{
|
||||
if (awip)
|
||||
@ -126,6 +151,8 @@ public: //---------------------------------------- public
|
||||
}
|
||||
}
|
||||
|
||||
// virtual void DropFile(const char *fn); //TODO use QDrag for drag&drop file into the buffer
|
||||
virtual void Exit();
|
||||
|
||||
private slots:
|
||||
void onNew();
|
||||
@ -200,14 +227,11 @@ private slots:
|
||||
// void setOverwriteMode(bool);
|
||||
// void dataChanged();
|
||||
|
||||
|
||||
public:
|
||||
int CmdHelp();
|
||||
|
||||
|
||||
protected:
|
||||
// void CmdRemoteMode();
|
||||
|
||||
//void CmdRemoteMode();
|
||||
|
||||
private:
|
||||
//All commands
|
||||
@ -314,7 +338,6 @@ private: //--------------------------------------- private
|
||||
int ScriptError(int line_number, int arg_index, char *arg, const QString msg = "");
|
||||
|
||||
|
||||
|
||||
private:
|
||||
int idxI2Cbus8;
|
||||
int idxI2Cbus16;
|
||||
@ -342,7 +365,7 @@ private:
|
||||
|
||||
QLineEdit *txtEEPInfo;
|
||||
QLineEdit *txtStringID;
|
||||
QProgressBar *statusProgress;
|
||||
// QProgressBar *statusProgress;
|
||||
|
||||
// Standard elements
|
||||
QHexEdit* e2HexEdit; // For the canvas
|
||||
@ -354,16 +377,23 @@ private:
|
||||
|
||||
// Index for checking type menu
|
||||
// int type_index;
|
||||
// int curIndex;
|
||||
|
||||
// int exit_ok;
|
||||
|
||||
bool ignoreFlag;
|
||||
bool abortFlag; //True if we have to abort current op
|
||||
|
||||
AppStatus app_status; //tell if the App is busy (reading, writing, ...) or can react to user events
|
||||
|
||||
// Edit buffer enabled (checked the menu)
|
||||
int editbuf_enabled;
|
||||
|
||||
// int curIndex;
|
||||
|
||||
//Verbose mode
|
||||
VerboseType verbose;
|
||||
};
|
||||
|
||||
extern e2CmdWindow *cmdWin;
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -54,7 +54,7 @@ e2Dialog::e2Dialog(QWidget* bw, const QString title)
|
||||
|
||||
setWindowTitle(title);
|
||||
|
||||
cmdWin = (e2CmdWindow*)bw;
|
||||
// cmdWin = (e2CmdWindow*)bw;
|
||||
|
||||
qDebug() << "e2Dialog::e2Dialog()";
|
||||
|
||||
|
@ -74,7 +74,7 @@ private: //--------------------------------------- private
|
||||
QStringList comList;
|
||||
QStringList usbList;
|
||||
|
||||
e2CmdWindow* cmdWin;
|
||||
// e2CmdWindow* cmdWin;
|
||||
int port_no; // Numero della porta utilizzata
|
||||
int lpt_no, com_no;
|
||||
HInterfaceType interf_type;
|
||||
|
@ -7,8 +7,6 @@
|
||||
// http://ponyprog.sourceforge.net //
|
||||
// //
|
||||
//-------------------------------------------------------------------------//
|
||||
// $Id: e2profil.cpp,v 1.22 2016/06/24 15:05:56 lancos Exp $
|
||||
//-------------------------------------------------------------------------//
|
||||
// //
|
||||
// This program is free software; you can redistribute it and/or //
|
||||
// modify it under the terms of the GNU General Public License //
|
||||
@ -42,9 +40,6 @@
|
||||
|
||||
QString E2Profile::filename = "e2p.ini";
|
||||
|
||||
int E2Profile::ignoreFlag = 0;
|
||||
int E2Profile::abortFlag = 0;
|
||||
|
||||
QSettings* E2Profile::s = new QSettings("e2p.ini", QSettings::IniFormat);
|
||||
|
||||
|
||||
@ -73,34 +68,6 @@ E2Profile::~E2Profile()
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
//=====================>>> e2App::GetAbortFlag <<<==============================
|
||||
int E2Profile::GetAbortFlag()
|
||||
{
|
||||
// CheckEvents();
|
||||
|
||||
int a = abortFlag;
|
||||
abortFlag = 0;
|
||||
return a;
|
||||
}
|
||||
|
||||
int E2Profile::GetIgnoreFlag()
|
||||
{
|
||||
return ignoreFlag;
|
||||
}
|
||||
|
||||
void E2Profile::SetIgnoreFlag()
|
||||
{
|
||||
ignoreFlag = 1;
|
||||
}
|
||||
|
||||
|
||||
void E2Profile::ClearIgnoreFlag()
|
||||
{
|
||||
ignoreFlag = 0;
|
||||
}
|
||||
|
||||
|
||||
int E2Profile::GetBogoMips()
|
||||
{
|
||||
QString sp = s->value("BogoMipsX1000", "0").toString();
|
||||
|
@ -7,8 +7,6 @@
|
||||
// http://ponyprog.sourceforge.net //
|
||||
// //
|
||||
//-------------------------------------------------------------------------//
|
||||
// $Id: e2profil.h,v 1.16 2016/06/24 12:21:06 lancos Exp $
|
||||
//-------------------------------------------------------------------------//
|
||||
// //
|
||||
// This program is free software; you can redistribute it and/or //
|
||||
// modify it under the terms of the GNU General Public License //
|
||||
@ -243,17 +241,6 @@ public: //---------------------------------------- public
|
||||
static int GetGpioPinDataIn();
|
||||
static int GetGpioPinDataOut();
|
||||
|
||||
static int GetIgnoreFlag();
|
||||
static void SetIgnoreFlag();
|
||||
|
||||
static void ClearIgnoreFlag();
|
||||
|
||||
static int GetAbortFlag();
|
||||
static void SetAbortFlag(int a = 1)
|
||||
{
|
||||
abortFlag = a;
|
||||
}
|
||||
|
||||
static void SetGpioPinCtrl(int pin);
|
||||
static void SetGpioPinClock(int pin);
|
||||
static void SetGpioPinDataIn(int pin);
|
||||
@ -263,9 +250,7 @@ protected: //--------------------------------------- protected
|
||||
|
||||
private: //--------------------------------------- private
|
||||
static QSettings *s;
|
||||
static int ignoreFlag;
|
||||
static int abortFlag; //True if we have to abort current op
|
||||
static QString filename; //name of .INI file
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -7,8 +7,6 @@
|
||||
// http://ponyprog.sourceforge.net //
|
||||
// //
|
||||
//-------------------------------------------------------------------------//
|
||||
// $Id: e2app.h,v 1.12 2016/05/27 11:22:51 lancos Exp $
|
||||
//-------------------------------------------------------------------------//
|
||||
// //
|
||||
// This program is free software; you can redistribute it and/or //
|
||||
// modify it under the terms of the GNU General Public License //
|
||||
@ -35,7 +33,6 @@
|
||||
|
||||
#include "e2cmdw.h"
|
||||
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
QApplication app(argc, argv);
|
||||
|
@ -146,7 +146,7 @@ int Pic168xx::Probe(int probe_size)
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( E2Profile::GetIgnoreFlag() )
|
||||
if (cmdWin->GetIgnoreFlag())
|
||||
{
|
||||
rv = GetSize();
|
||||
}
|
||||
@ -154,7 +154,7 @@ int Pic168xx::Probe(int probe_size)
|
||||
{
|
||||
if (rv == OK)
|
||||
{
|
||||
if ( GetE2PSubType( GetAWInfo()->GetEEPId()) == subtype )
|
||||
if ( GetE2PSubType(GetAWInfo()->GetEEPId()) == subtype )
|
||||
{
|
||||
rv = GetSize();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user