Ksetiwatch API Documentation


DockWidget Class Reference

The dock widget for the system tray. More...

#include <dockwidget.h>

Inherits KSystemTray.

Inheritance diagram for DockWidget:

Inheritance graph
[legend]
Collaboration diagram for DockWidget:

Collaboration graph
[legend]
List of all members.

Public Slots

void dock (SetiLoc *loc=0)
void undock ()
void updateDockWidget (SetiLoc *loc)

Public Methods

 DockWidget (QWidget *parent=0, const char *name=0)
 ~DockWidget ()
const bool isDocked ()

Protected Methods

void paintEvent (QPaintEvent *e)
void timerEvent (QTimerEvent *e)

Private Types

enum  popupIDs

Private Slots

void handlePopupCommand (int id)
void preparePopupMenu ()
void paintIcon (int st, int ls)
void slotBlinkIcon ()
void updateProgress ()
void updateState (int st, int ls)

Detailed Description

The dock widget for the system tray.

If `Minimize to Panel' is enabled, this widget will be shown in the system tray area of the Kicker panel. It either displays the standard Ksetiwatch icon, or, if a location is selected in the Analysis tab, an icon showing the progress and state of said location. In the latter case, the client can be started or stopped via the right-click context menu.

Definition at line 32 of file dockwidget.h.


Member Enumeration Documentation

enum DockWidget::popupIDs [private]
 

Identifiers for the menu items in the right-click popup menu.

Definition at line 139 of file dockwidget.h.


Constructor & Destructor Documentation

DockWidget::DockWidget QWidget   parent = 0,
const char *    name = 0
 

The constructor.

Parameters:
parent  The parent widget. If 0, this widget becomes a top-level widget.
name  A text that can be used to identify this widget.

Definition at line 28 of file dockwidget.cpp.

References QToolTip::add(), KPopupMenu::changeTitle(), QObject::connect(), KSystemTray::contextMenu(), handlePopupCommand(), preparePopupMenu(), and QObject::startTimer().

DockWidget::~DockWidget  
 

The destructor.

Definition at line 53 of file dockwidget.cpp.


Member Function Documentation

const bool DockWidget::isDocked   [inline]
 

Returns the status of the dock widget.

TRUE if it is docked (and visible), otherwise FALSE.

Definition at line 47 of file dockwidget.h.

void DockWidget::dock SetiLoc   loc = 0 [slot]
 

Shows the dock widget.

Parameters:
loc  The S@h location for which progress information is shown. If 0, the generic Ksetiwatch icon is displayed.

Definition at line 64 of file dockwidget.cpp.

References QWidget::show().

Referenced by Ksetiwatch::event(), Ksetiwatch::Ksetiwatch(), and Ksetiwatch::toggleIcon().

void DockWidget::undock   [slot]
 

Hides the dock widget.

Definition at line 76 of file dockwidget.cpp.

References QWidget::hide().

Referenced by Ksetiwatch::toggleIcon().

void DockWidget::updateDockWidget SetiLoc   loc [slot]
 

Connects the dock widget to another location.

Parameters:
loc  The SetiLoc object of the new S@h location. If 0, any previous connections to the old location are removed.

Definition at line 308 of file dockwidget.cpp.

References QObject::connect(), QObject::disconnect(), updateProgress(), and updateState().

void DockWidget::paintEvent QPaintEvent   e [protected]
 

Reimplemented for customized painting of the dock widget.

Parameters:
e  Contains event parameters of the paint event.

Reimplemented from QFrame.

Definition at line 86 of file dockwidget.cpp.

References paintIcon().

void DockWidget::timerEvent QTimerEvent   e [protected]
 

Reimplemented to catch internal timer events.

The internal timer generates an event every second in order to have a blinking icon in case the state of the location is Stopped, Loading, or Finished.

Parameters:
e  Contains event parameter of the timer event.

Reimplemented from QObject.

Definition at line 58 of file dockwidget.cpp.

References slotBlinkIcon().

void DockWidget::handlePopupCommand int    id [private, slot]
 

Executes the selected command from the right-click popup menu of the dock widget.

Parameters:
id  The unique ID number of the selected popup menu item. See DockWidget::popupIDs for details.

Definition at line 265 of file dockwidget.cpp.

References SetiLoc::startClient(), and SetiLoc::stopClient().

Referenced by DockWidget().

void DockWidget::preparePopupMenu   [private, slot]
 

Prepares the right-click popup menu just before showing it.

Checks if the popup menu commands are allowed or make sense in the current situation, and enables or disables the menu items appropriately.

Definition at line 279 of file dockwidget.cpp.

References SetiContainer::clientState(), KSystemTray::contextMenu(), and SetiContainer::isClientRunning().

Referenced by DockWidget().

void DockWidget::paintIcon int    st,
int    ls
[private, slot]
 

Paints the dock widget.

If the dock widget is connected to a S@h location, progress and state of said location is shown, otherwise the default Ksetiwatch icon is displayed.

Definition at line 156 of file dockwidget.cpp.

References QPaintDevice::bitBlt(), SetiContainer::clientState(), QPainter::drawText(), QWidget::erase(), QPainter::fillRect(), QSize::height(), QWidget::icon(), QPainter::lineTo(), QPainter::moveTo(), SetiContainer::progress(), QPainter::setFont(), QPainter::setPen(), QPixmap::size(), QString::sprintf(), QSize::width(), QWidget::x(), and QWidget::y().

Referenced by paintEvent(), slotBlinkIcon(), and updateState().

void DockWidget::slotBlinkIcon   [private, slot]
 

Performs blinking of the state icon.

This slot is called whenever an internal timer event occurs. It causes the state icon in the dock widget to periodically toggle between two pixmaps so as to provide a visual feedback. Blinking occurs only if the state of the location is Stopped, Loading, or Finished.

Definition at line 334 of file dockwidget.cpp.

References SetiContainer::clientState(), and paintIcon().

Referenced by timerEvent().

void DockWidget::updateProgress   [private, slot]
 

Updates the progress information in the dock widget.

The progress is shown as a mini progress bar.

Definition at line 92 of file dockwidget.cpp.

References SetiContainer::clientState(), and updateState().

Referenced by updateDockWidget().

void DockWidget::updateState int    st,
int    ls
[private, slot]
 

Updates the state information in the dock widget.

A running client is represented by a small green telescope dish, all other states are displayed as blinking icons.

Parameters:
st  The state of the client. If 0, the state is queried directly from the corresponding SetiLoc object.
ls  Not used in this context.

Definition at line 102 of file dockwidget.cpp.

References QToolTip::add(), QString::arg(), SetiContainer::clientState(), SetiLoc::description(), QString::isEmpty(), paintIcon(), SetiContainer::progress(), SetiContainer::remainingTimeAsString(), and QToolTip::remove().

Referenced by updateDockWidget(), and updateProgress().


The documentation for this class was generated from the following files:
KDE Logo
This file is part of the documentation for Ksetiwatch API Version 2.6.1.
Documentation copyright © 2000-2003 Gordon Machel.
Generated on Fri Jun 6 00:28:43 2003 by doxygen 1.2.18, written by Dimitri van Heesch, © 1997-2002