mirror of
https://github.com/uroni/urbackup_frontend_wx.git
synced 2025-10-26 11:19:28 +00:00
Add function to retrieve CBT status
This commit is contained in:
parent
7a748e13bc
commit
b916fa8918
16
Info.cpp
16
Info.cpp
@ -18,6 +18,7 @@
|
||||
|
||||
#include "Info.h"
|
||||
#include "stringtools.h"
|
||||
#include "TrayIcon.h"
|
||||
|
||||
extern std::string g_lang;
|
||||
extern std::string g_res_path;
|
||||
@ -56,6 +57,16 @@ Info::Info(wxWindow* parent) : GUIInfo(parent)
|
||||
Layout();
|
||||
}
|
||||
|
||||
if (FileExists("urbctctl.exe"))
|
||||
{
|
||||
wxButton* cbtStatusButton = new wxButton(this, wxID_ANY, _("Show CBT status"));
|
||||
m_versionSizer->Add(cbtStatusButton);
|
||||
|
||||
cbtStatusButton->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(Info::OnShowCBTStatusClick), NULL, this);
|
||||
|
||||
Layout();
|
||||
}
|
||||
|
||||
instance=this;
|
||||
}
|
||||
|
||||
@ -71,6 +82,11 @@ void Info::OnUpdateClick(wxCommandEvent & event)
|
||||
update_urbackup();
|
||||
}
|
||||
|
||||
void Info::OnShowCBTStatusClick(wxCommandEvent& event)
|
||||
{
|
||||
runCommand("cbt-status");
|
||||
}
|
||||
|
||||
Info* Info::getInstance()
|
||||
{
|
||||
return instance;
|
||||
|
||||
1
Info.h
1
Info.h
@ -28,6 +28,7 @@ public:
|
||||
protected:
|
||||
void OnOKClick( wxCommandEvent& event );
|
||||
void OnUpdateClick(wxCommandEvent& event);
|
||||
void OnShowCBTStatusClick(wxCommandEvent& event);
|
||||
|
||||
virtual void OnClose();
|
||||
|
||||
|
||||
@ -207,6 +207,7 @@
|
||||
</ManifestResourceCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="CbtStatus.cpp" />
|
||||
<ClCompile Include="ConfigPath.cpp" />
|
||||
<ClCompile Include="Connector.cpp" />
|
||||
<ClCompile Include="escape.cpp" />
|
||||
@ -228,6 +229,7 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="capa_bits.h" />
|
||||
<ClInclude Include="CbtStatus.h" />
|
||||
<ClInclude Include="ConfigPath.h" />
|
||||
<ClInclude Include="Connector.h" />
|
||||
<ClInclude Include="escape.h" />
|
||||
|
||||
@ -75,6 +75,9 @@
|
||||
<ClCompile Include="gui\GUISetupWizard.cpp">
|
||||
<Filter>GUI</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="CbtStatus.cpp">
|
||||
<Filter>Quelldateien</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="ConfigPath.h">
|
||||
@ -134,6 +137,9 @@
|
||||
<ClInclude Include="gui\GUISetupWizard.h">
|
||||
<Filter>GUI</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="CbtStatus.h">
|
||||
<Filter>Headerdateien</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="icon1.ico">
|
||||
|
||||
38
gui/GUI.cpp
38
gui/GUI.cpp
@ -906,4 +906,40 @@ void GUIStatus::OnCloseInt(wxCloseEvent& event)
|
||||
{
|
||||
event.Skip();
|
||||
OnClose();
|
||||
}
|
||||
}
|
||||
|
||||
GUICbtStatus::GUICbtStatus(wxWindow * parent, wxWindowID id, const wxString & title, const wxPoint & pos, const wxSize & size, long style)
|
||||
: wxDialog(parent, id, title, pos, size, style)
|
||||
{
|
||||
this->SetSizeHints(wxDefaultSize, wxDefaultSize);
|
||||
|
||||
wxBoxSizer* bSizer9;
|
||||
bSizer9 = new wxBoxSizer(wxVERTICAL);
|
||||
|
||||
m_textCtrl3 = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE | wxTE_READONLY | wxTE_WORDWRAP);
|
||||
bSizer9->Add(m_textCtrl3, 15, wxALL | wxEXPAND, 5);
|
||||
|
||||
wxBoxSizer* bSizer10;
|
||||
bSizer10 = new wxBoxSizer(wxHORIZONTAL);
|
||||
|
||||
|
||||
bSizer10->Add(0, 0, 1, wxEXPAND, 5);
|
||||
|
||||
m_button5 = new wxButton(this, wxID_ANY, _("Exit"), wxDefaultPosition, wxDefaultSize, 0);
|
||||
bSizer10->Add(m_button5, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5);
|
||||
|
||||
bSizer9->Add(bSizer10, 1, wxEXPAND | wxALIGN_RIGHT, 5);
|
||||
|
||||
this->SetSizer(bSizer9);
|
||||
this->Layout();
|
||||
|
||||
this->Centre(wxBOTH);
|
||||
|
||||
// Connect Events
|
||||
m_button5->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(GUICbtStatus::OnExitClick), NULL, this);
|
||||
}
|
||||
|
||||
GUICbtStatus::~GUICbtStatus()
|
||||
{
|
||||
m_button5->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(GUICbtStatus::OnExitClick), NULL, this);
|
||||
}
|
||||
|
||||
22
gui/GUI.h
22
gui/GUI.h
@ -295,4 +295,26 @@ class GUIStatus : public wxDialog
|
||||
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// Class GUICbtStatus
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class GUICbtStatus : public wxDialog
|
||||
{
|
||||
private:
|
||||
|
||||
protected:
|
||||
wxTextCtrl* m_textCtrl3;
|
||||
|
||||
wxButton* m_button5;
|
||||
|
||||
// Virtual event handlers, overide them in your derived class
|
||||
virtual void OnExitClick(wxCommandEvent& event) { event.Skip(); }
|
||||
|
||||
public:
|
||||
|
||||
GUICbtStatus(wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxT("CBT status"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize(500, 222), long style = wxDEFAULT_DIALOG_STYLE);
|
||||
virtual ~GUICbtStatus();
|
||||
|
||||
};
|
||||
|
||||
#endif //__GUI_H__
|
||||
|
||||
2
info.txt
2
info.txt
@ -22,4 +22,4 @@ osiengine group (Farsi)
|
||||
buzzertnl, Decay (Dutch)
|
||||
Ales Hermann (Czech)
|
||||
|
||||
See license.txt for the licences of the libraries used and of UrBackup (AGPL v3+).
|
||||
See license.txt for the licences of the libraries used and of UrBackup (AGPL v3+). The source code is available at https://github.com/uroni/urbackup_backend (backend) and https://github.com/uroni/urbackup_frontend_wx (tray icon).
|
||||
9
main.cpp
9
main.cpp
@ -25,6 +25,7 @@
|
||||
#include "Logs.h"
|
||||
#include "TranslationHelper.h"
|
||||
#include "Status.h"
|
||||
#include "CbtStatus.h"
|
||||
#include <iostream>
|
||||
#include <limits>
|
||||
#include <wx/stdpaths.h>
|
||||
@ -477,6 +478,14 @@ bool MyApp::OnInit()
|
||||
Connector::restoreOk(wxString(argv[2])=="true", process_id);
|
||||
wxExit();
|
||||
}
|
||||
else if (cmd == wxT("cbt-status"))
|
||||
{
|
||||
CbtStatus *s = new CbtStatus(NULL);
|
||||
SetTopWindow(s);
|
||||
s->ShowModal();
|
||||
s->Destroy();
|
||||
wxExit();
|
||||
}
|
||||
#ifdef __APPLE__
|
||||
else if (cmd == wxT("uninstall"))
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user