2 Commits c0f3b72cbd ... ab1fcb6c82

Author SHA1 Message Date
  Francisco Javier Parra ab1fcb6c82 Merge branch 'master' of https://notabug.org/anengineer/xmpplar 7 years ago
  Francisco Javier Parra a2314b1613 Improvements on the GUI 7 years ago

+ 6 - 1
AUTHORS

@@ -6,4 +6,9 @@ Francisco Javier Parra Pérez <franparpe@openmailbox.org> Founder of the project
           alongside mrtx and main programer.
 
 mrtx <Put your mail here my friend> Co-founder of the xmpplar project and main
-     designer, crucial member of the project.
+     designer, crucial member of the project.
+
+Special thanks:
+---------------
+
+dboles, For his/her help in the Gtk irc channel.

+ 6 - 1
src/Makefile.am

@@ -6,7 +6,12 @@ main-window.cpp main-window.h \
 xmpplar.cpp xmpplar.h \
 conversation_canvas.cpp conversation_canvas.h \
 conversation_container.cpp conversation_container.h \
-xmpplar_client.cpp xmpplar_client.h
+xmpplar_client.cpp xmpplar_client.h \
+chat_input.cpp chat_input.h \
+widget_roster_panel.cpp widget_roster_panel.h \
+widget_roster_row.cpp widget_roster_row.h \
+widget_side_bar.cpp widget_side_bar.hpp
+
 
 xmpplar_CPPFLAGS = $(MYAPP_CFLAGS) $(GLOOX_CFLAGS)
 xmpplar_LDADD = $(MYAPP_LIBS) $(GLOOX_LIBS) $(LIBS)

+ 2 - 2
src/chat_input.cpp

@@ -18,10 +18,10 @@
 
 ChatInput::ChatInput()
 {
-  m_text_buffer = get_buffer();
+  m_text_buffer = this->get_buffer();
 }
 
 Glib::ustring ChatInput::get_message()
 {
-  return m_text_buffer.get_text();
+  return m_text_buffer->get_text();
 }

+ 2 - 2
src/chat_input.h

@@ -21,12 +21,12 @@
 class ChatInput : public Gtk::TextView
 {
 private:
-  Gtk::TextBuffer m_text_buffer;
+  Glib::RefPtr<Gtk::TextBuffer> m_text_buffer;
 
 public:
   ChatInput();
 
   Glib::ustring get_message();
-}
+};
 
 #endif

+ 47 - 17
src/main-window.cpp

@@ -29,7 +29,25 @@ MainWindow::MainWindow()
   : Gtk::ApplicationWindow(),
   m_button("Send"),
   m_button2("A ver si esto va"),
-  m_box(Gtk::ORIENTATION_VERTICAL, 0)
+  m_rosterpanel_reveal_btn("go-next"),
+  m_test_hide_btn("hiding things"), // Remove later
+  m_vbox(Gtk::ORIENTATION_VERTICAL, 0)
+{
+  generateUI();
+  // Signals
+  m_button.signal_clicked().connect(sigc::mem_fun(*this, &MainWindow::sendMessage));
+  m_button2.signal_clicked().connect(sigc::mem_fun(*this, &MainWindow::onConnectSignal));
+  m_rosterpanel_reveal_btn.signal_clicked().connect(sigc::mem_fun(*this,
+                                                                  &MainWindow::showHideSideBar));
+  show_all_children();
+  std::cout << "Window created" << "\n";
+
+  // dispatcher connection
+  m_msg_dispatcher.connect(sigc::mem_fun(*this, &MainWindow::on_message_from_gloox));
+
+}
+
+void MainWindow::generateUI()
 {
   m_headerbar.set_show_close_button();
   set_titlebar(m_headerbar);
@@ -37,26 +55,29 @@ MainWindow::MainWindow()
 
   set_default_size(400, 400);
 
-  add(m_box);
+  // Adding the main container in the window
+  add(m_overlay);
 
+  // Aligning the buttons
   m_button.set_halign(Gtk::ALIGN_CENTER);
   m_button.set_valign(Gtk::ALIGN_CENTER);
 
-  m_box.pack_start(m_conversationCont, Gtk::PACK_EXPAND_WIDGET);
-  m_box.pack_start(m_h_box, Gtk::PACK_SHRINK);
-  m_h_box.pack_start(m_entry, Gtk::PACK_EXPAND_WIDGET);
-  m_h_box.pack_start(m_button, Gtk::PACK_SHRINK);
-  m_h_box.pack_start(m_button2, Gtk::PACK_SHRINK);
-
-  // Signals
-  m_button.signal_clicked().connect(sigc::mem_fun(*this, &MainWindow::sendMessage));
-  m_button2.signal_clicked().connect(sigc::mem_fun(*this, &MainWindow::onConnectSignal));
-  show_all_children();
-  std::cout << "Window created" << "\n";
-
-  // dispatcher connection
-  m_msg_dispatcher.connect(sigc::mem_fun(*this, &MainWindow::on_message_from_gloox));
-
+  // Placing widgets
+  // m_main_hbox.pack_start(m_sidebar);
+  // m_vbox.add(m_overlay);
+  m_overlay.add(m_vbox);
+  m_overlay.add_overlay(m_sidebar);
+  m_sidebar.set_transition_type(Gtk::RevealerTransitionType::REVEALER_TRANSITION_TYPE_SLIDE_LEFT);
+  m_sidebar.set_reveal_child(true);
+  // m_main_hbox.pack_start(m_vbox, Gtk::PACK_EXPAND_WIDGET);
+  m_vbox.pack_start(m_conversationCont, Gtk::PACK_EXPAND_WIDGET);
+  m_vbox.pack_start(m_hbox, Gtk::PACK_SHRINK);
+  m_hbox.pack_start(m_entry, Gtk::PACK_EXPAND_WIDGET);
+  m_hbox.pack_start(m_button, Gtk::PACK_SHRINK);
+  m_hbox.pack_start(m_button2, Gtk::PACK_SHRINK);
+  // GtkHeaderBar
+  m_headerbar.pack_start(m_rosterpanel_reveal_btn);
+  m_headerbar.pack_start(m_test_hide_btn);
 }
 
 void MainWindow::sendMessage()
@@ -92,3 +113,12 @@ void MainWindow::onConnectSignal()
    m_conversationCont.addMessage("Message receved");
    m_conversationCont.addMessage(m_xmpplar_client->getBody());
  }
+
+void MainWindow::showHideSideBar()
+{
+  if (m_sidebar.get_child_revealed()) {
+    m_sidebar.set_reveal_child(false);
+  }else{
+    m_sidebar.set_reveal_child(true);
+  }
+}

+ 11 - 4
src/main-window.h

@@ -28,7 +28,7 @@
 #include <gloox/client.h>
 #include "xmpplar_client.h"
 #include <thread>
-#include "widget_roster_panel.h"
+#include "widget_side_bar.hpp"
 
 class XmpplarClient;
 
@@ -39,14 +39,18 @@ private:
   Gtk::Button m_button, m_button2;
   ConversationContainer m_conversationCont;
   Gtk::Entry m_entry;
-  widget::RosterPanel m_roster_panel;
+  widget::SideBar m_sidebar;
+  Gtk::Button m_rosterpanel_reveal_btn;
+  Gtk::Button m_test_hide_btn; // Remove later
 
   //For thread-GUI comunication
   Glib::Dispatcher m_msg_dispatcher;
 
   // Here comes containers
-  Gtk::Box m_h_box;
-  Gtk::Box m_box;
+  Gtk::Overlay m_overlay;
+  // Gtk::Box m_main_hbox;
+  Gtk::Box m_hbox;
+  Gtk::Box m_vbox;
   Glib::ustring m_text_msg;
   std::string m_text_msg_trd;
   Gtk::HeaderBar m_headerbar;
@@ -60,6 +64,9 @@ private:
 public:
   MainWindow();
   // virtual ~MainWindow();
+  void generateUI();
+  void showHideSideBar();
+
   void sendMessage();
   void onConnectSignal();
 

+ 5 - 3
src/widget_roster_panel.cpp

@@ -22,8 +22,10 @@
 using namespace widget;
 
 RosterPanel::RosterPanel()
+  : normal_button("hi there")
 {
-  widget::RosterRow item;
-  m_contact_list.push_back(item);
-  append(m_contact_list.back());
+  testing.add(normal_button);
+  append(item);
+  append(testing);
+  show();
 }

+ 7 - 6
src/widget_roster_panel.h

@@ -21,14 +21,15 @@
 #include <vector>
 #include "widget_roster_row.h"
 
+using namespace widget;
+
 namespace widget {
-  class RosterPanel : Gtk::ListBoxRow
+  class RosterPanel : public Gtk::ListBox
   {
   private:
-    // I don't think this is necessary
-    std::vector<widget::RosterRow> m_contact_list;
-    
-    
+    RosterRow item;
+    Gtk::ListBoxRow testing;
+    Gtk::Button normal_button;
   public:
     RosterPanel();
     
@@ -37,7 +38,7 @@ namespace widget {
     
     //We need to implement how to populate the list
 
-}
+  };
 }
 
 #endif

+ 4 - 2
src/widget_roster_row.cpp

@@ -20,6 +20,8 @@
 using namespace widget;
 
 RosterRow::RosterRow()
+  : m_hbox_main(Gtk::ORIENTATION_HORIZONTAL),
+    m_vbox_text(Gtk::ORIENTATION_VERTICAL)
 {
   add(m_base_frame);
   m_base_frame.add(m_hbox_main);
@@ -30,6 +32,6 @@ RosterRow::RosterRow()
   m_vbox_text.pack_start(m_status_msg);
 
   // setting the content of the labels
-  m_jid_label("labia@emacs.sen");
-  m_status_msg("Some things must be hidden");
+  m_jid_label.set_text("labia@emacs.sen");
+  m_status_msg.set_text("Some things must be hidden");
 }

+ 0 - 0
src/widget_roster_row.h


Some files were not shown because too many files changed in this diff