summaryrefslogtreecommitdiff
path: root/core
Side-by-side diff
Diffstat (limited to 'core') (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/launcherview.cpp2
-rw-r--r--core/launcher/server.cpp26
-rw-r--r--core/launcher/serverapp.cpp4
3 files changed, 6 insertions, 26 deletions
diff --git a/core/launcher/launcherview.cpp b/core/launcher/launcherview.cpp
index 0d0f2cb..cd9c14b 100644
--- a/core/launcher/launcherview.cpp
+++ b/core/launcher/launcherview.cpp
@@ -400,96 +400,98 @@ void LauncherItem::paintItem( QPainter *p, const QColorGroup &cg )
LauncherIconView* liv = (LauncherIconView*)iconView();
QBrush oldBrush( liv->itemTextBackground() );
QColorGroup mycg( cg );
if ( liv->currentItem() == this ) {
liv->setItemTextBackground( cg.brush( QColorGroup::Highlight ) );
mycg.setColor( QColorGroup::Text, cg.color( QColorGroup::HighlightedText ) );
}
QIconViewItem::paintItem(p,mycg);
// Paint animation overlay
if ( liv->busyItem() == this )
paintAnimatedIcon(p);
if ( liv->currentItem() == this )
liv->setItemTextBackground( oldBrush );
}
void LauncherItem::paintAnimatedIcon( QPainter *p )
{
LauncherIconView* liv = (LauncherIconView*)iconView();
int pic = iteration % 16;
int w = pixmap()->width(), h = pixmap()->height();
QPixmap dblBuf( w, h + 4 );
QPainter p2( &dblBuf );
int x1, y1;
if ( liv->itemTextPos() == QIconView::Bottom ) {
x1 = x() + (width() - w) / 2 - liv->contentsX();
y1 = y() - liv->contentsY();
} else {
x1 = x() - liv->contentsX();
y1 = y() + (height() - h) / 2 - liv->contentsY();
}
y1 -= 2;
p2.translate(-x1,-y1);
liv->drawBackground( &p2, QRect(x1,y1,w,h+4) );
int bounceY = 2;
#ifdef BOUNCE_BUSY_ICON
if ( busyType == BIT_Animated ) {
bounceY = 4 - ((iteration+2)%8);
bounceY = bounceY < 0 ? -bounceY : bounceY;
}
#endif
p2.drawPixmap( x1, y1 + bounceY, *pixmap() );
#ifdef USE_ANIMATED_BUSY_ICON_OVERLAY
p2.drawPixmap( x1, y1 + bounceY, liv->busyPixmap(), w * pic, 0, w, h );
+#else
+ Q_UNUSED( pic )
#endif
p->drawPixmap( x1, y1, dblBuf );
}
void LauncherItem::animateIcon()
{
LauncherIconView* liv = (LauncherIconView*)iconView();
if ( liv->busyItem() != this || !app )
return;
// Highlight the icon
if ( iteration == 0 ) {
QPixmap src = isBigIcon ? app->bigPixmap() : app->pixmap();
QImage img = src.convertToImage();
QRgb *rgb;
int count;
if ( img.depth() == 32 ) {
rgb = (QRgb*)img.bits();
count = img.bytesPerLine()/sizeof(QRgb)*img.height();
} else {
rgb = img.colorTable();
count = img.numColors();
}
for ( int r = 0; r < count; r++, rgb++ ) {
#if defined(BRIGHTEN_BUSY_ICON)
QColor c(*rgb);
int h, s, v;
c.hsv(&h,&s,&v);
c.setHsv(h,QMAX(s-24,0),QMIN(v+48,255));
*rgb = qRgba(c.red(),c.green(),c.blue(),qAlpha(*rgb));
#elif defined(ALPHA_FADE_BUSY_ICON)
*rgb = qRgba(qRed(*rgb),qGreen(*rgb),qBlue(*rgb),qAlpha(*rgb)/2);
#endif
}
src.convertFromImage( img );
setPixmap( src );
}
iteration++;
// Paint animation overlay
QPainter p( liv->viewport() );
paintAnimatedIcon( &p );
}
void LauncherItem::resetIcon()
{
diff --git a/core/launcher/server.cpp b/core/launcher/server.cpp
index 950032d..5ae517b 100644
--- a/core/launcher/server.cpp
+++ b/core/launcher/server.cpp
@@ -151,120 +151,96 @@ Server::Server() :
connect(appLauncher, SIGNAL(terminated(int,const QString&)), this, SLOT(applicationTerminated(int,const QString&)) );
connect(appLauncher, SIGNAL(connected(const QString&)), this, SLOT(applicationConnected(const QString&)) );
storage = new StorageInfo( this );
connect( storage, SIGNAL(disksChanged()), this, SLOT(storageChanged()) );
// start services
startTransferServer();
(void) new IrServer( this );
packageHandler = new PackageHandler( this );
connect(qApp, SIGNAL(activate(const Opie::Core::ODeviceButton*,bool)),
this,SLOT(activate(const Opie::Core::ODeviceButton*,bool)));
setGeometry( -10, -10, 9, 9 );
QCopChannel *channel = new QCopChannel("QPE/System", this);
connect(channel, SIGNAL(received(const QCString&,const QByteArray&)),
this, SLOT(systemMsg(const QCString&,const QByteArray&)) );
QCopChannel *tbChannel = new QCopChannel( "QPE/TaskBar", this );
connect( tbChannel, SIGNAL(received(const QCString&,const QByteArray&)),
this, SLOT(receiveTaskBar(const QCString&,const QByteArray&)) );
connect( qApp, SIGNAL(prepareForRestart()), this, SLOT(terminateServers()) );
connect( qApp, SIGNAL(timeChanged()), this, SLOT(pokeTimeMonitors()) );
preloadApps();
}
void Server::show()
{
ServerApplication::login(TRUE);
QWidget::show();
}
Server::~Server()
{
serverGui->destroyGUI();
delete docList;
delete qcopBridge;
delete transferServer;
delete serverGui;
#if 0
delete tsmMonitor;
#endif
}
-static bool hasVisibleWindow(const QString& clientname, bool partial)
-{
-#ifdef QWS
- const QList<QWSWindow> &list = qwsServer->clientWindows();
- QWSWindow* w;
- for (QListIterator<QWSWindow> it(list); (w=it.current()); ++it) {
- if ( w->client()->identity() == clientname ) {
- if ( partial && !w->isFullyObscured() )
- return TRUE;
- if ( !partial && !w->isFullyObscured() && !w->isPartiallyObscured() ) {
-# if QT_VERSION < 0x030000
- QRect mwr = qt_screen->mapToDevice(qt_maxWindowRect,
- QSize(qt_screen->width(),qt_screen->height()) );
-# else
- QRect mwr = qt_maxWindowRect;
-# endif
- if ( mwr.contains(w->requested().boundingRect()) )
- return TRUE;
- }
- }
- }
-#endif
- return FALSE;
-}
void Server::activate(const ODeviceButton* button, bool held)
{
Global::terminateBuiltin("calibrate"); // No tr
OQCopMessage om;
if ( held ) {
om = button->heldAction();
} else {
om = button->pressedAction();
}
if ( om.channel() != "ignore" )
om.send();
// A button with no action defined, will return a null ServiceRequest. Don't attempt
// to send/do anything with this as it will crash
/* ### FIXME */
#if 0
if ( !sr.isNull() ) {
QString app = sr.app();
bool vis = hasVisibleWindow(app, app != "qpe");
if ( sr.message() == "raise()" && vis ) {
sr.setMessage("nextView()");
} else {
// "back door"
sr << (int)vis;
}
sr.send();
}
#endif
}
#ifdef Q_WS_QWS
typedef struct KeyOverride {
ushort scan_code;
QWSServer::KeyMap map;
};
static const KeyOverride jp109keys[] = {
{ 0x03, { Qt::Key_2, '2' , 0x22 , 0xffff } },
{ 0x07, { Qt::Key_6, '6' , '&' , 0xffff } },
{ 0x08, { Qt::Key_7, '7' , '\'' , 0xffff } },
{ 0x09, { Qt::Key_8, '8' , '(' , 0xffff } },
@@ -653,77 +629,79 @@ void Server::timerEvent( QTimerEvent *e )
#define QPE_DEFAULT_TODAY_MODE "Never"
#endif
if ( cfg.readEntry("Mode",QPE_DEFAULT_TODAY_MODE) == "Daily" ) {
QCopEnvelope env(Service::channel("today"),"raise()");
}
}
}
#endif
}
void Server::terminateServers()
{
delete transferServer;
delete qcopBridge;
transferServer = 0;
qcopBridge = 0;
}
void Server::syncConnectionClosed( const QHostAddress & )
{
odebug << "Lost sync connection" << oendl;
delete syncDialog;
syncDialog = 0;
}
void Server::pokeTimeMonitors()
{
#if 0
// inform all TimeMonitors
QStrList tms = Service::channels("TimeMonitor");
for (const char* ch = tms.first(); ch; ch=tms.next()) {
QString t = getenv("TZ");
QCopEnvelope e(ch, "timeChange(QString)");
e << t;
}
#endif
}
void Server::applicationLaunched(int, const QString &app)
{
serverGui->applicationStateChanged( app, ServerInterface::Launching );
}
void Server::applicationTerminated(int pid, const QString &app)
{
serverGui->applicationStateChanged( app, ServerInterface::Terminated );
#if 0
tsmMonitor->applicationTerminated( pid );
+#else
+ Q_UNUSED( pid )
#endif
}
void Server::applicationConnected(const QString &app)
{
serverGui->applicationStateChanged( app, ServerInterface::Running );
}
void Server::storageChanged()
{
system( "opie-update-symlinks" );
serverGui->storageChanged( storage->fileSystems() );
docList->storageChanged();
}
void Server::preloadApps()
{
Config cfg("Launcher");
cfg.setGroup("Preload");
QStringList apps = cfg.readListEntry("Apps",',');
for (QStringList::ConstIterator it=apps.begin(); it!=apps.end(); ++it) {
#ifndef QT_NO_COP
QCopEnvelope e("QPE/Application/"+(*it).local8Bit(), "enablePreload()");
#endif
}
}
diff --git a/core/launcher/serverapp.cpp b/core/launcher/serverapp.cpp
index a2302d8..66cc788 100644
--- a/core/launcher/serverapp.cpp
+++ b/core/launcher/serverapp.cpp
@@ -312,98 +312,98 @@ ServerApplication::ServerApplication( int& argc, char **argv, Type t )
QCopChannel *channel = new QCopChannel( "QPE/System", this );
connect(channel, SIGNAL(received(const QCString&,const QByteArray&) ),
this, SLOT(systemMessage(const QCString&,const QByteArray&) ) );
channel = new QCopChannel("QPE/Launcher", this );
connect(channel, SIGNAL(received(const QCString&,const QByteArray&) ),
this, SLOT(launcherMessage(const QCString&,const QByteArray&) ) );
m_screensaver = new OpieScreenSaver();
m_screensaver->setInterval( -1 );
QWSServer::setScreenSaver( m_screensaver );
connect( qApp, SIGNAL( volumeChanged(bool) ),
this, SLOT( rereadVolumes() ) );
/* ### PluginLoader libqtopia SafeMode */
#if 0
if ( PluginLoader::inSafeMode() )
QTimer::singleShot(500, this, SLOT(showSafeMode()) );
QTimer::singleShot(20*1000, this, SLOT(clearSafeMode()) );
#endif
kf = new KeyFilter(this);
connect( kf, SIGNAL(launch()), this, SIGNAL(launch()) );
connect( kf, SIGNAL(power()), this, SIGNAL(power()) );
connect( kf, SIGNAL(backlight()), this, SIGNAL(backlight()) );
connect( kf, SIGNAL(symbol()), this, SIGNAL(symbol()));
connect( kf, SIGNAL(numLockStateToggle()), this,SIGNAL(numLockStateToggle()));
connect( kf, SIGNAL(capsLockStateToggle()), this,SIGNAL(capsLockStateToggle()));
connect( kf, SIGNAL(activate(const Opie::Core::ODeviceButton*,bool)),
this,SIGNAL(activate(const Opie::Core::ODeviceButton*,bool)));
connect( kf, SIGNAL(backlight()), this, SLOT(toggleLight()) );
connect( this, SIGNAL(power() ),
SLOT(togglePower() ) );
rereadVolumes();
serverApp = this;
apmTimeout();
grabKeyboard();
- /* make sure the event filter is installed */
- const ODeviceButton* but = ODevice::inst()->buttonForKeycode( -1 );
+ /* make sure the event filter is installed */ /* std::limits<short>::max() when you've stdc++ */
+ const ODeviceButton* but = ODevice::inst()->buttonForKeycode( SHRT_MAX );
Q_CONST_UNUSED( but )
}
ServerApplication::~ServerApplication()
{
ungrabKeyboard();
delete pa;
delete m_ps;
delete m_ps_last;
}
void ServerApplication::apmTimeout()
{
serverApp-> checkMemory( ); // in case no events are generated
*m_ps_last = *m_ps;
*m_ps = PowerStatusManager::readStatus();
if ( m_ps->acStatus() != m_ps_last-> acStatus() )
m_screensaver-> powerStatusChanged( *m_ps );
if ( m_ps->acStatus() == PowerStatus::Online ) {
return;
}
int bat = m_ps-> batteryPercentRemaining();
if ( bat < m_ps_last-> batteryPercentRemaining() ) {
if ( bat <= m_powerCritical ) {
QMessageBox battlow(
tr("WARNING"),
tr("<p>The battery level is critical!"
"<p>Keep power off until AC is restored"),
QMessageBox::Warning,
QMessageBox::Cancel, QMessageBox::NoButton, QMessageBox::NoButton,
0, QString::null, TRUE, WStyle_StaysOnTop);
battlow.setButtonText(QMessageBox::Cancel, tr("Ok"));
battlow.exec();
} else if ( bat <= m_powerVeryLow )
pa->alert( tr( "The battery is running very low. "), 2 );
}
if ( m_ps-> backupBatteryStatus() == PowerStatus::VeryLow ) {
QMessageBox battlow(
tr("WARNING"),
tr("<p>The Back-up battery is very low"
"<p>Please charge the back-up battery"),