int main(int argc, char *argv[])
{
Q_INIT_RESOURCE(mystyle);
MainWindow *mainWindow;
vca_debug_flg |= VCA_DEB_MSGDATA | VCA_DEB_RAWMSG;
if (argc != 2)
{
mainWindow = new MainWindow;//load default settings when no settings file specified
} else {
mainWindow
= new MainWindow
(QCoreApplication::arguments().
at(1));
//load settings from specified filename }
mainWindow->show();
return app.exec();
}
int main(int argc, char *argv[])
{
Q_INIT_RESOURCE(mystyle);
QApplication app(argc, argv);
MainWindow *mainWindow;
QCoreApplication::setOrganizationName("CTU");
QCoreApplication::setOrganizationDomain("www.cvut.cz");
QCoreApplication::setApplicationName("qcanalyzer");
vca_debug_flg |= VCA_DEB_MSGDATA | VCA_DEB_RAWMSG;
if (argc != 2)
{
mainWindow = new MainWindow;//load default settings when no settings file specified
} else {
mainWindow = new MainWindow(QCoreApplication::arguments().at(1));//load settings from specified filename
}
mainWindow->show();
return app.exec();
}
To copy to clipboard, switch view to plain text mode
class MainWindow
: public QMainWindow,
private Ui
::mainWindow{
Q_OBJECT
public:
~MainWindow();
QVcaCanMsgModel* getModel(){
return msgTableModel;
}
QVcaCanMsgModel* getMsgHistoryModel(){
return sentMsgHistory;
}
AppSettings* getSettings(){
return appSettings;
}
QVcaNet* getNetworkIfc(){
return networkIfc;
}
void setClientConnected(bool _clientConnected){
clientConnected = _clientConnected;
}
bool clientIsConnected(){
return clientConnected;
}
bool saveFile
(const QString &fileName
);
protected:
bool maybeSaved();
private:
bool clientConnected;//WHEN MONITORTHREAD BECOMES A MEMBER OF MAINWINDOW THIS WILL NO MORE MAKE SENSE - WILL BE ASKING EITHER IF THREAD IS RUNNING OR IF IT WAS CREATED-IT CAN BE DELETED WITH PAUSE...
AppSettings *appSettings;
QVcaCanMsgModel *msgTableModel;
QVcaNet *networkIfc;
AnalyzerMonitorThread *monitorThread;
QVcaCanMsgModel *sentMsgHistory;
signals:
void msgHistoryUpdate(const QVcaCanMsg &canmsg);
public slots:
void on_actionAbout_triggered();
void on_actionConfigure_triggered();
void on_actionAttachToInterface_triggered();
void on_actionDetachInterface_triggered();
void on_roughMsgCheckBox_stateChanged();
void on_viewStatsCheckBox_stateChanged();
void on_sendButton_clicked();
void on_periodicButton_clicked();
void on_clearButton_clicked();
void on_followLogHeadCheckBox_stateChanged();
void unsetFollowHeadCheckBox(int state);
void on_actionOpenLogFile_triggered();
void changeIndexToMsgLog();
bool on_actionSaveLogFile_triggered();
void on_actionViewSentMsgHistory_triggered();
void on_sendMultiMessage_triggered();
void on_actionFilterView_triggered();
void monitorThreadFinished();
};
class MainWindow : public QMainWindow, private Ui::mainWindow
{
Q_OBJECT
public:
MainWindow(QMainWindow *parent = NULL);
MainWindow(QString settingsFileNamePath, QMainWindow *parent = NULL);
~MainWindow();
QVcaCanMsgModel* getModel(){
return msgTableModel;
}
QVcaCanMsgModel* getMsgHistoryModel(){
return sentMsgHistory;
}
AppSettings* getSettings(){
return appSettings;
}
QVcaNet* getNetworkIfc(){
return networkIfc;
}
void setClientConnected(bool _clientConnected){
clientConnected = _clientConnected;
}
bool clientIsConnected(){
return clientConnected;
}
bool saveFile(const QString &fileName);
protected:
void closeEvent(QCloseEvent *event);
void contextMenuEvent(QContextMenuEvent *event);
bool maybeSaved();
private:
bool clientConnected;//WHEN MONITORTHREAD BECOMES A MEMBER OF MAINWINDOW THIS WILL NO MORE MAKE SENSE - WILL BE ASKING EITHER IF THREAD IS RUNNING OR IF IT WAS CREATED-IT CAN BE DELETED WITH PAUSE...
AppSettings *appSettings;
QVcaCanMsgModel *msgTableModel;
QVcaNet *networkIfc;
AnalyzerMonitorThread *monitorThread;
QVcaCanMsgModel *sentMsgHistory;
signals:
void msgHistoryUpdate(const QVcaCanMsg &canmsg);
public slots:
void on_actionAbout_triggered();
void on_actionConfigure_triggered();
void on_actionAttachToInterface_triggered();
void on_actionDetachInterface_triggered();
void on_roughMsgCheckBox_stateChanged();
void on_viewStatsCheckBox_stateChanged();
void on_sendButton_clicked();
void on_periodicButton_clicked();
void on_clearButton_clicked();
void on_followLogHeadCheckBox_stateChanged();
void unsetFollowHeadCheckBox(int state);
void on_actionOpenLogFile_triggered();
void changeIndexToMsgLog();
bool on_actionSaveLogFile_triggered();
void on_actionViewSentMsgHistory_triggered();
void on_sendMultiMessage_triggered();
void on_actionFilterView_triggered();
void monitorThreadFinished();
};
To copy to clipboard, switch view to plain text mode
: QMainWindow(parent
), clientConnected
(false), appSettings
(new AppSettings
(this)) , msgTableModel
(new QVcaCanMsgModel
(this)), networkIfc
(new QVcaNet
(this)), monitorThread
(NULL), sentMsgHistory
(new QVcaCanMsgModel
(this)) {
setupUi(this);
msgLog->setModel(msgTableModel);
//msgLog->verticalHeader()->resizeSections(QHeaderView::ResizeToContents);
msgLog->setSortingEnabled(true);
msgLog->setColumnWidth(2, 130);
msgLog->setColumnWidth(4, 180);
msgLog->setDragEnabled(true);
connect(msgLog->verticalScrollBar(), SIGNAL(sliderMoved(int)),
this, SLOT(unsetFollowHeadCheckBox(int)));
connect(this, SIGNAL(msgHistoryUpdate(const QVcaCanMsg&)),
sentMsgHistory, SLOT(messageEnqueued(const QVcaCanMsg&)));
setAttribute(Qt::WA_DeleteOnClose);
}
: QMainWindow(parent
), clientConnected
(false), appSettings
(new AppSettings
(settingsFileNamePath,
this)) , msgTableModel
(new QVcaCanMsgModel
(this)), networkIfc
(new QVcaNet
(this)), monitorThread
(NULL), sentMsgHistory
(new QVcaCanMsgModel
(this)) {
setupUi(this);
msgLog->setModel(msgTableModel);
//msgLog->verticalHeader()->resizeSections(QHeaderView::ResizeToContents);
msgLog->setSortingEnabled(true);
msgLog->setColumnWidth(2, 130);
msgLog->setColumnWidth(4, 180);
msgLog->setDragEnabled(true);
connect(msgLog->verticalScrollBar(), SIGNAL(sliderMoved(int)),
this, SLOT(unsetFollowHeadCheckBox(int)));
connect(this, SIGNAL(msgHistoryUpdate(const QVcaCanMsg&)),
sentMsgHistory, SLOT(messageEnqueued(const QVcaCanMsg&)));
setAttribute(Qt::WA_DeleteOnClose);
}
MainWindow::MainWindow(QMainWindow *parent)
: QMainWindow(parent), clientConnected(false), appSettings(new AppSettings(this)) , msgTableModel(new QVcaCanMsgModel(this)), networkIfc(new QVcaNet(this)), monitorThread(NULL), sentMsgHistory(new QVcaCanMsgModel(this))
{
setupUi(this);
msgLog->setModel(msgTableModel);
//msgLog->verticalHeader()->resizeSections(QHeaderView::ResizeToContents);
msgLog->setSortingEnabled(true);
msgLog->setColumnWidth(2, 130);
msgLog->setColumnWidth(4, 180);
msgLog->setDragEnabled(true);
connect(msgLog->verticalScrollBar(), SIGNAL(sliderMoved(int)),
this, SLOT(unsetFollowHeadCheckBox(int)));
connect(this, SIGNAL(msgHistoryUpdate(const QVcaCanMsg&)),
sentMsgHistory, SLOT(messageEnqueued(const QVcaCanMsg&)));
setAttribute(Qt::WA_DeleteOnClose);
}
MainWindow::MainWindow(QString settingsFileNamePath, QMainWindow *parent)
: QMainWindow(parent), clientConnected(false), appSettings(new AppSettings(settingsFileNamePath, this)) , msgTableModel(new QVcaCanMsgModel(this)), networkIfc(new QVcaNet(this)), monitorThread(NULL), sentMsgHistory(new QVcaCanMsgModel(this))
{
setupUi(this);
msgLog->setModel(msgTableModel);
//msgLog->verticalHeader()->resizeSections(QHeaderView::ResizeToContents);
msgLog->setSortingEnabled(true);
msgLog->setColumnWidth(2, 130);
msgLog->setColumnWidth(4, 180);
msgLog->setDragEnabled(true);
connect(msgLog->verticalScrollBar(), SIGNAL(sliderMoved(int)),
this, SLOT(unsetFollowHeadCheckBox(int)));
connect(this, SIGNAL(msgHistoryUpdate(const QVcaCanMsg&)),
sentMsgHistory, SLOT(messageEnqueued(const QVcaCanMsg&)));
setAttribute(Qt::WA_DeleteOnClose);
}
To copy to clipboard, switch view to plain text mode
Bookmarks