diff --git a/DSView/main.cpp b/DSView/main.cpp index 7de7bb78..ddce8247 100644 --- a/DSView/main.cpp +++ b/DSView/main.cpp @@ -38,8 +38,7 @@ #ifdef _WIN32 #include -#endif - +#endif void usage() { @@ -53,7 +52,7 @@ void usage() " -s, --storelog Save log to locale file\n" " -h, -?, --help Show help option\n" "\n", DS_BIN_NAME, DS_DESCRIPTION); -} +} int main(int argc, char *argv[]) { @@ -213,8 +212,7 @@ bool bHighScale = true; //init core if (!control->Init()){ - dsv_err("%s", "init error!"); - dsv_err("%s", control->GetLastError()); + dsv_err("%s", "init error!"); return 1; } @@ -231,6 +229,8 @@ bool bHighScale = true; w.show_doc(); //to show the dailog for open help document ret = a.exec(); //Run the application control->Stop(); + + dsv_info("Main window closed."); } catch (const std::exception &e) { @@ -242,7 +242,9 @@ bool bHighScale = true; control->UnInit(); //uninit control->Destroy(); - dsv_log_uninit(); + dsv_info("Uninit log."); + dsv_log_uninit(); + return ret; } diff --git a/DSView/pv/appcontrol.cpp b/DSView/pv/appcontrol.cpp index 618876ce..4a65a4a2 100644 --- a/DSView/pv/appcontrol.cpp +++ b/DSView/pv/appcontrol.cpp @@ -91,15 +91,15 @@ bool AppControl::Init() // Initialise libsigrokdecode if (srd_init(path) != SRD_OK) - { - m_error = "ERROR: libsigrokdecode init failed."; + { + dsv_err("%s", "ERROR: libsigrokdecode init failed."); return false; } // Load the protocol decoders if (srd_decoder_load_all() != SRD_OK) { - m_error = "ERROR: load the protocol decoders failed."; + dsv_err("ERROR: load the protocol decoders failed."); return false; } @@ -125,11 +125,6 @@ void AppControl::UnInit() _session->uninit(); } -const char *AppControl::GetLastError() -{ - return m_error.c_str(); -} - bool AppControl::TopWindowIsMaximized() { if (_topWindow != NULL){ diff --git a/DSView/pv/appcontrol.h b/DSView/pv/appcontrol.h index 189d0f6e..8cef0051 100644 --- a/DSView/pv/appcontrol.h +++ b/DSView/pv/appcontrol.h @@ -48,9 +48,7 @@ public: void Stop(); - void UnInit(); - - const char* GetLastError(); + void UnInit(); inline pv::SigSession* GetSession(){ return _session; @@ -69,8 +67,7 @@ public: public: std::string _open_file_name; -private: - std::string m_error; +private: pv::SigSession *_session; QWidget *_topWindow; };