]> git.tdb.fi Git - r2c2.git/commitdiff
Add missing files
authorMikko Rasa <tdb@tdb.fi>
Sat, 19 Feb 2011 21:28:38 +0000 (21:28 +0000)
committerMikko Rasa <tdb@tdb.fi>
Sat, 19 Feb 2011 21:28:38 +0000 (21:28 +0000)
Fix copyright messages

source/remote/mainpanel.cpp [new file with mode: 0644]
source/remote/mainpanel.h [new file with mode: 0644]
source/remote/remote.cpp
source/remote/remote.h

diff --git a/source/remote/mainpanel.cpp b/source/remote/mainpanel.cpp
new file mode 100644 (file)
index 0000000..62c9208
--- /dev/null
@@ -0,0 +1,60 @@
+/* $Id$
+
+This file is part of R²C²
+Copyright © 2011  Mikkosoft Productions, Mikko Rasa
+Distributed under the GPL
+*/
+
+#include "mainpanel.h"
+
+using namespace std;
+using namespace R2C2;
+
+MainPanel::MainPanel(Remote &r, R2C2::Client &c):
+       remote(r),
+       client(c)
+{
+       client.signal_power_changed.connect(sigc::mem_fun(this, &MainPanel::power_changed));
+       client.signal_halt_changed.connect(sigc::mem_fun(this, &MainPanel::halt_changed));
+       client.signal_emergency.connect(sigc::mem_fun(this, &MainPanel::emergency));
+
+       Gtk::HBox *hbox = new Gtk::HBox(false, 5);
+       pack_start(*manage(hbox), false, true);
+
+       hbox->pack_start(*manage(chk_power = new Gtk::CheckButton("Power")), false, true);
+       chk_power->signal_toggled().connect(sigc::mem_fun(this, &MainPanel::ui_power_changed));
+
+       hbox->pack_start(*manage(chk_halt = new Gtk::CheckButton("Halt")), false, true);
+       chk_halt->signal_toggled().connect(sigc::mem_fun(this, &MainPanel::ui_power_changed));
+
+       pack_start(*manage(lbl_status = new Gtk::Label), false, true);
+
+       show_all();
+}
+
+void MainPanel::power_changed(bool p)
+{
+       chk_power->set_active(p);
+}
+
+void MainPanel::halt_changed(bool h)
+{
+       chk_halt->set_active(h);
+       if(!h)
+               lbl_status->set_text(string());
+}
+
+void MainPanel::emergency(const string &msg)
+{
+       lbl_status->set_text(msg);
+}
+
+void MainPanel::ui_power_changed()
+{
+       client.set_power(chk_power->get_active());
+}
+
+void MainPanel::ui_halt_changed()
+{
+       client.set_halt(chk_halt->get_active());
+}
diff --git a/source/remote/mainpanel.h b/source/remote/mainpanel.h
new file mode 100644 (file)
index 0000000..05c0984
--- /dev/null
@@ -0,0 +1,38 @@
+/* $Id$
+
+This file is part of R²C²
+Copyright © 2011  Mikkosoft Productions, Mikko Rasa
+Distributed under the GPL
+*/
+
+#ifndef MAINPANEL_H_
+#define MAINPANEL_H_
+
+#include <gtkmm/box.h>
+#include <gtkmm/checkbutton.h>
+#include <gtkmm/label.h>
+#include "network/client.h"
+
+class Remote;
+
+class MainPanel: public Gtk::VBox
+{
+private:
+       Remote &remote;
+       R2C2::Client &client;
+       Gtk::CheckButton *chk_power;
+       Gtk::CheckButton *chk_halt;
+       Gtk::Label *lbl_status;
+
+public:
+       MainPanel(Remote &, R2C2::Client &);
+
+private:
+       void power_changed(bool);
+       void halt_changed(bool);
+       void emergency(const std::string &);
+       void ui_power_changed();
+       void ui_halt_changed();
+};
+
+#endif
index 21689867a8f58c02a908537e919e883b30bfc123..e5384777bf49ffaf5f52b21196483361e5088186 100644 (file)
@@ -1,7 +1,7 @@
 /* $Id$
 
 This file is part of R²C²
-Copyright © 2009-2010  Mikkosoft Productions, Mikko Rasa
+Copyright © 2009-2011  Mikkosoft Productions, Mikko Rasa
 Distributed under the GPL
 */
 
index a9ab92b2c6f876973c4872ea7c21974e5bd6f16f..14e9ef6543c278cdb4aa7ba16ae56f2acf80f933 100644 (file)
@@ -1,7 +1,7 @@
 /* $Id$
 
 This file is part of R²C²
-Copyright © 2009-2010  Mikkosoft Productions, Mikko Rasa
+Copyright © 2009-2011  Mikkosoft Productions, Mikko Rasa
 Distributed under the GPL
 */