Added tooltip for networkItems and bufferItems
authorAlexander von Renteln <phon@quassel-irc.org>
Wed, 20 Feb 2008 14:54:21 +0000 (14:54 +0000)
committerAlexander von Renteln <phon@quassel-irc.org>
Wed, 20 Feb 2008 14:54:21 +0000 (14:54 +0000)
src/client/networkmodel.cpp
src/client/networkmodel.h
src/qtui/mainwin.cpp
src/uisupport/bufferview.cpp
version.inc

index e96e367..a72b71e 100644 (file)
@@ -282,6 +282,37 @@ void BufferItem::userModeChanged(IrcUser *ircUser) {
   addUserToCategory(ircUser);
 }
 
+QString BufferItem::toolTip(int column) const {
+  Q_UNUSED(column);
+  QStringList toolTip;
+
+  switch(bufferType()) {
+    case BufferInfo::StatusBuffer: {
+      QString netName = Client::network(bufferInfo().networkId())->networkName();
+      toolTip.append(QString("<b>Status buffer from %1</b>").arg(netName));
+      break;
+    }
+    case BufferInfo::ChannelBuffer:
+      toolTip.append(QString("<b>Channel %1</b>").arg(bufferName()));
+      if(isActive()) {
+        toolTip.append(QString("Topic: %1").arg(topic()));
+        toolTip.append(QString("Users: %1").arg(nickCount()));
+      } else {
+        toolTip.append(QString("Not active <br /> Double-click to join"));
+      }
+      break;
+    case BufferInfo::QueryBuffer:
+      toolTip.append(QString("<b>Query with %1</b>").arg(bufferName()));
+      if(topic() != "") toolTip.append(QString("Away Message: %1").arg(topic()));
+      break;
+    default: //this should not happen
+      toolTip.append(QString("%1 - %2").arg(bufferInfo().bufferId().toInt()).arg(bufferName()));
+      break;
+  }
+
+  return QString("<p> %1 </p>").arg(toolTip.join("<br />"));
+}
+
 /*
 void BufferItem::setLastMsgInsert(QDateTime msgDate) {
   if(msgDate.isValid() && msgDate > _lastMsgInsert)
@@ -405,6 +436,18 @@ void NetworkItem::setCurrentServer(const QString &serverName) {
   emit dataChanged(1);
 }
 
+
+QString NetworkItem::toolTip(int column) const {
+  Q_UNUSED(column);
+
+  QStringList toolTip(QString("<b>%1</b>").arg(networkName()));
+  toolTip.append(QString("Server: %1").arg(currentServer()));
+  toolTip.append(QString("Users: %1").arg(nickCount()));
+
+  return QString("<p> %1 </p>").arg(toolTip.join("<br />"));
+}
+
+
 /*****************************************
 *  User Category Items (like @vh etc.)
 *****************************************/
index 6ac06f8..208503c 100644 (file)
@@ -77,6 +77,8 @@ public:
   bool setLastSeen();
   QDateTime lastSeen();
 
+  virtual QString toolTip(int column) const;
+
 public slots:
   void setTopic(const QString &topic);
   void join(IrcUser *ircUser);
@@ -116,18 +118,20 @@ public:
   virtual QVariant data(int column, int row) const;
 
   bool isActive() const;
-  
+
   QString networkName() const;
   QString currentServer() const;
   int nickCount() const;
-  
+
+  virtual QString toolTip(int column) const;
+
 public slots:
   void setNetworkName(const QString &networkName);
   void setCurrentServer(const QString &serverName);
 
   void attachNetwork(Network *network);
   void attachIrcChannel(const QString &channelName);
-  
+
 private:
   NetworkId _networkId;
 
index 5b43087..b44f7dd 100644 (file)
@@ -266,9 +266,8 @@ void MainWin::setupTopicWidget() {
 void MainWin::setupSystray() {
   systray = new QSystemTrayIcon(this);
   systray->setIcon(QIcon(":/icons/quassel-icon.png"));
-
-  QString toolTip("Left click to minimize the Quassel Client to tray");
-  systray->setToolTip(toolTip);
+//  systray->setToolTip("left click to minimize the quassel client to tray");
+//  systray->setToolTip(toolTip);
 
   systrayMenu = new QMenu(this);
   systrayMenu->addAction(ui.actionAboutQuassel);
@@ -298,6 +297,7 @@ void MainWin::changeEvent(QEvent *event) {
       QtUiSettings s;
       if(s.value("UseSystemTrayIcon").toBool() && s.value("MinimizeOnMinimize").toBool()) {
         toggleVisibility();
+        event->ignore();
       }
     }
   }
@@ -374,7 +374,7 @@ void MainWin::systrayActivated( QSystemTrayIcon::ActivationReason activationReas
 }
 
 void MainWin::toggleVisibility() {
-  if(isHidden() || !isActiveWindow()) {
+  if(isHidden() /*|| !isActiveWindow()*/) {
     show();
     if(isMinimized())
       if (isMaximized())
@@ -383,9 +383,11 @@ void MainWin::toggleVisibility() {
         showNormal();
 
     raise();
-    activateWindow();
+    setFocus(Qt::ActiveWindowFocusReason);
+    // activateWindow();
   } else {
     if(systray->isSystemTrayAvailable ()) {
+      clearFocus();
       hide();
       if(!systray->isVisible()) {
         systray->show();
index 27858a9..b99f990 100644 (file)
@@ -138,15 +138,18 @@ void BufferView::showContextMenu(const QPoint &pos) {
 
   QMenu *hideEventsMenu = new QMenu(tr("Hide Events"), this);
   QAction *hideJoinAction = hideEventsMenu->addAction(tr("Join Events"));
-  QAction *hidePartAction = hideEventsMenu->addAction(tr("PartEvents"));
-  QAction *hideQuitAction = hideEventsMenu->addAction(tr("QuitEvents"));
+  QAction *hidePartAction = hideEventsMenu->addAction(tr("Part Events"));
+  QAction *hideKillAction = hideEventsMenu->addAction(tr("Kill Events"));
+  QAction *hideQuitAction = hideEventsMenu->addAction(tr("Quit Events"));
   QAction *hideModeAction = hideEventsMenu->addAction(tr("Mode Events"));
   hideJoinAction->setCheckable(true);
   hidePartAction->setCheckable(true);
+  hideKillAction->setCheckable(true);
   hideQuitAction->setCheckable(true);
   hideModeAction->setCheckable(true);
   hideJoinAction->setEnabled(false);
   hidePartAction->setEnabled(false);
+  hideKillAction->setEnabled(false);
   hideQuitAction->setEnabled(false);
   hideModeAction->setEnabled(false);
 
@@ -174,11 +177,17 @@ void BufferView::showContextMenu(const QPoint &pos) {
     contextMenu.addAction(ignoreListAction);
     contextMenu.addAction(whoBufferAction);
 
-    if(bufferInfo.type() == BufferInfo::ChannelBuffer && index.data(NetworkModel::ItemActiveRole).toBool()) {
-       removeBufferAction->setEnabled(false);
-       joinBufferAction->setVisible(false);
+    if(bufferInfo.type() == BufferInfo::ChannelBuffer) {
+      if(index.data(NetworkModel::ItemActiveRole).toBool()) {
+        removeBufferAction->setEnabled(false);
+        removeBufferAction->setToolTip("To delete the buffer, part the channel first.");
+        joinBufferAction->setVisible(false);
+      } else {
+        partBufferAction->setVisible(false);
+      }
     } else {
-       partBufferAction->setVisible(false);
+      joinBufferAction->setVisible(false);
+      partBufferAction->setVisible(false);
     }
   }
 
index 16c1d3c..da0bd11 100644 (file)
@@ -5,7 +5,7 @@
 
   quasselVersion = "0.2.0-pre";
   quasselDate = "2008-02-19";
-  quasselBuild = 559;
+  quasselBuild = 561;
 
   //! Minimum client build number the core needs
   clientBuildNeeded = 559;