From kde-commits Thu Jul 01 13:27:07 2010 From: Stephan Binner Date: Thu, 01 Jul 2010 13:27:07 +0000 To: kde-commits Subject: [Konversation] 6daf0e6: Slower blinking tabs if only Message-Id: <20100701132707.EEC05BB5517 () projects ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=127799896518608 commit 6daf0e6804f9e16c2cad6bda413872c9c9d189a2 Author: Stephan Binner Date: Thu Dec 4 22:35:34 2003 +0000 Slower blinking tabs if only join/part/quit/nick change happened in channel svn path=/trunk/kdeextragear-2/konversation/; revision=271260 diff --git a/konversation/channel.cpp b/konversation/channel.cpp index 127ec54..d866f5f 100644 --- a/konversation/channel.cpp +++ b/konversation/channel.cpp @@ -233,7 +233,7 @@ Channel::Channel(QWidget* parent) : ChatWindow(parent) connect(channelInput,SIGNAL (pageUp()),getTextView(),SLOT (pageUp()) ); connect(channelInput,SIGNAL (pageDown()),getTextView(),SLOT (pageDown()) ); - connect(textView,SIGNAL (newText(const QString&)),this,SLOT (newTextInView(const QString&)) ); + connect(textView,SIGNAL (newText(const QString&,bool)),this,SLOT (newTextInView(const QString&,bool)) ); connect(textView,SIGNAL (gotFocus()),this,SLOT (adjustFocus()) ); connect(textView,SIGNAL (sendFile()),this,SLOT (sendFileMenu()) ); @@ -634,9 +634,9 @@ void Channel::sendChannelText(const QString& sendLine) server->queueList(filter.getServerOutputList()); } -void Channel::newTextInView(const QString& highlightColor) +void Channel::newTextInView(const QString& highlightColor,bool important) { - emit newText(this,highlightColor); + emit newText(this,highlightColor,important); } void Channel::setNickname(const QString& newNickname) @@ -773,10 +773,10 @@ void Channel::renameNick(const QString& nickname,const QString& newNick) if(nickname==server->getNickname()) { setNickname(newNick); - appendCommandMessage(i18n("Nick"),i18n("You are now known as %1.").arg(newNick)); + appendCommandMessage(i18n("Nick"),i18n("You are now known as %1.").arg(newNick),false); } /* No, must've been someone else */ - else appendCommandMessage(i18n("Nick"),i18n("%1 is now known as %2.").arg(nickname).arg(newNick)); + else appendCommandMessage(i18n("Nick"),i18n("%1 is now known as %2.").arg(nickname).arg(newNick),false); /* Update the nick list */ Nick* nick=getNickByName(nickname); @@ -792,12 +792,12 @@ void Channel::joinNickname(const QString& nickname,const QString& hostmask) /* Did we join this channel ourselves? */ if(nickname==server->getNickname()) { - appendCommandMessage(i18n("Join"),i18n("You have joined channel %1. (%2)").arg(getName()).arg(hostmask)); + appendCommandMessage(i18n("Join"),i18n("You have joined channel %1. (%2)").arg(getName()).arg(hostmask),false); } /* No, it was somebody else */ else { - appendCommandMessage(i18n("Join"),i18n("%1 has joined this channel. (%2)").arg(nickname).arg(hostmask)); + appendCommandMessage(i18n("Join"),i18n("%1 has joined this channel. (%2)").arg(nickname).arg(hostmask),false); addNickname(nickname,hostmask,false,false,false,false,false); } nicknameListView->sort(); @@ -807,15 +807,15 @@ void Channel::removeNick(const QString &nickname, const QString &reason, bool qu { if(nickname==server->getNickname()) { - if(quit) appendCommandMessage(i18n("Quit"),i18n("You have left this server. (%1)").arg(reason)); - else appendCommandMessage(i18n("Part"),i18n("You have left channel %1. (%2)").arg(getName()).arg(reason)); + if(quit) appendCommandMessage(i18n("Quit"),i18n("You have left this server. (%1)").arg(reason),false); + else appendCommandMessage(i18n("Part"),i18n("You have left channel %1. (%2)").arg(getName()).arg(reason),false); delete this; } else { - if(quit) appendCommandMessage(i18n("Quit"),i18n("%1 has left this server. (%2)").arg(nickname).arg(reason)); - else appendCommandMessage(i18n("Part"),i18n("%1 has left this channel. (%2)").arg(nickname).arg(reason)); + if(quit) appendCommandMessage(i18n("Quit"),i18n("%1 has left this server. (%2)").arg(nickname).arg(reason),false); + else appendCommandMessage(i18n("Part"),i18n("%1 has left this channel. (%2)").arg(nickname).arg(reason),false); Nick* nick=getNickByName(nickname); if(nick==0) kdWarning() << "Channel::removeNick(): Nickname " << nickname << " not found!" << endl; diff --git a/konversation/channel.h b/konversation/channel.h index d02b114..1e5bd90 100644 --- a/konversation/channel.h +++ b/konversation/channel.h @@ -93,7 +93,7 @@ class Channel : public ChatWindow virtual bool searchView(); signals: - void newText(QWidget* channel,const QString& highlightColor); + void newText(QWidget* channel,const QString& highlightColor, bool important); void prefsChanged(); void sendFile(); @@ -101,7 +101,7 @@ class Channel : public ChatWindow void setNickname(const QString& newNickname); void channelTextEntered(); void sendChannelText(const QString& line); - void newTextInView(const QString& highlightColor); + void newTextInView(const QString& highlightColor, bool important); void adjustFocus(); void showQuickButtons(bool show); void showModeButtons(bool show); diff --git a/konversation/chatwindow.cpp b/konversation/chatwindow.cpp index 243b43e..a04629c 100644 --- a/konversation/chatwindow.cpp +++ b/konversation/chatwindow.cpp @@ -162,9 +162,9 @@ void ChatWindow::appendServerMessage(const QString& type,const QString& message) textView->appendServerMessage(type,message); } -void ChatWindow::appendCommandMessage(const QString& command,const QString& message) +void ChatWindow::appendCommandMessage(const QString& command,const QString& message, bool important) { - textView->appendCommandMessage(command,message); + textView->appendCommandMessage(command,message,important); } void ChatWindow::appendBacklogMessage(const QString& firstColumn,const QString& message) diff --git a/konversation/chatwindow.h b/konversation/chatwindow.h index 54e2d7a..d1d1583 100644 --- a/konversation/chatwindow.h +++ b/konversation/chatwindow.h @@ -72,7 +72,7 @@ class ChatWindow : public QVBox void appendQuery(const QString& nickname,const QString& message); void appendAction(const QString& nickname,const QString& message); void appendServerMessage(const QString& type,const QString& message); - void appendCommandMessage(const QString& command,const QString& message); + void appendCommandMessage(const QString& command,const QString& message,bool important=true); void appendBacklogMessage(const QString& firstColumn,const QString& message); QWidget* parentWidget; diff --git a/konversation/dccchat.cpp b/konversation/dccchat.cpp index 76c93e7..83b8e18 100644 --- a/konversation/dccchat.cpp +++ b/konversation/dccchat.cpp @@ -68,7 +68,7 @@ DccChat::DccChat(QWidget* parent,const QString& myNickname,const QString& nickna connect(dccChatInput,SIGNAL (textPasted(QString)),this,SLOT (textPasted(QString)) ); connect(getTextView(),SIGNAL (gotFocus()),this,SLOT (adjustFocus()) ); - connect(getTextView(),SIGNAL (newText(const QString&)),this,SLOT (newTextInView(const QString&)) ); + connect(getTextView(),SIGNAL (newText(const QString&,bool)),this,SLOT (newTextInView(const QString&,bool)) ); if(listen) listenForPartner(); @@ -111,9 +111,9 @@ void DccChat::listenForPartner() else kdDebug() << this << "DccChat::listenForPartner(): listenSocket->listen() failed!" << endl; } -void DccChat::newTextInView(const QString& highlightColor) +void DccChat::newTextInView(const QString& highlightColor, bool important) { - emit newText(this,highlightColor); + emit newText(this,highlightColor,important); } void DccChat::connectToPartner() diff --git a/konversation/dccchat.h b/konversation/dccchat.h index 0f760f4..0f5ed7a 100644 --- a/konversation/dccchat.h +++ b/konversation/dccchat.h @@ -45,7 +45,7 @@ class DccChat : public ChatWindow virtual void adjustFocus(); signals: - void newText(QWidget* query,const QString& highlightColor); + void newText(QWidget* query,const QString& highlightColor,bool important); protected slots: void lookupFinished(int numberOfResults); @@ -54,7 +54,7 @@ class DccChat : public ChatWindow void readData(); void dccChatTextEntered(); void textPasted(QString text); - void newTextInView(const QString& highlightColor); + void newTextInView(const QString& highlightColor, bool important); void heardPartner(); protected: diff --git a/konversation/ircview.cpp b/konversation/ircview.cpp index 26cf868..b6f4dce 100644 --- a/konversation/ircview.cpp +++ b/konversation/ircview.cpp @@ -499,7 +499,7 @@ void IRCView::appendServerMessage(const QString& type,const QString& message) doAppend(line); } -void IRCView::appendCommandMessage(const QString& type,const QString& message) +void IRCView::appendCommandMessage(const QString& type,const QString& message, bool important) { QString commandColor=KonversationApplication::preferences.getColor("CommandMessage"); @@ -514,7 +514,7 @@ void IRCView::appendCommandMessage(const QString& type,const QString& message) #endif emit textToLog(QString("%1\t%2").arg(type).arg(message)); - doAppend(line); + doAppend(line,false,important); } void IRCView::appendBacklogMessage(const QString& firstColumn,const QString& rawMessage) @@ -549,7 +549,7 @@ void IRCView::appendBacklogMessage(const QString& firstColumn,const QString& raw doAppend(line,true); } -void IRCView::doAppend(QString newLine,bool suppressTimestamps) +void IRCView::doAppend(QString newLine,bool suppressTimestamps,bool important) { // Add line to buffer QString line(newLine); @@ -569,7 +569,7 @@ void IRCView::doAppend(QString newLine,bool suppressTimestamps) } buffer+=line; - emit newText(highlightColor); + emit newText(highlightColor,important); // scroll view only if the scroll bar is already at the bottom #if QT_VERSION == 303 diff --git a/konversation/ircview.h b/konversation/ircview.h index 3e7f74f..5388edc 100644 --- a/konversation/ircview.h +++ b/konversation/ircview.h @@ -51,7 +51,7 @@ class IRCView : public KTextBrowser signals: // Notify container of new text and highlight state - void newText(const QString& highlightColor); + void newText(const QString& highlightColor, bool important); void gotFocus(); // So we can set focus to input line void textToLog(const QString& text); void sendFile(); @@ -63,7 +63,7 @@ class IRCView : public KTextBrowser void appendQuery(const QString& nick,const QString& message); void appendAction(const QString& nick,const QString& message); void appendServerMessage(const QString& type,const QString& message); - void appendCommandMessage(const QString& command,const QString& message); + void appendCommandMessage(const QString& command,const QString& message,bool important); void appendBacklogMessage(const QString& firstColumn,const QString& message); void search(); @@ -75,7 +75,7 @@ class IRCView : public KTextBrowser protected: QString filter(const QString& line,const QString& who=NULL,bool doHilight=true); - void doAppend(QString line,bool suppressTimestamps=false); + void doAppend(QString line,bool suppressTimestamps=false,bool important=true); void replaceDecoration(QString& line,char decoration,char replacement); void hideEvent(QHideEvent* event); diff --git a/konversation/konversationmainwindow.cpp b/konversation/konversationmainwindow.cpp index 494b19d..d182366 100644 --- a/konversation/konversationmainwindow.cpp +++ b/konversation/konversationmainwindow.cpp @@ -235,7 +235,7 @@ void KonversationMainWindow::appendToFrontmost(const QString& type,const QString // FIXME: this signal should be sent from the status panel instead, so it // can be using the correct highlight color, would be more consistent // anyway! - newText(serverView,QString::null); + newText(serverView,QString::null,true); } else frontView->appendServerMessage(type,message); @@ -396,7 +396,7 @@ void KonversationMainWindow::addDccPanel() dccPanelOpen=true; } // no highlight color for DCC panels - newText(dccPanel,QString::null); + newText(dccPanel,QString::null,true); } } @@ -435,7 +435,7 @@ void KonversationMainWindow::addDccChat(const QString& myNick,const QString& nic DccChat* dccChatPanel=new DccChat(getViewContainer(),myNick,nick,arguments,listen); addView(dccChatPanel,3,dccChatPanel->getName()); - connect(dccChatPanel,SIGNAL (newText(QWidget*,const QString&)),this,SLOT (newText(QWidget*,const QString&)) ); + connect(dccChatPanel,SIGNAL (newText(QWidget*,const QString&,bool)),this,SLOT (newText(QWidget*,const QString&,bool)) ); if(listen) frontServer->queue(QString("PRIVMSG %1 :\x01%2 CHAT chat %3 %4\x01").arg(nick).arg("DCC").arg(numericalIp).arg(dccChatPanel->getPort())); } @@ -452,7 +452,7 @@ StatusPanel* KonversationMainWindow::addStatusView(Server* server) // ... then put it into the tab widget, otherwise we'd have a race with server member addView(statusView,2,server->getServerName(),false); - connect(statusView,SIGNAL (newText(QWidget*,const QString&)),this,SLOT (newText(QWidget*,const QString&)) ); + connect(statusView,SIGNAL (newText(QWidget*,const QString&,bool)),this,SLOT (newText(QWidget*,const QString&,bool)) ); connect(statusView,SIGNAL (sendFile()),server,SLOT (requestDccSend()) ); connect(server,SIGNAL (awayState(bool)),statusView,SLOT (indicateAway(bool)) ); @@ -471,7 +471,7 @@ Channel* KonversationMainWindow::addChannel(Server* server, const QString& name) addView(channel,1,name); - connect(channel,SIGNAL (newText(QWidget*,const QString&)),this,SLOT (newText(QWidget*,const QString&)) ); + connect(channel,SIGNAL (newText(QWidget*,const QString&,bool)),this,SLOT (newText(QWidget*,const QString&,bool)) ); connect(channel,SIGNAL (prefsChanged()),this,SLOT (channelPrefsChanged()) ); connect(server,SIGNAL (awayState(bool)),channel,SLOT (indicateAway(bool)) ); @@ -486,7 +486,7 @@ Query* KonversationMainWindow::addQuery(Server* server, const QString& name) addView(query,0,name); - connect(query,SIGNAL (newText(QWidget*,const QString&)),this,SLOT (newText(QWidget*,const QString&)) ); + connect(query,SIGNAL (newText(QWidget*,const QString&,bool)),this,SLOT (newText(QWidget*,const QString&,bool)) ); connect(server,SIGNAL (awayState(bool)),query,SLOT (indicateAway(bool)) ); return query; @@ -514,11 +514,11 @@ ChannelListPanel* KonversationMainWindow::addChannelListPanel(Server* server) return channelListPanel; } -void KonversationMainWindow::newText(QWidget* view,const QString& highlightColor) +void KonversationMainWindow::newText(QWidget* view,const QString& highlightColor,bool important) { if(view!=getViewContainer()->currentPage()) { - getViewContainer()->changeTabState(view,true,highlightColor); + getViewContainer()->changeTabState(view,true,important,highlightColor); emit startNotification(view); } else if(!isActiveWindow() && static_cast(view)->getServer()->connected()) @@ -553,7 +553,7 @@ void KonversationMainWindow::changeView(QWidget* viewToChange) updateFrontView(); - viewContainer->changeTabState(view,false,QString::null); + viewContainer->changeTabState(view,false,false,QString::null); emit endNotification(viewToChange); } diff --git a/konversation/konversationmainwindow.h b/konversation/konversationmainwindow.h index 56fc7f2..8bea4e6 100644 --- a/konversation/konversationmainwindow.h +++ b/konversation/konversationmainwindow.h @@ -115,7 +115,7 @@ class KonversationMainWindow : public KMainWindow void closeKonsolePanel(ChatWindow* konsolePanel); - void newText(QWidget* view,const QString& highlightColor); + void newText(QWidget* view,const QString& highlightColor,bool important); void quitProgram(); void notifyAction(const QString& serverName,const QString& nick); diff --git a/konversation/ledtab.cpp b/konversation/ledtab.cpp index bd5f88e..4a018ab 100644 --- a/konversation/ledtab.cpp +++ b/konversation/ledtab.cpp @@ -17,7 +17,7 @@ #include "konversationapplication.h" #include "ledtab.h" -LedTab::LedTab(QWidget* newWidget,const QString& label,int newColor,bool state) : +LedTab::LedTab(QWidget* newWidget,const QString& label,int newColor,bool on) : QTab(label) { // First of all set up the icons @@ -31,7 +31,7 @@ LedTab::LedTab(QWidget* newWidget,const QString& label,int newColor,bool state) widget=newWidget; labelColor=QString::null; - setOn(state); + setOn(on); connect(&blinkTimer,SIGNAL(timeout()),this,SLOT(blinkTimeout())); @@ -44,7 +44,7 @@ LedTab::~LedTab() void LedTab::blinkTimeout() { - if(on) + if(state!=Off) { // if the user wants us to blink, toggle LED blink status if(KonversationApplication::preferences.getBlinkingTabs()) @@ -67,10 +67,19 @@ void LedTab::blinkTimeout() } } -void LedTab::setOn(bool state) +void LedTab::setOn(bool on,bool important) { - on=state; - setIconSet((on) ? iconOn : iconOff); + if (on) { + if (important) + blinkTimer.changeInterval(500); + else if (state!=Fast) + blinkTimer.changeInterval(1000); + state = important ? Fast : Slow; + } + else + state=Off; + + setIconSet((state!=Off) ? iconOn : iconOff); } void LedTab::setLabelColor(const QString& newLabelColor) diff --git a/konversation/ledtab.h b/konversation/ledtab.h index 0e40fd7..b670f6d 100644 --- a/konversation/ledtab.h +++ b/konversation/ledtab.h @@ -31,10 +31,10 @@ class LedTab : public QObject,public QTab Q_OBJECT public: - LedTab(QWidget* newWidget,const QString& text,int newColor,bool state); + LedTab(QWidget* newWidget,const QString& text,int newColor,bool on); ~LedTab(); - - void setOn(bool state); + + void setOn(bool on, bool important=true); void setLabelColor(const QString& newLabelColor); const QString& getLabelColor(); @@ -52,10 +52,17 @@ class LedTab : public QObject,public QTab void blinkTimeout(); protected: + enum StateType + { + Off=0, + Slow, + Fast + }; + void setIconSet(const QIconSet& icon); int color; // color of the LED - bool on; // true, if LED should indicate "on" status + StateType state;// if and how fast the LED should blink bool blinkOn; // true, if blinking LED is on at this moment QWidget* widget; diff --git a/konversation/ledtabwidget.cpp b/konversation/ledtabwidget.cpp index 30113b9..f0cc694 100644 --- a/konversation/ledtabwidget.cpp +++ b/konversation/ledtabwidget.cpp @@ -58,7 +58,7 @@ void LedTabWidget::addTab(ChatWindow* child,const QString& label,int color,bool this,SLOT (changeName(ChatWindow*,const QString&)) ); } -void LedTabWidget::changeTabState(QWidget* child,bool state,const QString& labelColor) +void LedTabWidget::changeTabState(QWidget* child,bool state,bool important,const QString& labelColor) { LedTabBar* bar=tabBar(); if(bar==0) kdWarning() << "LedTabWidget::changeTabState(): bar==0!" << endl; @@ -68,7 +68,7 @@ void LedTabWidget::changeTabState(QWidget* child,bool state,const QString& label if(tab==0) kdWarning() << "LedTabWidget::changeTabState(): tab==0!" << endl; else { - tab->setOn(state); + tab->setOn(state,important); if(!labelColor.isEmpty() || !state) tab->setLabelColor(labelColor); } diff --git a/konversation/ledtabwidget.h b/konversation/ledtabwidget.h index be5619b..fc6467c 100644 --- a/konversation/ledtabwidget.h +++ b/konversation/ledtabwidget.h @@ -35,7 +35,7 @@ class LedTabWidget : public QTabWidget ~LedTabWidget(); void addTab(ChatWindow* child,const QString& label,int color,bool on,int index=-1); - void changeTabState(QWidget* child,bool state,const QString& labelColor); + void changeTabState(QWidget* child,bool state,bool important,const QString& labelColor); void updateTabs(); signals: diff --git a/konversation/query.cpp b/konversation/query.cpp index 8a483d5..3446792 100644 --- a/konversation/query.cpp +++ b/konversation/query.cpp @@ -65,7 +65,7 @@ Query::Query(QWidget* parent) : ChatWindow(parent) connect(queryInput,SIGNAL (pageUp()),getTextView(),SLOT (pageUp()) ); connect(queryInput,SIGNAL (pageDown()),getTextView(),SLOT (pageDown()) ); - connect(textView,SIGNAL (newText(const QString&)),this,SLOT (newTextInView(const QString&)) ); + connect(textView,SIGNAL (newText(const QString&,bool)),this,SLOT (newTextInView(const QString&,bool)) ); connect(textView,SIGNAL (gotFocus()),this,SLOT (adjustFocus()) ); connect(textView,SIGNAL (sendFile()),this,SLOT (sendFileMenu()) ); connect(textView,SIGNAL (extendedPopup(int)),this,SLOT (popup(int)) ); @@ -124,9 +124,9 @@ void Query::sendQueryText(const QString& sendLine) server->queue(filter.getServerOutput()); } -void Query::newTextInView(const QString& highlightColor) +void Query::newTextInView(const QString& highlightColor,bool important) { - emit newText(this,highlightColor); + emit newText(this,highlightColor,important); } void Query::setHostmask(const QString& newHostmask) diff --git a/konversation/query.h b/konversation/query.h index 4924e80..6dd5d08 100644 --- a/konversation/query.h +++ b/konversation/query.h @@ -49,7 +49,7 @@ class Query : public ChatWindow virtual bool searchView(); signals: - void newText(QWidget* query,const QString& highlightColor); + void newText(QWidget* query,const QString& highlightColor,bool important); void sendFile(const QString& recipient); public slots: @@ -61,7 +61,7 @@ class Query : public ChatWindow protected slots: void queryTextEntered(); void sendFileMenu(); - void newTextInView(const QString& highlightColor); + void newTextInView(const QString& highlightColor,bool important); // connected to IRCInput::textPasted() - used to handle large/multiline pastes void textPasted(QString text); void popup(int id); diff --git a/konversation/statuspanel.cpp b/konversation/statuspanel.cpp index 4984348..e068375 100644 --- a/konversation/statuspanel.cpp +++ b/konversation/statuspanel.cpp @@ -50,7 +50,7 @@ StatusPanel::StatusPanel(QWidget* parent) : connect(getTextView(),SIGNAL (gotFocus()),statusInput,SLOT (setFocus()) ); - connect(getTextView(),SIGNAL (newText(const QString&)),this,SLOT (newTextInView(const QString&)) ); + connect(getTextView(),SIGNAL (newText(const QString&,bool)),this,SLOT (newTextInView(const QString&,bool)) ); connect(getTextView(),SIGNAL (sendFile()),this,SLOT (sendFileMenu()) ); connect(statusInput,SIGNAL (pageUp()),getTextView(),SLOT (pageUp()) ); @@ -104,9 +104,9 @@ void StatusPanel::statusTextEntered() statusInput->clear(); } -void StatusPanel::newTextInView(const QString& highlightColor) +void StatusPanel::newTextInView(const QString& highlightColor,bool important) { - emit newText(this,highlightColor); + emit newText(this,highlightColor,important); } void StatusPanel::textPasted(QString text) diff --git a/konversation/statuspanel.h b/konversation/statuspanel.h index 7939885..9d0bd21 100644 --- a/konversation/statuspanel.h +++ b/konversation/statuspanel.h @@ -41,13 +41,13 @@ class StatusPanel : public ChatWindow virtual bool searchView(); signals: - void newText(QWidget* widget,const QString& highlightColor); + void newText(QWidget* widget,const QString& highlightColor,bool important); void sendFile(); public slots: void adjustFocus(); void setNickname(const QString& newNickname); - void newTextInView(const QString& highlightColor); + void newTextInView(const QString& highlightColor,bool important); void updateFonts(); virtual void indicateAway(bool show);