← Back to team overview

mira-dev team mailing list archive

Re: [Merge] lp:~naveen-akarapu/mira/highlight-contacts into lp:mira

 

Has this code been tested on Windows?

regards,

Alan Alvarez


On Fri, Jul 30, 2010 at 9:47 AM, Max Bossino <max@xxxxxxxxxxxxxxxxx> wrote:

> Max Bossino has proposed merging lp:~naveen-akarapu/mira/highlight-contacts
> into lp:mira.
>
> Requested reviews:
>  Mira Core Development Team (mira-dev)
>
>
> Changes to the Contacts widget:
>  - Added highlighting when a message is received from a contact;
>  - Removed "Active" status.
>
> Also fixes two bugs:
>  - New User dialog bug (dialog didn't work on Windows);
>  - Login Segfault bug (crash caused by Segfault upon logging in).
> --
>
> https://code.launchpad.net/~naveen-akarapu/mira/highlight-contacts/+merge/31380
> Your team Mira Core Development Team is requested to review the proposed
> merge of lp:~naveen-akarapu/mira/highlight-contacts into lp:mira.
>
> === modified file 'mira-client/include/gui/qt/ChatDockWidget.h'
> --- mira-client/include/gui/qt/ChatDockWidget.h 2010-03-23 19:47:13 +0000
> +++ mira-client/include/gui/qt/ChatDockWidget.h 2010-07-30 13:47:41 +0000
> @@ -37,6 +37,7 @@
>             the dock widget is placed on top of another (to become a tabbed
> widget).
>         //*/
>         void closed(bool);
> +       void nonCurrentUserMsgRcvd(QString);
>     private slots:
>                void sendMessage();
>     private:
>
> === modified file 'mira-client/include/gui/qt/ContactDockWidget.h'
> --- mira-client/include/gui/qt/ContactDockWidget.h      2010-04-20 18:41:11
> +0000
> +++ mira-client/include/gui/qt/ContactDockWidget.h      2010-07-30 13:47:41
> +0000
> @@ -21,6 +21,7 @@
>     public slots:
>         void addUser(QString username, int state);
>         void clearUsers();
> +       void highlightUser(const QString username);
>
>     signals:
>         void addedUser(const QString& username);
> @@ -42,10 +43,8 @@
>         void deleteUserList(const QList<QTreeWidgetItem*>& users);
>         void setupUI();
>         bool takeTreeItem(QTreeWidgetItem* tree, const QString& itemName);
> -        QTreeWidgetItem * activeTreeItem;
>         QTreeWidgetItem * onlineTreeItem;
>         QTreeWidgetItem * offlineTreeItem;
> -        int numActiveInWorkplace;
>         int numOnlineInWorkplace;
>         int numOfflineInWorkplace;
>         int numTotalInWorkplace;
>
> === modified file 'mira-client/include/gui/qt/GuiApp.h'
> --- mira-client/include/gui/qt/GuiApp.h 2010-05-17 00:30:06 +0000
> +++ mira-client/include/gui/qt/GuiApp.h 2010-07-30 13:47:41 +0000
> @@ -39,6 +39,7 @@
>         void trayMessage(const QString& title, const QString& message);
>         void receiveChatMessage(const std::string& source, const
> std::string& message);
>         void setWorkplaceDescription(const std::string& workplace, const
> std::string& description);
> +       void createWorkplaceSummaryTab(Workplace * wp);
>     private slots:
>         void MiscTrigger();
>     signals:
>
> === modified file 'mira-client/include/gui/qt/Workplace.h'
> --- mira-client/include/gui/qt/Workplace.h      2010-04-20 18:41:11 +0000
> +++ mira-client/include/gui/qt/Workplace.h      2010-07-30 13:47:41 +0000
> @@ -43,11 +43,10 @@
>         void changeMemberStatus(const std::string& username, char status);
>         const MemberList& getMemberList();
>         QWidget* getSummaryTab() { return m_summaryTab; }
> +        void createSummaryTab();
>
>     protected:
>     private:
> -        Q_SLOT void createSummaryTab();
> -
>         std::string      m_name;
>         UtilityList      m_utilities;
>         MemberList       m_members;
>
> === modified file 'mira-client/include/network/messages/MsgMembersList.h'
> --- mira-client/include/network/messages/MsgMembersList.h       2010-02-18
> 13:51:21 +0000
> +++ mira-client/include/network/messages/MsgMembersList.h       2010-07-30
> 13:47:41 +0000
> @@ -87,7 +87,7 @@
>
>
> QMetaObject::invokeMethod(Application::get_gui_application(),
> "AddWorkplaceMember", Qt::QueuedConnection,
>                                           MIRA_QT_GENERIC_ARG(std::string,
> workplace),
> -                                          MIRA_QT_GENERIC_ARG(std::string,
> Iter->substr(0, pos)),
> +                                          MIRA_QT_GENERIC_ARG(std::string,
> Iter->substr(0, pos)),
>                                           MIRA_QT_GENERIC_ARG(char,
> (*Iter)[pos+1]));
>             }
>         }
>
> === modified file 'mira-client/include/network/messages/MsgUtilityList.h'
> --- mira-client/include/network/messages/MsgUtilityList.h       2010-04-07
> 23:12:09 +0000
> +++ mira-client/include/network/messages/MsgUtilityList.h       2010-07-30
> 13:47:41 +0000
> @@ -95,7 +95,7 @@
>                 }
>
>
> QMetaObject::invokeMethod(Application::get_gui_application(), "AddUtility",
> Qt::QueuedConnection,
> -                                          MIRA_QT_GENERIC_ARG(std::string,
> workplace),
> +                                         MIRA_QT_GENERIC_ARG(std::string,
> workplace),
>
> MIRA_QT_GENERIC_ARG(GuiInterface*, utility));
>
>             }
>
> === modified file 'mira-client/src/gui/qt/ChatDockWidget.cpp'
> --- mira-client/src/gui/qt/ChatDockWidget.cpp   2010-05-14 03:21:41 +0000
> +++ mira-client/src/gui/qt/ChatDockWidget.cpp   2010-07-30 13:47:41 +0000
> @@ -75,6 +75,10 @@
>         usersTextBrowsers.value(username)->insertHtml("<b><font
> color=\""+color+"\">"+username+": </font></b>"+message+"<br />");
>         QScrollBar *sb = m_currentBrowser->verticalScrollBar();
>         sb->setValue(sb->maximum());
> +       if (username != m_currentUser) {
> +               std::cout << "nonCurrentUserMsgRcvd" << std::endl;
> +               emit nonCurrentUserMsgRcvd(username);
> +       }
>     }
>     else
>     {
>
> === modified file 'mira-client/src/gui/qt/ContactDockWidget.cpp'
> --- mira-client/src/gui/qt/ContactDockWidget.cpp        2010-05-15 15:58:40
> +0000
> +++ mira-client/src/gui/qt/ContactDockWidget.cpp        2010-07-30 13:47:41
> +0000
> @@ -1,12 +1,13 @@
>  #include "ContactDockWidget.h"
>  #include "User.h"
>  #include "MiraDefs.h"
> -
> +#include <QBrush>
> +#include <QColor>
>  #include <iostream>
>
>  using namespace miraclient::gui;
>
> -ContactDockWidget::ContactDockWidget() : numActiveInWorkplace(0),
> numOnlineInWorkplace(0), numOfflineInWorkplace(0), numTotalInWorkplace(0)
> +ContactDockWidget::ContactDockWidget() : numOnlineInWorkplace(0),
> numOfflineInWorkplace(0), numTotalInWorkplace(0)
>  {
>     //ctor
>     contactTree = new QTreeWidget;
> @@ -15,13 +16,14 @@
>     setupUI();
>     contactTree->expandAll();
>     connect(contactTree, SIGNAL(itemClicked(QTreeWidgetItem*,int)), this,
> SLOT(switchContact(QTreeWidgetItem*,int)));
> -       connect(contactTree, SIGNAL(itemChanged(QTreeWidgetItem*,int)),
> this, SLOT(switchContact(QTreeWidgetItem*,int)));
> +       //connect(contactTree, SIGNAL(itemChanged(QTreeWidgetItem*,int)),
> this, SLOT(switchContact(QTreeWidgetItem*,int)));
>  }
>
>  void ContactDockWidget::switchContact(QTreeWidgetItem* item, int column)
>  {
> -       std::cout << "Switching Contact" << std::endl;
> +       std::cout << "Switching Contact" << item->text(0).toStdString() <<
> std::endl;
>     emit contactSwitched(item->text(0));
> +       item->setBackground(0, QBrush((QColor("white"))));
>  }
>
>  ContactDockWidget::~ContactDockWidget()
> @@ -46,9 +48,6 @@
>     contactTree->headerItem()->setText(0, QString());
>     contactTree->clear();
>
> -    activeTreeItem = new QTreeWidgetItem(contactTree);
> -    activeTreeItem->setText(0, tr("Active (0/0)"));
> -
>     onlineTreeItem = new QTreeWidgetItem(contactTree);
>     onlineTreeItem->setText(0, tr("Online (0/0)"));
>
> @@ -69,7 +68,6 @@
>
>  void ContactDockWidget::updateUserCountDisplay()
>  {
> -    activeTreeItem->setText(0, QString("Active
> (%1/%2)").arg(numActiveInWorkplace).arg(numTotalInWorkplace));
>     onlineTreeItem->setText(0, QString("Online
> (%1/%2)").arg(numOnlineInWorkplace).arg(numTotalInWorkplace));
>     offlineTreeItem->setText(0, QString("Offline
> (%1/%2)").arg(numOfflineInWorkplace).arg(numTotalInWorkplace));
>  }
> @@ -101,7 +99,23 @@
>     __item->setText(0, username);
>     __item->setIcon(0,*icon);
>     updateUserCountDisplay();
> -}
> +
> +}
> +
> +// This method/slot highlights the user in the contact tree
> +void ContactDockWidget::highlightUser(const QString username)
> +{
> +
> +       QTreeWidgetItem *chld;
> +       for (int childCt=onlineTreeItem->childCount();childCt>0;childCt--)
> {
> +               chld = onlineTreeItem->child(childCt-1);
> +               if (chld->text(0) == username)
> +                       chld->setBackground(0,QBrush(QColor("orange")));
> +
> +       }
> +
> +}
> +
>
>  void ContactDockWidget::deleteUserList(const QList<QTreeWidgetItem*>&
> users)
>  {
> @@ -113,11 +127,10 @@
>
>  void ContactDockWidget::clearUsers()
>  {
> -    deleteUserList(activeTreeItem->takeChildren());
>     deleteUserList(onlineTreeItem->takeChildren());
>     deleteUserList(offlineTreeItem->takeChildren());
>
> -    numTotalInWorkplace = numActiveInWorkplace = numOnlineInWorkplace =
> numOfflineInWorkplace = 0;
> +    numTotalInWorkplace = numOnlineInWorkplace = numOfflineInWorkplace =
> 0;
>     updateUserCountDisplay();
>  }
>
>
> === modified file 'mira-client/src/gui/qt/GuiApp.cpp'
> --- mira-client/src/gui/qt/GuiApp.cpp   2010-05-17 00:30:06 +0000
> +++ mira-client/src/gui/qt/GuiApp.cpp   2010-07-30 13:47:41 +0000
> @@ -123,6 +123,11 @@
>     emit AddedWorkplace(wp);
>  }
>
> +void GuiApp::createWorkplaceSummaryTab(Workplace *wp)
> +{
> +    wp->createSummaryTab();
> +}
> +
>  void GuiApp::AddWorkplaceMember(const std::string& workplace, const
> std::string& username, char status)
>  {
>     WorkplaceMember member = { username, status };
>
> === modified file 'mira-client/src/gui/qt/MainWindow.cpp'
> --- mira-client/src/gui/qt/MainWindow.cpp       2010-05-17 00:30:06 +0000
> +++ mira-client/src/gui/qt/MainWindow.cpp       2010-07-30 13:47:41 +0000
> @@ -85,6 +85,7 @@
>     connect(app,SIGNAL(ChangedWorkplace(Workplace *,Utility
> *)),this,SLOT(setActiveWorkplace(Workplace *,Utility *)));
>     connect(m_contactWidget, SIGNAL(contactSwitched(QString)),
> m_chatWidget, SLOT(userChatSwitched(QString)));
>     connect(app, SIGNAL(userStatusChanged(QString,char)), m_contactWidget,
> SLOT(changeUserStatus(QString,char)));
> +    connect(m_chatWidget, SIGNAL(nonCurrentUserMsgRcvd(QString)),
> m_contactWidget, SLOT(highlightUser(QString)));
>  }
>
>  void MainWindow::createActions()
>
> === modified file 'mira-client/src/gui/qt/Workplace.cpp'
> --- mira-client/src/gui/qt/Workplace.cpp        2010-04-20 18:41:11 +0000
> +++ mira-client/src/gui/qt/Workplace.cpp        2010-07-30 13:47:41 +0000
> @@ -5,6 +5,7 @@
>  #include <QPicture>
>  #include <QSize>
>  #include <QApplication>
> +#include "tools.h"
>
>  typedef GuiInterface Utility;
>
> @@ -44,7 +45,9 @@
>  Workplace::Workplace(std::string name) : m_name(name)
>  {
>     moveToThread(QApplication::instance()->thread());
> -    QMetaObject::invokeMethod(this, "createSummaryTab",
> Qt::QueuedConnection);
> +    //QMetaObject::invokeMethod(this, "createSummaryTab",
> Qt::QueuedConnection);
> +    Workplace *wp = this;
> +    QMetaObject::invokeMethod(Application::get_gui_application(),
> "createWorkplaceSummaryTab", Qt::QueuedConnection,
> MIRA_QT_GENERIC_ARG(Workplace*, wp));
>  }
>
>  Workplace::~Workplace()
>
> === modified file 'mira-client/src/network/asio/AsioClient.cpp'
> --- mira-client/src/network/asio/AsioClient.cpp 2010-05-17 00:30:06 +0000
> +++ mira-client/src/network/asio/AsioClient.cpp 2010-07-30 13:47:41 +0000
> @@ -175,7 +175,7 @@
>  {
>     boost::system::error_code l_error;
>
> -   size_t bytes_transferred =
> m_socket.read_some(boost::asio::buffer(get_input_buffer(),
> input_buffer_size()), l_error);
> +    size_t bytes_transferred =
> m_socket.read_some(boost::asio::buffer(get_input_buffer(),
> input_buffer_size()), l_error);
>
>     if (l_error)
>     {
>
>
> _______________________________________________
> Mailing list: https://launchpad.net/~mira-dev
> Post to     : mira-dev@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~mira-dev
> More help   : https://help.launchpad.net/ListHelp
>
>

-- 
https://code.launchpad.net/~naveen-akarapu/mira/highlight-contacts/+merge/31380
Your team Mira Core Development Team is requested to review the proposed merge of lp:~naveen-akarapu/mira/highlight-contacts into lp:mira.



References