Add progress reporting
This commit is contained in:
parent
9f6e61361c
commit
c91ca248f6
|
@ -239,6 +239,7 @@ cmMainFrame::cmMainFrame(const wxString& title, const wxSize& size)
|
|||
this->Connect(cmCacheProperty::Menu_Popup_Help, wxEVT_COMMAND_MENU_SELECTED,
|
||||
(wxObjectEventFunction) &cmMainFrame::OnPopupMenuHelp);
|
||||
|
||||
this->m_CMakeInstance->SetProgressCallback(&cmMainFrame::ProgressCallback, this);
|
||||
}
|
||||
|
||||
cmMainFrame::~cmMainFrame()
|
||||
|
@ -279,6 +280,27 @@ void cmMainFrame::MessageCallback(const char* m, const char* title, bool& nomore
|
|||
|
||||
}
|
||||
|
||||
void cmMainFrame::ProgressCallback(const char* m, float prog,
|
||||
void* clientData)
|
||||
{
|
||||
|
||||
if ( clientData )
|
||||
{
|
||||
cmMainFrame* self = static_cast<cmMainFrame*>( clientData );
|
||||
char tmp[1024];
|
||||
if (prog >= 0)
|
||||
{
|
||||
sprintf(tmp,"%s %i%%",m,(int)(100*prog));
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf(tmp,"%s",m);
|
||||
}
|
||||
self->SetStatusText(tmp);
|
||||
wxYield();
|
||||
}
|
||||
}
|
||||
|
||||
void cmMainFrame::DisplayMessage(const char* m, const char* title, bool& nomore)
|
||||
{
|
||||
this->CursorNormal(false);
|
||||
|
@ -829,6 +851,7 @@ void cmMainFrame::RunCMake(bool generateProjectFiles)
|
|||
cmSystemTools::Error(
|
||||
"Error in configuration process, project files may be invalid");
|
||||
}
|
||||
|
||||
// update the GUI with any new values in the caused by the
|
||||
// generation process
|
||||
this->LoadCacheFromDiskToGUI();
|
||||
|
@ -1438,6 +1461,7 @@ void cmMainFrame::CursorBusy(bool s)
|
|||
{
|
||||
this->m_CursorChanged = true;
|
||||
}
|
||||
wxYield();
|
||||
}
|
||||
|
||||
void cmMainFrame::CursorNormal(bool s)
|
||||
|
@ -1447,6 +1471,7 @@ void cmMainFrame::CursorNormal(bool s)
|
|||
{
|
||||
this->m_CursorChanged = false;
|
||||
}
|
||||
wxYield();
|
||||
}
|
||||
|
||||
void cmMainFrame::OnSourceUpdated(wxCommandEvent& event)
|
||||
|
|
|
@ -33,6 +33,7 @@ class wxScrolledWindow;
|
|||
class wxSizer;
|
||||
class wxStaticBox;
|
||||
class wxStaticText;
|
||||
class wxApp;
|
||||
|
||||
/** \class cmMainFrame
|
||||
* \brief GUI for CMake with wxWindows toolkit
|
||||
|
@ -82,12 +83,17 @@ public:
|
|||
void ConnectEventTo(wxWindow*, wxEventType, wxObjectEventFunction);
|
||||
|
||||
//! Callback for the error message.
|
||||
static void MessageCallback(const char* m, const char* title, bool& nomore, void* cd);
|
||||
static void MessageCallback(const char* m, const char* title,
|
||||
bool& nomore, void* cd);
|
||||
static void ProgressCallback(const char* m, float prog, void* clientData);
|
||||
void DisplayMessage(const char* m, const char* title, bool& nomore);
|
||||
|
||||
//! Retrieve the current build directory.
|
||||
const std::string& GetBuildDir() { return this->m_WhereBuild; }
|
||||
|
||||
//! Set the application for progress
|
||||
void SetApplication(wxApp* app) { m_Application = app; }
|
||||
|
||||
private:
|
||||
//! Load cache file from m_WhereBuild and display in GUI editor
|
||||
void LoadCacheFromDiskToGUI();
|
||||
|
@ -221,6 +227,8 @@ private:
|
|||
cmake* m_CMakeInstance;
|
||||
wxTimer* m_ExitTimer;
|
||||
|
||||
wxApp* m_Application;
|
||||
|
||||
enum Events {
|
||||
ID_MainFrame,
|
||||
ID_Resize,
|
||||
|
|
|
@ -146,10 +146,11 @@ bool wxCMakeSetup::OnInit()
|
|||
cm.SetValidArguments("ABGHQ");
|
||||
cm.ParseCommandLine(wxApp::argc, wxApp::argv);
|
||||
|
||||
this->SetVendorName("Andy");
|
||||
this->SetVendorName("Kitware");
|
||||
this->SetAppName("CMakeSetup");
|
||||
|
||||
cmMainFrame *frame = new cmMainFrame("CMake", wxSize(200, 100));
|
||||
frame->SetApplication(this);
|
||||
frame->Initialize(&cm);
|
||||
//wxFrame *frame = new testFrame("CMake", wxSize(200, 100));
|
||||
//wxFrame *frame = new testFrame1("Frame", wxSize(200, 100));
|
||||
|
|
Loading…
Reference in New Issue