[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: playground/base/plasma/applets/presence
From: George Goldberg <grundleborg () googlemail ! com>
Date: 2008-07-11 8:56:54
Message-ID: 1215766614.148542.7125.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 830797 by gberg:
Add a label for the master presence status to be displayed.
M +30 -8 presence.cpp
M +4 -0 presence.h
--- trunk/playground/base/plasma/applets/presence/presence.cpp #830796:830797
@@ -46,7 +46,9 @@
m_engine(0),
m_colorScheme(0),
m_messageEdit(0),
+ m_masterStatusLayout(0),
m_masterIconLabel(0),
+ m_masterStatusMessageLabel(0),
m_accountsModel(0),
m_accountsView(0),
m_layout(0),
@@ -115,9 +117,19 @@
m_accountsView->header()->setVisible(true);
m_accountsView->setColumnHidden(0, true); //Hide the source id column
- // Make sure we have a masterIconPixmap.
+ // Set up the master status section.
+ Q_ASSERT(!m_masterStatusLayout); // Pointer should still be assigned to 0.
Q_ASSERT(!m_masterIconLabel); // Pointer should still be assigned to 0.
+ Q_ASSERT(!m_masterStatusMessageLabel); // Pointer should still be assigned to 0.
+
+ m_masterStatusLayout = new QHBoxLayout(m_widget);
+
m_masterIconLabel = new QLabel;
+ m_masterStatusMessageLabel = new QLabel;
+
+ m_masterStatusLayout->addWidget(m_masterIconLabel);
+ m_masterStatusLayout->addWidget(m_masterStatusMessageLabel);
+
iconChanged();
// Set up the rest of the view/layout etc. stuff.
@@ -128,15 +140,16 @@
Q_ASSERT(!m_layout); // Pointer should still be assigned to 0.
m_widget = new QWidget();
m_layout = new QVBoxLayout(m_widget);
- m_layout->addWidget(m_masterIconLabel);
+ m_layout->addLayout(m_masterStatusLayout);
m_layout->addWidget(m_accountsView);
m_layout->addWidget(m_messageEdit);
m_widget->setLayout(m_layout);
// Apply the theme's color scheme to the widget.
+ Q_ASSERT(m_colorScheme);
QPalette editPalette = m_widget->palette();
- editPalette.setColor(QPalette::Window,
- m_colorScheme->background().color());
+ editPalette.setBrush(QPalette::Window,
+ m_colorScheme->background());
m_widget->setPalette(editPalette);
}
@@ -280,11 +293,11 @@
if(statusMessagesAllTheSame)
{
- // TODO: Set the master presence status message.
+ masterStatusMessageChanged(previousStatusMessage);
}
else
{
- // TODO: Set the master presence status message to be QString();
+ masterStatusMessageChanged(QString());
}
// Next, we work out the overall presence status.
@@ -294,7 +307,7 @@
int accountsExtendedAway = 0;
int accountsHidden = 0;
int accountsBusy = 0;
-
+
bool okOffline = true;
bool okAvailable = true;
bool okAway = true;
@@ -393,10 +406,19 @@
// display in the main widget.
if(m_masterIconLabel)
{
- m_masterIconLabel->setPixmap(m_icon->icon().pixmap(QSize(22, 22)));
+ m_masterIconLabel->setPixmap(m_icon->icon().pixmap(QSize(32, 32)));
}
}
+void
+PresenceApplet::masterStatusMessageChanged(const QString & message)
+{
+ // If m_masterStatusMessageLabel points to a valid QLabel, update it.
+ if(m_masterStatusMessageLabel)
+ {
+ m_masterStatusMessageLabel->setText(message);
+ }
+}
#include "presence.moc"
--- trunk/playground/base/plasma/applets/presence/presence.h #830796:830797
@@ -27,6 +27,7 @@
class KColorScheme;
class KLineEdit;
+class QHBoxLayout;
class QLabel;
class QStandardItemModel;
class QString;
@@ -55,6 +56,7 @@
private:
void iconChanged();
+ void masterStatusMessageChanged(const QString & message);
void updateMasterPresence();
Plasma::DataEngine * m_engine;
@@ -62,7 +64,9 @@
KColorScheme * m_colorScheme;
KLineEdit * m_messageEdit;
+ QHBoxLayout * m_masterStatusLayout;
QLabel * m_masterIconLabel;
+ QLabel * m_masterStatusMessageLabel;
QStandardItemModel * m_accountsModel;
QTreeView * m_accountsView;
QVBoxLayout * m_layout;
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic