From: daleharvey Date: Sat, 8 Jul 2006 15:53:34 +0000 (+0000) Subject: added gui code for whiteboard X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=5f49242407d318315dedcb22c945826635e8cb93;p=inkscape.git added gui code for whiteboard --- diff --git a/src/jabber_whiteboard/pedrogui.cpp b/src/jabber_whiteboard/pedrogui.cpp index 4b4bccbaa..6aff31cca 100644 --- a/src/jabber_whiteboard/pedrogui.cpp +++ b/src/jabber_whiteboard/pedrogui.cpp @@ -21,7 +21,9 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "pedrogui.h" +#include "jabber_whiteboard/pedrogui.h" +#include "jabber_whiteboard/session-manager.h" + #include @@ -412,6 +414,17 @@ void Roster::sendFileCallback() parent->doSendFile(nick); } +void Roster::shareCallback() +{ + Glib::RefPtr model = rosterView.get_model(); + Glib::RefPtr sel = rosterView.get_selection(); + Gtk::TreeModel::iterator iter = sel->get_selected(); + DOMString nick = iter->get_value(rosterColumns.userColumn); + //printf("share to:%s\n", nick.c_str()); + if (parent) + parent->doShare(nick); +} + bool Roster::buttonPressCallback(GdkEventButton* event) { if( (event->type == GDK_BUTTON_PRESS) && (event->button == 3) ) @@ -492,6 +505,9 @@ bool Roster::doSetup() actionGroup->add( Gtk::Action::create("SendFile", Gtk::Stock::CONNECT, "Send file"), sigc::mem_fun(*this, &Roster::sendFileCallback) ); + actionGroup->add( Gtk::Action::create("Share", + Gtk::Stock::CONNECT, "Share whiteboard"), + sigc::mem_fun(*this, &Roster::shareCallback) ); uiManager = Gtk::UIManager::create(); @@ -503,6 +519,7 @@ bool Roster::doSetup() " " " " " " + " " " " ""; @@ -716,6 +733,17 @@ void UserList::sendFileCallback() parent->doSendFile(nick); } +void UserList::shareCallback() +{ + Glib::RefPtr model = userList.get_model(); + Glib::RefPtr sel = userList.get_selection(); + Gtk::TreeModel::iterator iter = sel->get_selected(); + DOMString nick = iter->get_value(userListColumns.userColumn); + //printf("Send file to:%s\n", nick.c_str()); + if (parent) + parent->doShare(nick); +} + bool UserList::buttonPressCallback(GdkEventButton* event) { if( (event->type == GDK_BUTTON_PRESS) && (event->button == 3) ) @@ -785,6 +813,9 @@ bool UserList::doSetup() actionGroup->add( Gtk::Action::create("SendFile", Gtk::Stock::CONNECT, "Send file"), sigc::mem_fun(*this, &UserList::sendFileCallback) ); + actionGroup->add( Gtk::Action::create("Share", + Gtk::Stock::CONNECT, "Share whiteboard"), + sigc::mem_fun(*this, &UserList::shareCallback) ); uiManager = Gtk::UIManager::create(); @@ -796,6 +827,7 @@ bool UserList::doSetup() " " " " " " + " " " " ""; @@ -870,6 +902,11 @@ void ChatWindow::hideCallback() parent.chatDelete(jid); } +void ChatWindow::shareCallback() +{ +// hide(); + parent.doShare(this->jid); +} void ChatWindow::textEnterCallback() { @@ -895,6 +932,8 @@ bool ChatWindow::doSetup() actionGroup->add( Gtk::Action::create("MenuFile", "_File") ); actionGroup->add( Gtk::Action::create("Leave", Gtk::Stock::CANCEL), sigc::mem_fun(*this, &ChatWindow::leaveCallback) ); + actionGroup->add( Gtk::Action::create("Share", Gtk::Stock::CONNECT, + "Share whiteboard"), sigc::mem_fun(*this, &ChatWindow::shareCallback) ); Glib::RefPtr uiManager = Gtk::UIManager::create(); @@ -907,6 +946,7 @@ bool ChatWindow::doSetup() " " " " " " + " " " " " " ""; @@ -977,6 +1017,11 @@ void GroupChatWindow::textEnterCallback() inputTxt.set_text(""); } +void GroupChatWindow::shareCallback() +{ + parent.doGroupShare(groupJid); +} + bool GroupChatWindow::doSetup() { DOMString title = "Group Chat - "; @@ -994,6 +1039,8 @@ bool GroupChatWindow::doSetup() actionGroup->add( Gtk::Action::create("MenuFile", "_File") ); actionGroup->add( Gtk::Action::create("Leave", Gtk::Stock::CANCEL), sigc::mem_fun(*this, &GroupChatWindow::leaveCallback) ); + actionGroup->add( Gtk::Action::create("Share", Gtk::Stock::CONNECT, "Share whiteboard"), + sigc::mem_fun(*this, &GroupChatWindow::shareCallback) ); Glib::RefPtr uiManager = Gtk::UIManager::create(); @@ -1005,7 +1052,8 @@ bool GroupChatWindow::doSetup() "" " " " " - " " + " " + " " " " " " ""; @@ -1095,7 +1143,15 @@ void GroupChatWindow::doSendFile(const DOMString &nick) } +void GroupChatWindow::doShare(const DOMString &nick) +{ + printf("##Share inkboard with %s\n", nick.c_str()); + DOMString fullJid = groupJid; + fullJid.append("/"); + fullJid.append(nick); + parent.doShare(fullJid); +} //######################################################################### @@ -2412,6 +2468,21 @@ void PedroGui::doReceiveFile( } +void PedroGui::doShare(const DOMString &jid) +{ + Inkscape::Whiteboard::SessionManager& sm = Inkscape::Whiteboard::SessionManager::instance(); + sm.doShare(jid, Inkscape::Whiteboard::INKBOARD_PRIVATE); + +// Inkscape::Whiteboard::SessionManager::instance().createInkboardDesktop(jid, Inkscape::Whiteboard::INKBOARD_PRIVATE); +} + +void PedroGui::doGroupShare(const DOMString &groupJid) +{ + Inkscape::Whiteboard::SessionManager& sm = Inkscape::Whiteboard::SessionManager::instance(); + sm.doShare(groupJid, Inkscape::Whiteboard::INKBOARD_MUC); + +// Inkscape::Whiteboard::SessionManager::instance().createInkboardDesktop(groupJid, Inkscape::Whiteboard::INKBOARD_MUC); +} //################## //# CALLBACKS diff --git a/src/jabber_whiteboard/pedrogui.h b/src/jabber_whiteboard/pedrogui.h index 2758c81d1..b223d7263 100644 --- a/src/jabber_whiteboard/pedrogui.h +++ b/src/jabber_whiteboard/pedrogui.h @@ -94,6 +94,7 @@ private: void sendFileCallback(); void chatCallback(); + void shareCallback(); bool buttonPressCallback(GdkEventButton* event); bool doSetup(); @@ -221,6 +222,7 @@ private: void sendFileCallback(); void chatCallback(); + void shareCallback(); bool buttonPressCallback(GdkEventButton* event); bool doSetup(); @@ -279,6 +281,7 @@ private: void leaveCallback(); void hideCallback(); + void shareCallback(); void textEnterCallback(); bool doSetup(); @@ -330,6 +333,7 @@ public: virtual void doSendFile(const DOMString &nick); virtual void doChat(const DOMString &nick); + virtual void doShare(const DOMString &nick); private: @@ -337,6 +341,7 @@ private: void textEnterCallback(); void leaveCallback(); void hideCallback(); + void shareCallback(); bool doSetup(); @@ -839,6 +844,8 @@ public: long size, const DOMString &hash); + void doShare(const DOMString &jid); + void doGroupShare(const DOMString &groupJid); //# File menu void connectCallback();