additional lists: scripts list, last files list
This commit is contained in:
parent
a901d2e59d
commit
0eb229e877
@ -571,7 +571,7 @@ int e2AppWinInfo::Read(int type, int raise_power, int leave_on)
|
||||
{
|
||||
qDebug() << "e2AppWinInfo::Read() ** Read = " << rval;
|
||||
|
||||
SetFileName(0); //Questo per evitare che al prossimo save() si utilizzi il nome vecchio
|
||||
SetFileName(""); //Questo per evitare che al prossimo save() si utilizzi il nome vecchio
|
||||
buf_ok = true;
|
||||
buf_changed = false;
|
||||
|
||||
|
@ -135,7 +135,6 @@ e2CmdWindow::e2CmdWindow(QWidget *parent) :
|
||||
setStyleSheet(programStyleSheet);
|
||||
}
|
||||
|
||||
|
||||
createFontSizeMenu();
|
||||
|
||||
// reading of arguments
|
||||
@ -188,6 +187,10 @@ e2CmdWindow::e2CmdWindow(QWidget *parent) :
|
||||
exit(returnValue); //Se AppMain ritorna un valore != 0 esce immediatamente
|
||||
}
|
||||
|
||||
createScriptList();
|
||||
|
||||
createFileList();
|
||||
|
||||
// menu creation for all devices
|
||||
createDeviceMenues();
|
||||
|
||||
@ -391,6 +394,158 @@ int e2CmdWindow::CloseAppWin()
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
* @brief create the list of loaded data files
|
||||
*
|
||||
*/
|
||||
void e2CmdWindow::createFileList()
|
||||
{
|
||||
//EK 2017
|
||||
// TODO to extract datatype from name
|
||||
lastFilesList = E2Profile::GetLastFiles();
|
||||
|
||||
if (lastFilesList.count() == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
filesMenu = new QMenu("Last files"); // TODO translate this
|
||||
actionFileList = menuFile->insertMenu(actionOpen, filesMenu);
|
||||
|
||||
fileListAction = new QActionGroup(this);
|
||||
|
||||
foreach (QString entry, lastFilesList)
|
||||
{
|
||||
if (entry.length() > 0)
|
||||
{
|
||||
int pos_and = entry.lastIndexOf("[");
|
||||
QString fname;
|
||||
QString e;
|
||||
if (pos_and > 0)
|
||||
{
|
||||
fname = entry.left(pos_and);
|
||||
fname = fname.replace(QDir().homePath(), "~/");
|
||||
e = fname + "[" + entry.mid(pos_and + 1) + "]";
|
||||
}
|
||||
else
|
||||
{
|
||||
fname = entry;
|
||||
fname = fname.replace(QDir().homePath(), "~/");
|
||||
e = fname;
|
||||
}
|
||||
|
||||
if (QFile().exists(fname) == true)
|
||||
{
|
||||
QAction *tmpAction = new QAction(e, actionFileList);
|
||||
|
||||
filesMenu->addAction(tmpAction);
|
||||
fileListAction->addAction(tmpAction);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
connect(fileListAction, SIGNAL(triggered(QAction *)), this, SLOT(onSelectFile(QAction *)));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief create the list of used scripts
|
||||
*
|
||||
*/
|
||||
void e2CmdWindow::createScriptList()
|
||||
{
|
||||
lastScriptsList = E2Profile::GetLastScripts();
|
||||
|
||||
if (lastScriptsList.count() == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
scrptsMenu = new QMenu("Last scripts"); // TODO translate this
|
||||
actionScriptList = menuScript->addMenu(scrptsMenu);
|
||||
|
||||
scrListAction = new QActionGroup(this);
|
||||
|
||||
foreach (QString entry, lastScriptsList)
|
||||
{
|
||||
if (entry.length() > 0)
|
||||
{
|
||||
QAction *tmpAction = new QAction(entry, actionScriptList);
|
||||
|
||||
scrptsMenu->addAction(tmpAction);
|
||||
scrListAction->addAction(tmpAction);
|
||||
}
|
||||
}
|
||||
|
||||
connect(scrListAction, SIGNAL(triggered(QAction *)), this, SLOT(onSelectScript(QAction *)));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief slot from flAction
|
||||
* EK 2017
|
||||
* TODO to implement
|
||||
*/
|
||||
void e2CmdWindow::onSelectFile(QAction *a)
|
||||
{
|
||||
QString sp = a->text();
|
||||
|
||||
int pos_and = sp.lastIndexOf("[");
|
||||
QString fname;
|
||||
QString e;
|
||||
if (pos_and > 0)
|
||||
{
|
||||
fname = sp.left(pos_and);
|
||||
// fname = fname.replace(QDir().homePath(), "~/");
|
||||
e = fname + "[" + sp.mid(pos_and + 1) + "]";
|
||||
}
|
||||
else
|
||||
{
|
||||
fname = sp;
|
||||
// fname = fname.replace(QDir().homePath(), "~/");
|
||||
e = fname;
|
||||
}
|
||||
|
||||
if (QFile().exists(fname) == true)
|
||||
{
|
||||
E2Profile::SetLastFile(sp);
|
||||
// load file
|
||||
// TODO Ask about sure or not?
|
||||
|
||||
// EK 2017
|
||||
// to implement
|
||||
// CmdOpen();
|
||||
}
|
||||
else
|
||||
{
|
||||
QMessageBox::critical(this, "File error", translate(STR_MSGFILENOTFOUND), QMessageBox::Close);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief slot from scrAction
|
||||
*
|
||||
*/
|
||||
void e2CmdWindow::onSelectScript(QAction *a)
|
||||
{
|
||||
if (IsAppReady())
|
||||
{
|
||||
SetAppBusy();
|
||||
|
||||
QString sp = a->text();
|
||||
|
||||
if (sp.length() > 0)
|
||||
{
|
||||
script_name = sp;
|
||||
|
||||
CmdRunScript();
|
||||
}
|
||||
|
||||
SetAppReady();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief scan the directory with translations. language files are with .utf extentions
|
||||
@ -2081,13 +2236,16 @@ void e2CmdWindow::onVerify()
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief slot to run the last script
|
||||
*/
|
||||
void e2CmdWindow::onRunScript()
|
||||
{
|
||||
if (IsAppReady())
|
||||
{
|
||||
SetAppBusy();
|
||||
|
||||
QString sp = E2Profile::GetLastScript();
|
||||
QString sp = E2Profile::GetLastScripts().at(0);
|
||||
|
||||
if (sp.length() > 0)
|
||||
{
|
||||
@ -2404,7 +2562,7 @@ void e2CmdWindow::onByteSwap()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
void e2CmdWindow::onLastFile1()
|
||||
{
|
||||
|
||||
@ -2422,7 +2580,7 @@ void e2CmdWindow::onLastFile2()
|
||||
CmdLastFile2();
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
HIDDEN int FileExist(const QString &name);
|
||||
HIDDEN bool CmpExtension(const QString &name, const QString &ext);
|
||||
@ -2490,6 +2648,43 @@ int e2CmdWindow::CmdSaveAs(int type, long relocation)
|
||||
return result;
|
||||
}
|
||||
|
||||
int e2CmdWindow::CmdLastFile()
|
||||
{
|
||||
int result = OK;
|
||||
|
||||
if (verbose == verboseAll)
|
||||
{
|
||||
if (IsBufChanged() && awip->IsBufferValid())
|
||||
{
|
||||
int ret = QMessageBox::warning(this, "PonyProg",
|
||||
"Buffer changed. Save it before to close?",
|
||||
QMessageBox::Yes | QMessageBox::No);
|
||||
|
||||
if (ret == QMessageBox::Yes)
|
||||
{
|
||||
awip->SetSaveType(ALL_TYPE); //??
|
||||
SaveFile();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int data_type;
|
||||
//EK 2017
|
||||
// TODO to extract datatype from name
|
||||
QString s = E2Profile::GetLastFiles().at(0);
|
||||
|
||||
if (s.length())
|
||||
{
|
||||
awip->SetLoadType(data_type);
|
||||
awip->SetLoadAutoClearBuf(E2Profile::GetClearBufBeforeLoad());
|
||||
|
||||
result = OpenFile(s);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
#if 0
|
||||
//====================>>> e2CmdWindow::CmdLastFile1 <<<====================
|
||||
int e2CmdWindow::CmdLastFile1()
|
||||
{
|
||||
@ -2559,7 +2754,7 @@ int e2CmdWindow::CmdLastFile2()
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
//====================>>> e2CmdWindow::CmdReload <<<====================
|
||||
int e2CmdWindow::CmdReload()
|
||||
@ -2580,10 +2775,14 @@ int e2CmdWindow::CmdReload()
|
||||
QString sp;
|
||||
int dt1, dt2;
|
||||
|
||||
sp = E2Profile::GetLastFile(dt1);
|
||||
//EK 2017
|
||||
// TODO to extract datatype from name
|
||||
sp = E2Profile::GetLastFiles().at(0);
|
||||
|
||||
if (sp.length() && FileExist(sp))
|
||||
{
|
||||
|
||||
#if 0
|
||||
sp = E2Profile::GetPrevFile(dt2);
|
||||
|
||||
/*
|
||||
@ -2609,6 +2808,7 @@ int e2CmdWindow::CmdReload()
|
||||
{
|
||||
result = CmdLastFile1();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -6270,12 +6470,35 @@ QString e2CmdWindow::GetFileName()
|
||||
|
||||
void e2CmdWindow::UpdateFileMenu()
|
||||
{
|
||||
QString sp;
|
||||
// QString sp;
|
||||
|
||||
if (!scriptMode)
|
||||
{
|
||||
sp = E2Profile::GetLastScript();
|
||||
QStringList sl = E2Profile::GetLastScripts();
|
||||
|
||||
disconnect(scrListAction, SIGNAL(triggered(QAction *)), this, SLOT(onSelectScript(QAction *)));
|
||||
|
||||
scrptsMenu->clear();
|
||||
// removeAllActions()
|
||||
while (scrListAction->actions().count())
|
||||
{
|
||||
scrListAction->removeAction(scrListAction->actions().first());
|
||||
}
|
||||
|
||||
foreach (QString entry, sl)
|
||||
{
|
||||
if (entry.length())
|
||||
{
|
||||
QAction *tmpAction = new QAction(entry, actionScriptList);
|
||||
|
||||
scrptsMenu->addAction(tmpAction);
|
||||
scrListAction->addAction(tmpAction);
|
||||
}
|
||||
}
|
||||
|
||||
connect(scrListAction, SIGNAL(triggered(QAction *)), this, SLOT(onSelectScript(QAction *)));
|
||||
|
||||
#if 0
|
||||
if (sp.length() > 0)
|
||||
{
|
||||
script_name = sp;
|
||||
@ -6290,8 +6513,54 @@ void e2CmdWindow::UpdateFileMenu()
|
||||
actionRunScript->setText(str);
|
||||
actionRunScript->setEnabled(true);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
//EK 2017
|
||||
// TODO to extract datatype from name?
|
||||
QStringList sf = E2Profile::GetLastFiles();
|
||||
disconnect(fileListAction, SIGNAL(triggered(QAction *)), this, SLOT(onSelectFile(QAction *)));
|
||||
|
||||
filesMenu->clear();
|
||||
// removeAllActions()
|
||||
while (fileListAction->actions().count())
|
||||
{
|
||||
fileListAction->removeAction(fileListAction->actions().first());
|
||||
}
|
||||
|
||||
foreach (QString entry, sf)
|
||||
{
|
||||
if (entry.length())
|
||||
{
|
||||
int pos_and = entry.lastIndexOf("[");
|
||||
QString fname;
|
||||
QString e;
|
||||
if (pos_and > 0)
|
||||
{
|
||||
fname = entry.left(pos_and);
|
||||
fname = fname.replace(QDir().homePath(), "~/");
|
||||
e = fname + "[" + entry.mid(pos_and + 1) + "]";
|
||||
}
|
||||
else
|
||||
{
|
||||
fname = entry;
|
||||
fname = fname.replace(QDir().homePath(), "~/");
|
||||
e = fname;
|
||||
}
|
||||
|
||||
if (QFile().exists(fname) == true)
|
||||
{
|
||||
QAction *tmpAction = new QAction(entry, actionFileList);
|
||||
|
||||
filesMenu->addAction(tmpAction);
|
||||
fileListAction->addAction(tmpAction);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
connect(fileListAction, SIGNAL(triggered(QAction *)), this, SLOT(onSelectFile(QAction *)));
|
||||
|
||||
#if 0
|
||||
int data_type;
|
||||
sp = E2Profile::GetLastFile(data_type);
|
||||
|
||||
@ -6318,14 +6587,15 @@ void e2CmdWindow::UpdateFileMenu()
|
||||
str += " PROG";
|
||||
}
|
||||
|
||||
actionFile1->setEnabled(true);
|
||||
actionFile1->setText(str);
|
||||
}
|
||||
else
|
||||
{
|
||||
actionFile1->setText("");
|
||||
actionFile1->setEnabled(false);
|
||||
// actionFile1->setEnabled(true);
|
||||
// actionFile1->setText(str);
|
||||
lastFiles.insert(0, str);
|
||||
}
|
||||
// else
|
||||
// {
|
||||
// actionFile1->setText("");
|
||||
// actionFile1->setEnabled(false);
|
||||
// }
|
||||
|
||||
sp = E2Profile::GetPrevFile(data_type);
|
||||
|
||||
@ -6360,6 +6630,7 @@ void e2CmdWindow::UpdateFileMenu()
|
||||
actionFile2->setText("");
|
||||
actionFile2->setEnabled(false);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -186,8 +186,8 @@ class e2CmdWindow : public QMainWindow, public e2App, public Ui::MainWindow
|
||||
void onCalibration(); //
|
||||
void onProgram(); //
|
||||
void onByteSwap();
|
||||
void onLastFile1();
|
||||
void onLastFile2();
|
||||
// void onLastFile1();
|
||||
// void onLastFile2();
|
||||
void onDoubleSize();
|
||||
// void onOverwriteMode(bool b);
|
||||
void onWriteHEndurance();
|
||||
@ -234,6 +234,9 @@ class e2CmdWindow : public QMainWindow, public e2App, public Ui::MainWindow
|
||||
void selectFontSize(QAction *mnu);
|
||||
|
||||
void setLang(QAction *mnu);
|
||||
|
||||
void onSelectScript(QAction *a);
|
||||
void onSelectFile(QAction *a);
|
||||
// void setOverwriteMode(bool);
|
||||
// void dataChanged();
|
||||
|
||||
@ -248,8 +251,9 @@ class e2CmdWindow : public QMainWindow, public e2App, public Ui::MainWindow
|
||||
int CmdOpen(int type = ALL_TYPE, const char *file = 0, long relocation = 0, int clear_buffer = -1);
|
||||
int CmdSave(int type = ALL_TYPE, const char *file = 0, long relocation = 0);
|
||||
int CmdSaveAs(int type = ALL_TYPE, long relocation = 0);
|
||||
int CmdLastFile1();
|
||||
int CmdLastFile2();
|
||||
int CmdLastFile();
|
||||
// int CmdLastFile1();
|
||||
// int CmdLastFile2();
|
||||
int CmdReload();
|
||||
int CmdPrint();
|
||||
int CmdRead(int type = ALL_TYPE);
|
||||
@ -298,6 +302,9 @@ class e2CmdWindow : public QMainWindow, public e2App, public Ui::MainWindow
|
||||
void setLangGUI();
|
||||
void translateGUI();
|
||||
|
||||
void createScriptList();
|
||||
void createFileList();
|
||||
|
||||
|
||||
private: //--------------------------------------- private
|
||||
void createSignalSlotConnections();
|
||||
@ -372,8 +379,8 @@ class e2CmdWindow : public QMainWindow, public e2App, public Ui::MainWindow
|
||||
int idxX244;
|
||||
|
||||
QString selectedLang;
|
||||
QStringList lastScripts;
|
||||
QStringList lastFiles;
|
||||
QStringList lastScriptsList;
|
||||
QStringList lastFilesList;
|
||||
|
||||
QFont sysFont;
|
||||
short fontSize;
|
||||
@ -392,6 +399,14 @@ class e2CmdWindow : public QMainWindow, public e2App, public Ui::MainWindow
|
||||
QLineEdit *txtEEPInfo;
|
||||
QLineEdit *txtStringID;
|
||||
// QProgressBar *statusProgress;
|
||||
QMenu *scrptsMenu;
|
||||
QMenu *filesMenu;
|
||||
|
||||
QActionGroup *fileListAction;
|
||||
QActionGroup *scrListAction;
|
||||
|
||||
QAction *actionScriptList;
|
||||
QAction *actionFileList;
|
||||
|
||||
QVector<QAction *> actLangSelect;
|
||||
QVector<QAction *> actFSizeSelect;
|
||||
|
@ -212,20 +212,27 @@ QString &E2Profile::GetPrevFile()
|
||||
**/
|
||||
|
||||
|
||||
QString E2Profile::GetLastScript()
|
||||
{
|
||||
return s->value("LastScript", "").toString();
|
||||
}
|
||||
// QString E2Profile::GetLastScript()
|
||||
// {
|
||||
// return s->value("LastScript", "").toString();
|
||||
// }
|
||||
|
||||
|
||||
void E2Profile::SetLastScript(const QString &name)
|
||||
{
|
||||
s->setValue("LastScript", name);
|
||||
QStringList l = GetLastScripts();
|
||||
l.insert(0, name);
|
||||
SetLastScripts(l);
|
||||
// s->setValue("LastScript", name);
|
||||
}
|
||||
|
||||
|
||||
void E2Profile::SetLastFile(const QString &name, int data)
|
||||
{
|
||||
QStringList l = GetLastFiles();
|
||||
l.insert(0, name);
|
||||
SetLastFiles(l);
|
||||
#if 0
|
||||
if (name.length())
|
||||
{
|
||||
QString str;
|
||||
@ -269,8 +276,10 @@ void E2Profile::SetLastFile(const QString &name, int data)
|
||||
|
||||
s->setValue("LastFile", str.toLatin1());
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#if 0
|
||||
QString param_copy;
|
||||
|
||||
|
||||
@ -331,6 +340,7 @@ QString E2Profile::GetPrevFile(int &data)
|
||||
return sp;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
QStringList E2Profile::GetLastFiles()
|
||||
@ -356,6 +366,10 @@ void E2Profile::SetLastFiles(const QStringList &l)
|
||||
s->setValue(QString().sprintf("LastFile%d", i), t);
|
||||
i++;
|
||||
}
|
||||
for (; i < 8; i++)
|
||||
{
|
||||
s->setValue(QString().sprintf("LastFile%d", i), "");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -382,6 +396,10 @@ void E2Profile::SetLastScripts(const QStringList &l)
|
||||
s->setValue(QString().sprintf("LastScript%d", i), t);
|
||||
i++;
|
||||
}
|
||||
for (; i < 8; i++)
|
||||
{
|
||||
s->setValue(QString().sprintf("LastFile%d", i), "");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -100,11 +100,11 @@ class E2Profile
|
||||
static long GetLastDevType();
|
||||
static void SetLastDevType(long devtype);
|
||||
|
||||
static QString GetLastFile(int &data);
|
||||
static QString GetPrevFile(int &data);
|
||||
// static QString GetLastFile(int &data);
|
||||
// static QString GetPrevFile(int &data);
|
||||
static void SetLastFile(const QString &name, int data = ALL_TYPE);
|
||||
|
||||
static QString GetLastScript();
|
||||
// static QString GetLastScript();
|
||||
static void SetLastScript(const QString &name);
|
||||
|
||||
static uint8_t GetPolarityControl();
|
||||
|
@ -43,9 +43,6 @@
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionClose"/>
|
||||
<addaction name="actionExit"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionFile1"/>
|
||||
<addaction name="actionFile2"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menuDevice">
|
||||
<property name="title">
|
||||
@ -541,16 +538,6 @@
|
||||
<string>About Qt</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionFile1">
|
||||
<property name="text">
|
||||
<string>File1</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionFile2">
|
||||
<property name="text">
|
||||
<string>File2</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="../ponyprog.qrc"/>
|
||||
|
@ -31,7 +31,7 @@
|
||||
#include "e2cmdw.h"
|
||||
|
||||
//=================>>> e2TextCanvasPane::e2TextCanvasPane <<<================
|
||||
e2TextCanvasPane::e2TextCanvasPane(e2CmdWindow* win)
|
||||
e2TextCanvasPane::e2TextCanvasPane(e2CmdWindow *win)
|
||||
{
|
||||
cmdWin = win;
|
||||
}
|
||||
@ -77,7 +77,7 @@ void e2TextCanvasPane::VScroll(int step)
|
||||
}
|
||||
|
||||
//===================>>> e2TextCanvasPane::FontChanged <<<==================
|
||||
void e2TextCanvasPane::FontChanged(vFont& newFont)
|
||||
void e2TextCanvasPane::FontChanged(vFont &newFont)
|
||||
{
|
||||
vTextCanvasPane::FontChanged(newFont);
|
||||
}
|
||||
|
@ -36,8 +36,8 @@ class e2CmdWindow;
|
||||
|
||||
class e2TextCanvasPane : public vTextCanvasPane
|
||||
{
|
||||
public: //---------------------------------------- public
|
||||
e2TextCanvasPane(e2CmdWindow* win);
|
||||
public: //---------------------------------------- public
|
||||
e2TextCanvasPane(e2CmdWindow *win);
|
||||
virtual ~e2TextCanvasPane();
|
||||
|
||||
// Scrolling
|
||||
@ -48,16 +48,16 @@ public: //---------------------------------------- public
|
||||
virtual void VScroll(int);
|
||||
|
||||
// Events
|
||||
virtual void FontChanged(vFont& newFont);
|
||||
virtual void FontChanged(vFont &newFont);
|
||||
virtual void ResizeText(const int rows, const int cols);
|
||||
virtual void Redraw(int x, int y, int w , int h);
|
||||
virtual void TextMouseDown(int row, int col, int button);
|
||||
virtual void TextMouseUp(int row, int col, int button);
|
||||
virtual void TextMouseMove(int row, int col, int button);
|
||||
|
||||
protected: //--------------------------------------- protected
|
||||
private: //--------------------------------------- private
|
||||
e2CmdWindow* cmdWin;
|
||||
protected: //--------------------------------------- protected
|
||||
private: //--------------------------------------- private
|
||||
e2CmdWindow *cmdWin;
|
||||
};
|
||||
#endif
|
||||
|
||||
|
@ -31,9 +31,9 @@
|
||||
// #include "modaldlg_utilities.h"
|
||||
|
||||
//========================>>> SetCommandObject <<<==============================
|
||||
int SetCommandObject(const int id, const int val, CommandObject* CmdList)
|
||||
int SetCommandObject(const int id, const int val, CommandObject *CmdList)
|
||||
{
|
||||
for (CommandObject* cur = CmdList ; cur->cmdType != C_EndOfList ; ++cur)
|
||||
for (CommandObject *cur = CmdList ; cur->cmdType != C_EndOfList ; ++cur)
|
||||
{
|
||||
if (cur->cmdId == id)
|
||||
{
|
||||
@ -48,12 +48,12 @@ int SetCommandObject(const int id, const int val, CommandObject* CmdList)
|
||||
}
|
||||
|
||||
//========================>>> SetCBellow <<<==============================
|
||||
int SetCBelow(const int id, const ItemVal val, CommandObject* CmdList)
|
||||
int SetCBelow(const int id, const ItemVal val, CommandObject *CmdList)
|
||||
{
|
||||
int rval = 0;
|
||||
#ifdef _WINDOWS
|
||||
|
||||
for (CommandObject* cur = CmdList ; cur->cmdType != C_EndOfList ; ++cur)
|
||||
for (CommandObject *cur = CmdList ; cur->cmdType != C_EndOfList ; ++cur)
|
||||
{
|
||||
if (cur->cmdId == id)
|
||||
{
|
||||
@ -74,11 +74,11 @@ int SetCBelow(const int id, const ItemVal val, CommandObject* CmdList)
|
||||
}
|
||||
|
||||
//========================>>> SetCommandHidden <<<==============================
|
||||
int SetCommandHidden(const int id, const bool val, CommandObject* CmdList)
|
||||
int SetCommandHidden(const int id, const bool val, CommandObject *CmdList)
|
||||
{
|
||||
int rval = 0;
|
||||
|
||||
for (CommandObject* cur = CmdList ; cur->cmdType != C_EndOfList ; ++cur)
|
||||
for (CommandObject *cur = CmdList ; cur->cmdType != C_EndOfList ; ++cur)
|
||||
{
|
||||
if (cur->cmdId == id)
|
||||
{
|
||||
@ -106,14 +106,14 @@ int SetCommandHidden(const int id, const bool val, CommandObject* CmdList)
|
||||
}
|
||||
|
||||
//========================>>> SetCommandArrayHidden <<<==============================
|
||||
int SetCommandArrayHidden(const int id, const int n, const bool val, CommandObject* CmdList)
|
||||
int SetCommandArrayHidden(const int id, const int n, const bool val, CommandObject *CmdList)
|
||||
{
|
||||
int k;
|
||||
int rval = 0;
|
||||
|
||||
for (k = 0; k < n; k++)
|
||||
{
|
||||
for (CommandObject* cur = CmdList ; cur->cmdType != C_EndOfList ; ++cur)
|
||||
for (CommandObject *cur = CmdList ; cur->cmdType != C_EndOfList ; ++cur)
|
||||
{
|
||||
if (cur->cmdId == id + k)
|
||||
{
|
||||
@ -141,9 +141,9 @@ int SetCommandArrayHidden(const int id, const int n, const bool val, CommandObje
|
||||
}
|
||||
|
||||
//========================>>> SetCommandSensitive <<<==============================
|
||||
int SetCommandSensitive(const int id, const int val, CommandObject* CmdList)
|
||||
int SetCommandSensitive(const int id, const int val, CommandObject *CmdList)
|
||||
{
|
||||
for (CommandObject* cur = CmdList ; cur->cmdType != C_EndOfList ; ++cur)
|
||||
for (CommandObject *cur = CmdList ; cur->cmdType != C_EndOfList ; ++cur)
|
||||
{
|
||||
if (cur->cmdId == id)
|
||||
{
|
||||
@ -158,9 +158,9 @@ int SetCommandSensitive(const int id, const int val, CommandObject* CmdList)
|
||||
}
|
||||
|
||||
//========================>>> SetCommandLabel <<<==============================
|
||||
int SetCommandLabel(const int id, char *str, CommandObject* CmdList)
|
||||
int SetCommandLabel(const int id, char *str, CommandObject *CmdList)
|
||||
{
|
||||
for (CommandObject* cur = CmdList ; cur->cmdType != C_EndOfList ; ++cur)
|
||||
for (CommandObject *cur = CmdList ; cur->cmdType != C_EndOfList ; ++cur)
|
||||
{
|
||||
if (cur->cmdId == id)
|
||||
{
|
||||
@ -175,9 +175,9 @@ int SetCommandLabel(const int id, char *str, CommandObject* CmdList)
|
||||
}
|
||||
|
||||
//========================>>> GetCommandObject <<<==============================
|
||||
int GetCommandObject(const int id, CommandObject* CmdList)
|
||||
int GetCommandObject(const int id, CommandObject *CmdList)
|
||||
{
|
||||
for (CommandObject* cur = CmdList ; cur->cmdType != C_EndOfList ; ++cur)
|
||||
for (CommandObject *cur = CmdList ; cur->cmdType != C_EndOfList ; ++cur)
|
||||
{
|
||||
if (cur->cmdId == id)
|
||||
{
|
||||
|
@ -1,9 +1,9 @@
|
||||
|
||||
extern int SetCommandObject(const int id, const int val, CommandObject* CmdList);
|
||||
extern int SetCommandSensitive(const int id, const int val, CommandObject* CmdList);
|
||||
extern int SetCommandLabel(const int id, char *str, CommandObject* CmdList);
|
||||
extern int SetCommandHidden(const int id, const bool val, CommandObject* CmdList);
|
||||
extern int SetCommandArrayHidden(const int id, const int n, const bool val, CommandObject* CmdList);
|
||||
extern int SetCBelow(const int id, const ItemVal val, CommandObject* CmdList);
|
||||
extern int SetCommandObject(const int id, const int val, CommandObject *CmdList);
|
||||
extern int SetCommandSensitive(const int id, const int val, CommandObject *CmdList);
|
||||
extern int SetCommandLabel(const int id, char *str, CommandObject *CmdList);
|
||||
extern int SetCommandHidden(const int id, const bool val, CommandObject *CmdList);
|
||||
extern int SetCommandArrayHidden(const int id, const int n, const bool val, CommandObject *CmdList);
|
||||
extern int SetCBelow(const int id, const ItemVal val, CommandObject *CmdList);
|
||||
|
||||
extern int GetCommandObject(const int id, CommandObject* CmdList);
|
||||
extern int GetCommandObject(const int id, CommandObject *CmdList);
|
||||
|
@ -69,7 +69,7 @@ QString Profile::StripSpace(const QString &sp)
|
||||
#if 0
|
||||
sp.re
|
||||
|
||||
while( *sp && isspace(*sp) )
|
||||
while (*sp && isspace(*sp))
|
||||
{
|
||||
sp++;
|
||||
}
|
||||
@ -79,13 +79,13 @@ QString Profile::StripSpace(const QString &sp)
|
||||
//si posiziona in fondo
|
||||
char *p = strbuf;
|
||||
|
||||
while( *p )
|
||||
while (*p)
|
||||
{
|
||||
p++;
|
||||
}
|
||||
|
||||
//toglie
|
||||
while( isspace(*--p) )
|
||||
while (isspace(*--p))
|
||||
{
|
||||
*p = '\0';
|
||||
}
|
||||
@ -153,7 +153,7 @@ int Profile::WriteVet()
|
||||
linebuffer = sp;
|
||||
linebuffer += "\n"; //appende il new-line
|
||||
|
||||
if ( fputs(linebuffer.toLatin1(), fh) == EOF )
|
||||
if (fputs(linebuffer.toLatin1(), fh) == EOF)
|
||||
{
|
||||
rval = WRITEERROR;
|
||||
break;
|
||||
@ -230,13 +230,13 @@ int Profile::ReadVet()
|
||||
QString Profile::GetParameter(const QString &id)
|
||||
{
|
||||
//Controllo parametri
|
||||
if ( id == 0 || id.length() == 0 )
|
||||
if (id == 0 || id.length() == 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
//Legge i parametri dal file
|
||||
if ( ReadVet() )
|
||||
if (ReadVet())
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@ -281,7 +281,7 @@ QString Profile::GetParameter(const QString &id)
|
||||
|
||||
int Profile::SetParameter(const QString &id, const QString &value)
|
||||
{
|
||||
if ( id == 0 || id.length() == 0 || value == 0)
|
||||
if (id == 0 || id.length() == 0 || value == 0)
|
||||
{
|
||||
return BADPARAM;
|
||||
}
|
||||
|
@ -39,7 +39,7 @@
|
||||
|
||||
class Profile
|
||||
{
|
||||
public: //---------------------------------------- public
|
||||
public: //---------------------------------------- public
|
||||
|
||||
Profile(const QString &name = 0);
|
||||
virtual ~Profile();
|
||||
@ -48,7 +48,7 @@ public: //---------------------------------------- public
|
||||
int SetParameter(const QString &id, const QString &value = "");
|
||||
void SetFileName(const QString &name = "");
|
||||
|
||||
protected: //--------------------------------------- protected
|
||||
protected: //--------------------------------------- protected
|
||||
|
||||
QString StripSpace(const QString &sp);
|
||||
// int decnum2str(int value, char *str, int len);
|
||||
@ -56,7 +56,7 @@ protected: //--------------------------------------- protected
|
||||
// int hexnum2str(int value, char *str, int len);
|
||||
// int hexnum2str(unsigned long value, char *str, int len);
|
||||
|
||||
private: //--------------------------------------- private
|
||||
private: //--------------------------------------- private
|
||||
|
||||
void FlushVet(int force = 0);
|
||||
int ReadVet();
|
||||
|
@ -54,7 +54,7 @@ static DialogCmd DefaultCmds[] =
|
||||
|
||||
|
||||
//======================>>> retryModalDialog::retryModalDialog <<<==================
|
||||
retryModalDialog::retryModalDialog(QWidget* bw, char* msg, char* title) :
|
||||
retryModalDialog::retryModalDialog(QWidget *bw, char *msg, char *title) :
|
||||
QDialog(bw)
|
||||
{
|
||||
setupUi(this);
|
||||
|
@ -39,15 +39,15 @@
|
||||
|
||||
class retryModalDialog : public QDialog
|
||||
{
|
||||
public: //---------------------------------------- public
|
||||
retryModalDialog(QWidget* bw, char* msg, char* title = STR_MSGALERT);
|
||||
public: //---------------------------------------- public
|
||||
retryModalDialog(QWidget *bw, char *msg, char *title = STR_MSGALERT);
|
||||
virtual ~retryModalDialog(); // Destructor
|
||||
virtual void DialogCommand(ItemVal, ItemVal, CmdType); // action selected
|
||||
virtual int retryAction();
|
||||
|
||||
protected: //--------------------------------------- protected
|
||||
protected: //--------------------------------------- protected
|
||||
|
||||
private: //--------------------------------------- private
|
||||
private: //--------------------------------------- private
|
||||
|
||||
};
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
#define PONYPROGVERSION_H
|
||||
|
||||
#define PONYPROGVERSION "3.0.0"
|
||||
#define PROGRAM_DATE "01 Mai 2017"
|
||||
#define PROGRAM_DATE "02 Mai 2017"
|
||||
|
||||
#define USE_QT_VERSION 4
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user