Hello community, here is the log from the commit of package icecream-monitor checked in at Mon Aug 6 21:45:17 CEST 2007. -------- --- icecream-monitor/icecream-monitor.changes 2007-07-23 21:35:54.000000000 +0200 +++ /mounts/work_src_done/STABLE/icecream-monitor/icecream-monitor.changes 2007-08-06 17:27:13.000000000 +0200 @@ -1,0 +2,5 @@ +Mon Aug 6 17:27:04 CEST 2007 - dmueller@suse.de + +- update to current SVN to make it actually build + +------------------------------------------------------------------- Old: ---- icemon.diff ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ icecream-monitor.spec ++++++ --- /var/tmp/diff_new_pack.E32499/_old 2007-08-06 21:44:50.000000000 +0200 +++ /var/tmp/diff_new_pack.E32499/_new 2007-08-06 21:44:50.000000000 +0200 @@ -16,9 +16,8 @@ Group: Development/Tools/Building Summary: Monitor Program for the icecream Compile Farm Version: 1.0 -Release: 88 +Release: 92 Source0: icemon.tar.bz2 -Patch0: icemon.diff BuildRoot: %{_tmppath}/%{name}-%{version}-build %description @@ -37,7 +36,6 @@ %prep %setup -q -n %name -%patch0 -p1 %build %cmake_kde4 -d build @@ -63,6 +61,8 @@ /usr/share/kde4/apps/icemon %changelog +* Mon Aug 06 2007 - dmueller@suse.de +- update to current SVN to make it actually build * Mon Jul 23 2007 - coolo@suse.de - fix build * Mon Jul 16 2007 - coolo@suse.de ++++++ icemon.tar.bz2 ++++++ diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/icecream-monitor/icemon/src/CMakeLists.txt new/icecream-monitor/icemon/src/CMakeLists.txt --- old/icecream-monitor/icemon/src/CMakeLists.txt 2007-07-16 10:59:23.000000000 +0200 +++ new/icecream-monitor/icemon/src/CMakeLists.txt 2007-07-31 15:04:05.000000000 +0200 @@ -7,31 +7,30 @@ set(icemon_SRCS job.cc monitor.cc + mon-kde.cc hostinfo.cc statusview.cc detailedhostview.cc hostlistview.cc joblistview.cc - - mon-kde.cc - listview.cc - ganttstatusview.cc - summaryview.cc - starview.cc - poolview.cc) + listview.cc + ganttstatusview.cc + summaryview.cc + starview.cc + poolview.cc +) qt4_automoc(${icemon_SRCS}) kde4_add_executable(icemon ${icemon_SRCS}) - -target_link_libraries(icemon ${KDE4_KDEUI_LIBS} ${LIBICECREAM_LIBRARIES} ${QT_QT3SUPPORT_LIBRARY}) +target_link_libraries(icemon ${KDE4_KDEUI_LIBRARY} ${LIBICECREAM_LIBRARIES} ${QT_QT3SUPPORT_LIBRARY}) ########### install files ############### install(TARGETS icemon DESTINATION ${BIN_INSTALL_DIR}) -install( FILES icemon.desktop DESTINATION ${XDG_APPS_DIR} ) +install( FILES icemon.desktop DESTINATION ${XDG_APPS_INSTALL_DIR} ) install( FILES icemonui.rc DESTINATION ${DATA_INSTALL_DIR}/icemon ) kde4_install_icons( ${ICON_INSTALL_DIR} ) diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/icecream-monitor/icemon/src/detailedhostview.cc new/icecream-monitor/icemon/src/detailedhostview.cc --- old/icecream-monitor/icemon/src/detailedhostview.cc 2007-07-04 13:56:40.000000000 +0200 +++ new/icecream-monitor/icemon/src/detailedhostview.cc 2007-07-19 13:02:22.000000000 +0200 @@ -58,26 +58,29 @@ QVBoxLayout *dummy = new QVBoxLayout( hosts ); dummy->setSpacing( 10 ); - new QLabel( tr( "Hosts" ), hosts ); + dummy->addWidget(new QLabel( tr( "Hosts" ), hosts )); mHostListView = new HostListView( manager, hosts, "HostListView" ); + dummy->addWidget(mHostListView); QWidget *locals = new QWidget( viewSplitter ); dummy = new QVBoxLayout( locals ); dummy->setSpacing( 10 ); - new QLabel( tr( "Outgoing jobs" ), locals ); + dummy->addWidget(new QLabel( tr( "Outgoing jobs" ), locals )); mLocalJobsView = new JobListView( manager, locals, "LocalJobs" ); mLocalJobsView->setClientColumnVisible( false ); mLocalJobsView->setExpireDuration( 5 ); + dummy->addWidget(mLocalJobsView); QWidget* remotes = new QWidget( viewSplitter ); dummy = new QVBoxLayout( remotes ); dummy->setSpacing( 10 ); - new QLabel( tr( "Incoming jobs" ), remotes ); + dummy->addWidget(new QLabel( tr( "Incoming jobs" ), remotes )); mRemoteJobsView = new JobListView( manager, remotes, "RemoteJobs" ); mRemoteJobsView->setServerColumnVisible( false ); mRemoteJobsView->setExpireDuration( 5 ); + dummy->addWidget(mRemoteJobsView); connect(mHostListView, SIGNAL( nodeActivated( unsigned int ) ), this, SLOT( slotNodeActivated() ) ); diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/icecream-monitor/icemon/src/ganttstatusview.cc new/icecream-monitor/icemon/src/ganttstatusview.cc --- old/icecream-monitor/icemon/src/ganttstatusview.cc 2007-02-23 11:35:35.000000000 +0100 +++ new/icecream-monitor/icemon/src/ganttstatusview.cc 2007-07-31 15:04:05.000000000 +0200 @@ -157,32 +157,32 @@ void GanttProgress::update( const Job &job ) { #if 0 - kDebug() << "GanttProgress::update( job ): " << job.fileName() << endl; + qDebug() << "GanttProgress::update( job ): " << job.fileName() << endl; - kDebug() << " num jobs: " << m_jobs.count() << endl; - kDebug() << " first id: " << m_jobs.first().job.jobId() << endl; - kDebug() << " this id: " << job.jobId() << endl; + qDebug() << " num jobs: " << m_jobs.count() << endl; + qDebug() << " first id: " << m_jobs.first().job.jobId() << endl; + qDebug() << " this id: " << job.jobId() << endl; #endif if ( !m_jobs.isEmpty() && m_jobs.first().job == job ) { -// kDebug() << " Known Job. State: " << job.state() << endl; +// qDebug() << " Known Job. State: " << job.state() << endl; if ( job.state() == Job::Finished || job.state() == Job::Failed ) { Job j = IdleJob(); m_jobs.prepend( JobData( j, mClock ) ); mIsFree = true; } } else { -// kDebug() << " New Job" << endl; +// qDebug() << " New Job" << endl; m_jobs.prepend( JobData( job, mClock ) ); mIsFree = ( job.state() == Job::Idle ); } -// kDebug() << "num jobs: " << m_jobs.count() << " jobs" << endl; +// qDebug() << "num jobs: " << m_jobs.count() << " jobs" << endl; } void GanttProgress::drawGraph( QPainter &p ) { -// kDebug() << "drawGraph() " << m_jobs.count() << " jobs" << endl; +// qDebug() << "drawGraph() " << m_jobs.count() << " jobs" << endl; if( height() == 0 ) return; @@ -201,7 +201,7 @@ if( xWidth == 0 ) continue; -// kDebug() << "XStart: " << xStart << " xWidth: " << xWidth << endl; +// qDebug() << "XStart: " << xStart << " xWidth: " << xWidth << endl; // Draw the rectangle for the current job QColor color = colorForStatus( ( *it ).job ); @@ -330,7 +330,7 @@ if ( job.state() == Job::WaitingForCS ) return; #if 0 - kDebug() << "GanttStatusView::update(): ID: " << job.jobId() << " " + qDebug() << "GanttStatusView::update(): ID: " << job.jobId() << " " << job.fileName() << " Status:" << int( job.state() ) << " Server: " << job.server() << endl; #endif @@ -340,7 +340,7 @@ it = mJobMap.find( job.jobId() ); if ( it != mJobMap.end() ) { -// kDebug() << " Job found" << endl; +// qDebug() << " Job found" << endl; it.value()->update( job ); if ( job.state() == Job::Finished || job.state() == Job::Failed ) { mJobMap.erase( it ); @@ -362,20 +362,20 @@ NodeMap::ConstIterator it2 = mNodeMap.find( processor ); if ( it2 == mNodeMap.end() ) { -// kDebug() << " Server not known" << endl; +// qDebug() << " Server not known" << endl; slot = registerNode( processor ); } else { SlotList slotList = it2.value(); SlotList::ConstIterator it3; for( it3 = slotList.begin(); it3 != slotList.end(); ++it3 ) { if ( (*it3)->isFree() ) { -// kDebug() << " Found free slot" << endl; +// qDebug() << " Found free slot" << endl; slot = *it3; break; } } if ( it3 == slotList.end() ) { -// kDebug() << " Create new slot" << endl; +// qDebug() << " Create new slot" << endl; slot = registerNode( processor ); } } @@ -424,7 +424,7 @@ GanttProgress *GanttStatusView::registerNode( unsigned int hostid ) { -// kDebug() << "GanttStatusView::registerNode(): " << ip << endl; +// qDebug() << "GanttStatusView::registerNode(): " << ip << endl; static int lastRow = 0; diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/icecream-monitor/icemon/src/ganttstatusview.h new/icecream-monitor/icemon/src/ganttstatusview.h --- old/icecream-monitor/icemon/src/ganttstatusview.h 2006-07-08 20:32:42.000000000 +0200 +++ new/icecream-monitor/icemon/src/ganttstatusview.h 2007-07-27 13:38:32.000000000 +0200 @@ -97,7 +97,7 @@ { JobData( const Job& j, int c ) : job( j ), clock( c ), next_text_width( 0 ) {} - JobData() {}; // stupid QValueList + JobData() {} // stupid QValueList bool operator==( const JobData& d ) { diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/icecream-monitor/icemon/src/hostinfo.cc new/icecream-monitor/icemon/src/hostinfo.cc --- old/icecream-monitor/icemon/src/hostinfo.cc 2007-07-04 13:56:40.000000000 +0200 +++ new/icecream-monitor/icemon/src/hostinfo.cc 2007-07-31 15:04:05.000000000 +0200 @@ -22,7 +22,7 @@ #include <assert.h> -Q3ValueVector<QColor> HostInfo::mColorTable; +QVector<QColor> HostInfo::mColorTable; QMap<int,QString> HostInfo::mColorNameMap; void HostInfo::initColorTable() @@ -127,10 +127,10 @@ void HostInfo::updateFromStatsMap( const StatsMap &stats ) { #if 0 - kDebug() << "HostInfo::updateFromStatsMap():" << endl; + qDebug() << "HostInfo::updateFromStatsMap():" << endl; StatsMap::ConstIterator it; for( it = stats.begin(); it != stats.end(); it++ ) { - kDebug() << " STAT: " << it.key() << ": " << it.data() << endl; + qDebug() << " STAT: " << it.key() << ": " << it.data() << endl; } #endif @@ -170,7 +170,7 @@ h += name.length() + ( name.length() << 17 ); h ^= h >> 2; - // kDebug() << "HostInfo::createColor: " << h % mColorTable.count() << ": " << name << endl; + // qDebug() << "HostInfo::createColor: " << h % mColorTable.count() << ": " << name << endl; return mColorTable[ h % mColorTable.count() ]; } diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/icecream-monitor/icemon/src/hostinfo.h new/icecream-monitor/icemon/src/hostinfo.h --- old/icecream-monitor/icemon/src/hostinfo.h 2007-07-04 13:56:40.000000000 +0200 +++ new/icecream-monitor/icemon/src/hostinfo.h 2007-07-31 15:04:05.000000000 +0200 @@ -23,7 +23,7 @@ #include <Qt/qstring.h> #include <Qt/qcolor.h> #include <Qt/qmap.h> -#include <Qt/q3valuevector.h> +#include <QtCore/QVector> class HostInfo { @@ -72,7 +72,7 @@ unsigned int mServerLoad; - static Q3ValueVector<QColor> mColorTable; + static QVector<QColor> mColorTable; static QMap<int,QString> mColorNameMap; }; diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/icecream-monitor/icemon/src/Messages.sh new/icecream-monitor/icemon/src/Messages.sh --- old/icecream-monitor/icemon/src/Messages.sh 1970-01-01 01:00:00.000000000 +0100 +++ new/icecream-monitor/icemon/src/Messages.sh 2007-07-31 09:01:52.000000000 +0200 @@ -0,0 +1,2 @@ +#! /usr/bin/env bash +$XGETTEXT *.cc -o $podir/icemon.pot diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/icecream-monitor/icemon/src/monitor.cc new/icecream-monitor/icemon/src/monitor.cc --- old/icecream-monitor/icemon/src/monitor.cc 2006-08-11 10:04:28.000000000 +0200 +++ new/icecream-monitor/icemon/src/monitor.cc 2007-07-31 15:04:05.000000000 +0200 @@ -4,6 +4,7 @@ Copyright (c) 2003 Frerich Raabe <raabe@kde.org> Copyright (c) 2003,2004 Stephan Kulow <coolo@kde.org> Copyright (c) 2003,2004 Cornelius Schumacher <schumacher@kde.org> + Copyright (c) 2007 Dirk Mueller <mueller@kde.org> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -29,6 +30,7 @@ #include <klocale.h> #include <kdebug.h> +#include <krandom.h> #include <qsocketnotifier.h> #include <qtimer.h> @@ -38,13 +40,11 @@ using namespace std; -Monitor::Monitor( HostInfoManager *m, QObject *parent, const char *name ) +Monitor::Monitor( HostInfoManager *m, QObject *parent) : QObject( parent ), m_hostInfoManager( m ), m_view( 0 ), - m_scheduler( 0 ), m_scheduler_read( 0 ), mSchedulerOnline( false ), - m_discover( 0 ), m_discover_read( 0 ) + m_scheduler( 0 ), mSchedulerOnline( false ), + m_discover( 0 ), m_fd_notify( 0 ), m_fd_type(QSocketNotifier::Exception) { - setObjectName( name ); - checkScheduler(); } @@ -56,20 +56,28 @@ void Monitor::checkScheduler(bool deleteit) { - kDebug() << "checkScheduler " << deleteit << endl; + qDebug() << "checkScheduler " << deleteit << endl; if ( deleteit ) { m_rememberedJobs.clear(); delete m_scheduler; m_scheduler = 0; - delete m_scheduler_read; - m_scheduler_read = 0; + delete m_fd_notify; + m_fd_notify = 0; + m_fd_type = QSocketNotifier::Exception; delete m_discover; m_discover = 0; - delete m_discover_read; - m_discover_read = 0; + setSchedulerState(false); } else if ( m_scheduler ) return; - QTimer::singleShot( 1800, this, SLOT( slotCheckScheduler() ) ); + QTimer::singleShot( 1000+(KRandom::random()&1023), this, SLOT( slotCheckScheduler() ) ); +} + +void Monitor::registerNotify(int fd, QSocketNotifier::Type type, const char* slot) +{ + delete m_fd_notify; + m_fd_notify = new QSocketNotifier(fd, type, this); + m_fd_type = type; + QObject::connect(m_fd_notify, SIGNAL(activated(int)), slot); } void Monitor::slotCheckScheduler() @@ -79,22 +87,14 @@ list<string> names; - if ( !m_current_netname.isEmpty() ) { - names.push_front( m_current_netname.toLatin1().data() ); - } else { - names = get_netnames( 60 ); - } + if ( !m_current_netname.isEmpty() ) + names.push_front( m_current_netname.data() ); + else + names.push_front("ICECREAM"); if (getenv("USE_SCHEDULER")) names.push_front(""); // try $USE_SCHEDULER - if ( names.empty() ) { - checkScheduler( true ); - setSchedulerState( false ); - return; - } - - for ( list<string>::const_iterator it = names.begin(); it != names.end(); ++it ) { @@ -102,49 +102,61 @@ if (!m_discover || m_discover->timed_out()) { delete m_discover; - m_discover = new DiscoverSched ( qPrintable(m_current_netname) ); - m_discover_read = new QSocketNotifier( m_discover->get_fd(), - QSocketNotifier::Read, - this ); - QObject::connect( m_discover_read, SIGNAL( activated( int ) ), - SLOT( slotCheckScheduler() ) ); - checkScheduler( false ); - return; + m_discover = new DiscoverSched ( m_current_netname.data() ); } m_scheduler = m_discover->try_get_scheduler (); if ( m_scheduler ) { + m_scheduler->setBulkTransfer(); delete m_discover; m_discover = 0; - delete m_discover_read; - m_discover_read = 0; + registerNotify(m_scheduler->fd, + QSocketNotifier::Read, SLOT(msgReceived())); if ( !m_scheduler->send_msg ( MonLoginMsg() ) ) { - delete m_scheduler; - } else { - m_scheduler_read = new QSocketNotifier( m_scheduler->fd, - QSocketNotifier::Read, - this ); - QObject::connect( m_scheduler_read, SIGNAL( activated( int ) ), - SLOT( msgReceived() ) ); + checkScheduler(true); + QTimer::singleShot(0, this, SLOT(slotCheckScheduler())); + } + else { setSchedulerState( true ); - return; } + return; + } + + if (m_fd_type != QSocketNotifier::Write + && m_discover->connect_fd() >= 0) { + registerNotify(m_discover->connect_fd(), + QSocketNotifier::Write, SLOT(slotCheckScheduler())); + return; } + else if (m_fd_type != QSocketNotifier::Read + && m_discover->listen_fd() >= 0) { + registerNotify(m_discover->listen_fd(), + QSocketNotifier::Read, SLOT(slotCheckScheduler())); + } + if (m_fd_type == QSocketNotifier::Read) + QTimer::singleShot(1000+(KRandom::random()&1023), this, SLOT(slotCheckScheduler())); + } - checkScheduler( true ); setSchedulerState( false ); } void Monitor::msgReceived() { + while (!m_scheduler->read_a_bit() || m_scheduler->has_msg()) + if (!handle_activity()) + break; +} + +bool Monitor::handle_activity() +{ Msg *m = m_scheduler->get_msg (); if ( !m ) { - kDebug() << "lost connection to scheduler\n"; + qDebug() << "lost connection to scheduler\n"; checkScheduler( true ); setSchedulerState( false ); - return; + return false; } switch ( m->type ) { @@ -175,6 +187,7 @@ break; } delete m; + return true; } void Monitor::handle_getcs( Msg *_m ) @@ -263,7 +276,7 @@ ( *it ).setState( Job::Compiling ); #if 0 - kDebug() << "BEGIN: " << (*it).fileName() << " (" << (*it).jobId() + qDebug() << "BEGIN: " << (*it).fileName() << " (" << (*it).jobId() << ")" << endl; #endif @@ -298,7 +311,7 @@ } #if 0 - kDebug() << "DONE: " << (*it).fileName() << " (" << (*it).jobId() + qDebug() << "DONE: " << (*it).fileName() << " (" << (*it).jobId() << ")" << endl; #endif @@ -318,13 +331,14 @@ } } -void Monitor::setCurrentNet( const QString &netName ) +void Monitor::setCurrentNet( const QByteArray &netName ) { m_current_netname = netName; } void Monitor::setSchedulerState( bool online ) { + if (mSchedulerOnline == online) return; mSchedulerOnline = online; m_view->updateSchedulerState( online ); } diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/icecream-monitor/icemon/src/monitor.h new/icecream-monitor/icemon/src/monitor.h --- old/icecream-monitor/icemon/src/monitor.h 2007-07-04 13:56:40.000000000 +0200 +++ new/icecream-monitor/icemon/src/monitor.h 2007-07-27 13:38:32.000000000 +0200 @@ -25,6 +25,7 @@ #include "job.h" #include <Qt/qobject.h> +#include <QtCore/QSocketNotifier> class HostInfoManager; class Msg; @@ -37,10 +38,10 @@ { Q_OBJECT public: - Monitor( HostInfoManager *, QObject *parent, const char *name = 0 ); + Monitor( HostInfoManager *, QObject *parent); ~Monitor(); - void setCurrentNet( const QString & ); + void setCurrentNet( const QByteArray & ); void setCurrentView( StatusView *, bool rememberJobs ); protected: @@ -52,6 +53,8 @@ private: void checkScheduler(bool deleteit = false); + void registerNotify(int fd, QSocketNotifier::Type type, const char* slot); + bool handle_activity(); void handle_getcs( Msg *m ); void handle_job_begin( Msg *m ); void handle_job_done( Msg *m ); @@ -63,12 +66,12 @@ StatusView *m_view; JobList m_rememberedJobs; MsgChannel *m_scheduler; - QSocketNotifier *m_scheduler_read; - QString m_current_netname; + QByteArray m_current_netname; bool mSchedulerOnline; DiscoverSched *m_discover; - QSocketNotifier *m_discover_read; + QSocketNotifier *m_fd_notify; + QSocketNotifier::Type m_fd_type; }; diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/icecream-monitor/icemon/src/mon-kde.cc new/icecream-monitor/icemon/src/mon-kde.cc --- old/icecream-monitor/icemon/src/mon-kde.cc 2007-07-16 10:59:23.000000000 +0200 +++ new/icecream-monitor/icemon/src/mon-kde.cc 2007-07-27 13:38:32.000000000 +0200 @@ -221,7 +221,7 @@ m_view->configureView(); } -void MainWindow::setCurrentNet( const QString &netName ) +void MainWindow::setCurrentNet( const QByteArray &netName ) { m_monitor->setCurrentNet( netName ); } @@ -250,7 +250,7 @@ MainWindow *mainWidget = new MainWindow( 0 ); KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); - QString netName = args->getOption( "netname" ); + QByteArray netName = args->getOption( "netname" ).toLatin1(); if ( !netName.isEmpty() ) { mainWidget->setCurrentNet( netName ); } diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/icecream-monitor/icemon/src/mon-kde.h new/icecream-monitor/icemon/src/mon-kde.h --- old/icecream-monitor/icemon/src/mon-kde.h 2007-07-16 10:59:23.000000000 +0200 +++ new/icecream-monitor/icemon/src/mon-kde.h 2007-07-27 13:38:32.000000000 +0200 @@ -36,7 +36,7 @@ MainWindow( QWidget *parent, const char *name = 0 ); ~MainWindow(); - void setCurrentNet( const QString & ); + void setCurrentNet( const QByteArray & ); private slots: void setupListView(); @@ -67,7 +67,6 @@ PoolViewType, GanttViewType, SummaryViewType, - HostViewType, DetailedHostViewType }; diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/icecream-monitor/icemon/src/poolview.cc new/icecream-monitor/icemon/src/poolview.cc --- old/icecream-monitor/icemon/src/poolview.cc 2007-07-16 10:59:23.000000000 +0200 +++ new/icecream-monitor/icemon/src/poolview.cc 2007-07-31 15:04:05.000000000 +0200 @@ -52,6 +52,7 @@ static bool suppressDomain = false; static bool showJobLines = false; +static bool clientsAttractHosts = false; PoolItem::PoolItem( const QString &text, PoolView *poolView, HostInfoManager *m ) : QGraphicsItemGroup( 0, poolView->canvas() ), mHostInfo( 0 ), mHostInfoManager( m ), @@ -159,19 +160,17 @@ } void PoolItem::setRandPos() -{ - int count; +{ + int count = 0; qreal w = scene()->width(); qreal h = scene()->height(); qreal x,y; do { - count ++; x = qrand()/(double)RAND_MAX * w; y = qrand()/(double)RAND_MAX * h; setCenterPos( x, y ); - - } while( collidingItems().count() && count < 40 ); - + } while( collidingItems().count() && ++count < 40 ); + show(); } @@ -340,10 +339,12 @@ PoolItem* poolItem = m_poolView->findPoolItem( j.server() ); if ( poolItem && poolItem != this ) poolItems << poolItem; - // Attraction between from servers to clients disabled ... - // PoolItem* poolItem2 = m_poolView->findPoolItem( j.client() ); - // if ( poolItem2 && poolItem2 != this ) - // poolItems << poolItem2; + + if ( ::clientsAttractHosts ) { + PoolItem* poolItem2 = m_poolView->findPoolItem( j.client() ); + if ( poolItem2 && poolItem2 != this ) + poolItems << poolItem2; + } } if ( poolItems.count() ) { @@ -388,12 +389,11 @@ } } + PoolViewConfigDialog::PoolViewConfigDialog( QWidget *parent ) : QDialog( parent ) { QBoxLayout *topLayout = new QVBoxLayout( this ); - topLayout->setMargin( KDialog::marginHint() ); - topLayout->setSpacing( KDialog::spacingHint() ); mArchFilterEdit = new QLineEdit( this ); topLayout->addWidget( mArchFilterEdit ); @@ -410,6 +410,11 @@ connect( mShowJobLines, SIGNAL( toggled( bool ) ), SLOT( slotShowJobLines( bool )) ); + mClientsAttractHosts = new QCheckBox( i18n("Clients attract hosts"), this); + topLayout->addWidget( mClientsAttractHosts ); + connect( mClientsAttractHosts, SIGNAL( toggled( bool ) ), + SLOT( slotClientsAttractHosts( bool )) ); + QFrame *hline = new QFrame( this ); hline->setFrameShape( QFrame::HLine ); topLayout->addWidget( hline ); @@ -441,6 +446,11 @@ configChanged(); } +void PoolViewConfigDialog::slotClientsAttractHosts( bool b ) +{ + ::clientsAttractHosts = b; + configChanged(); +} PoolView::PoolView( HostInfoManager *m, QWidget *parent ) : QWidget( parent ), StatusView( m ), m_poolItemWidth ( 30 ), m_poolItemHeight ( 30 ) @@ -450,52 +460,28 @@ SLOT( slotConfigChanged() ) ); m_canvas = new QGraphicsScene ( this ); - //m_canvas->setSceneRect( 0, 0, width(), height() ); m_canvas->setSceneRect( 0, 0, 1000, 1000 ); - QHBoxLayout *layout = new QHBoxLayout( this ); + QHBoxLayout *layout = new QHBoxLayout( this ); layout->setMargin( 0 ); m_canvasView = new QGraphicsView( m_canvas, this ); m_canvasView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); m_canvasView->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); m_canvasView->setRenderHints( QPainter::Antialiasing | QPainter::SmoothPixmapTransform ); - m_canvasView->setSceneRect( 0, 0, 1000, 1000 ); m_canvasView->setViewportUpdateMode( QGraphicsView::FullViewportUpdate ); - layout->addWidget( m_canvasView ); - m_scaleFactor = 1; - createKnownHosts(); - QTimer::singleShot( 0, this, SLOT( arrangePoolItems() ) ); - -} - -void PoolView::updatePoolItemsSize() -{ - // Check if the total surface is enough - qreal canvasSurf = m_canvasView->width() * m_canvasView->height(); - qreal itemSurf = m_poolItemWidth * m_poolItemHeight; - int count = m_poolItems.count(); - if ( count * itemSurf > 0.7 * canvasSurf ) { - // If not, scale down each host item - - // Choose new scale factor so that there is place for 10 items - m_scaleFactor = canvasSurf / ( m_poolItemWidth * m_poolItemHeight * ( count + 10 ) ); - } - // Scale them - foreach( PoolItem *it, m_poolItems ) { - it->setSize( m_poolItemWidth*m_scaleFactor, m_poolItemHeight*m_scaleFactor ); - } + QTimer::singleShot( 0, this, SLOT( arrangePoolItems() ) ); } void PoolView::update( const Job &job ) { unsigned int hostid = processor( job ); if ( !hostid ) { - kDebug() << "Empty host" << endl; + qDebug() << "Empty host" << endl; return; } @@ -579,12 +565,12 @@ QMap<unsigned int,PoolItem *>::Iterator it; for( it = mJobMap.begin(); it != mJobMap.end(); ++it ) { #if 0 - kDebug() << " JOB: " << it.key() << " (" << int( it.value() ) + qDebug() << " JOB: " << it.key() << " (" << int( it.value() ) << ")" << endl; #endif if ( it.value() == poolItem ) { #if 0 - kDebug() << " Delete Job " << it.key() << endl; + qDebug() << " Delete Job " << it.key() << endl; #endif obsoleteJobs.append( it.key() ); } @@ -606,7 +592,6 @@ void PoolView::resizeEvent( QResizeEvent * ) { m_canvasView->fitInView( m_canvas->sceneRect(), Qt::KeepAspectRatio ); - updatePoolItemsSize(); } bool PoolView::event ( QEvent* e ) @@ -672,6 +657,7 @@ it->checkCollision(); // make it bounce on other items } + foreach( PoolItem *it, m_poolItems ) { it->drawJobLines(); } diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/icecream-monitor/icemon/src/poolview.h new/icecream-monitor/icemon/src/poolview.h --- old/icecream-monitor/icemon/src/poolview.h 2007-07-16 11:59:09.000000000 +0200 +++ new/icecream-monitor/icemon/src/poolview.h 2007-07-26 14:40:28.000000000 +0200 @@ -33,6 +33,7 @@ class HostInfo; class PoolItem; +class PoolView; class QSlider; class QLabel; @@ -41,7 +42,6 @@ class QGraphicsView; class QGraphicsLineItem; -class PoolView; class PoolItem : public QGraphicsItemGroup { @@ -136,6 +136,7 @@ protected slots: void slotSuppressDomainName( bool ); void slotShowJobLines( bool ); + void slotClientsAttractHosts( bool b ); signals: void configChanged(); @@ -143,6 +144,7 @@ QLineEdit *mArchFilterEdit; QCheckBox *mSuppressDomainName; QCheckBox *mShowJobLines; + QCheckBox *mClientsAttractHosts; }; @@ -191,19 +193,17 @@ void removeItem( PoolItem * ); void forceRemoveNode( unsigned int hostid ); - - protected slots: +protected slots: void slotConfigChanged(); - private slots: void arrangePoolItems(); + private: void createKnownHosts(); PoolItem *createPoolItem( unsigned int hostid ); void drawNodeStatus(); // void drawState( PoolItem *node ); - void updatePoolItemsSize(); PoolViewConfigDialog *mConfigDialog; diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/icecream-monitor/icemon/src/starview.cc new/icecream-monitor/icemon/src/starview.cc --- old/icecream-monitor/icemon/src/starview.cc 2007-02-23 11:35:35.000000000 +0100 +++ new/icecream-monitor/icemon/src/starview.cc 2007-07-31 15:04:05.000000000 +0200 @@ -48,8 +48,6 @@ : QDialog( parent ) { QBoxLayout *topLayout = new QVBoxLayout( this ); - topLayout->setMargin( KDialog::marginHint() ); - topLayout->setSpacing( KDialog::spacingHint() ); QLabel *label = new QLabel( i18n("Number of nodes per ring:"), this ); topLayout->addWidget( label ); @@ -303,14 +301,14 @@ void StarView::update( const Job &job ) { #if 0 - kDebug() << "StarView::update() " << job.jobId() + qDebug() << "StarView::update() " << job.jobId() << " server: " << job.server() << " client: " << job.client() << " state: " << job.stateAsString() << endl; #endif unsigned int hostid = processor( job ); if ( !hostid ) { - kDebug() << "Empty host" << endl; + qDebug() << "Empty host" << endl; return; } @@ -356,7 +354,7 @@ void StarView::checkNode( unsigned int hostid ) { -// kDebug() << "StarView::checkNode() " << hostid << endl; +// qDebug() << "StarView::checkNode() " << hostid << endl; if ( !hostid ) return; @@ -371,7 +369,7 @@ void StarView::removeNode( unsigned int hostid ) { -// kDebug() << "StarView::removeNode() " << hostid << endl; +// qDebug() << "StarView::removeNode() " << hostid << endl; HostItem *hostItem = findHostItem( hostid ); @@ -392,7 +390,7 @@ void StarView::removeItem( HostItem *hostItem ) { #if 0 - kDebug() << "StarView::removeItem() " << hostid << " (" + qDebug() << "StarView::removeItem() " << hostid << " (" << int( hostItem ) << ")" << endl; #endif @@ -403,12 +401,12 @@ QMap<unsigned int,HostItem *>::Iterator it; for( it = mJobMap.begin(); it != mJobMap.end(); ++it ) { #if 0 - kDebug() << " JOB: " << it.key() << " (" << int( it.value() ) + qDebug() << " JOB: " << it.key() << " (" << int( it.value() ) << ")" << endl; #endif if ( it.value() == hostItem ) { #if 0 - kDebug() << " Delete Job " << it.key() << endl; + qDebug() << " Delete Job " << it.key() << endl; #endif obsoleteJobs.append( it.key() ); } @@ -505,7 +503,7 @@ void StarView::slotConfigChanged() { -// kDebug() << "StarView::slotConfigChanged()" << endl; +// qDebug() << "StarView::slotConfigChanged()" << endl; HostInfoManager::HostMap hostMap = hostInfoManager()->hostMap(); HostInfoManager::HostMap::ConstIterator it; @@ -519,17 +517,17 @@ void StarView::arrangeHostItems() { -// kDebug() << "StarView::arrangeHostItems()" << endl; +// qDebug() << "StarView::arrangeHostItems()" << endl; int count = m_hostItems.count(); -// kDebug() << " Count: " << count << endl; +// qDebug() << " Count: " << count << endl; int nodesPerRing = mConfigDialog->nodesPerRing(); int ringCount = int( count / nodesPerRing ) + 1; -// kDebug() << " Rings: " << ringCount << endl; +// qDebug() << " Rings: " << ringCount << endl; double radiusFactor = 2.5; if (suppressDomain) radiusFactor = 4; const int xRadius = qRound( m_canvas->width() / radiusFactor ); @@ -565,7 +563,7 @@ if ( !i || i->isOffline() || i->name().isEmpty() ) return 0; -// kDebug() << "New node for " << hostid << " (" << i->name() << ")" << endl; +// qDebug() << "New node for " << hostid << " (" << i->name() << ")" << endl; //assert( !i->name().isEmpty() ); diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/icecream-monitor/icemon/src/summaryview.cc new/icecream-monitor/icemon/src/summaryview.cc --- old/icecream-monitor/icemon/src/summaryview.cc 2006-07-08 20:32:42.000000000 +0200 +++ new/icecream-monitor/icemon/src/summaryview.cc 2007-07-31 15:04:05.000000000 +0200 @@ -84,12 +84,6 @@ QLabel *l; - l = new QLabel(labelBox); - l->setPixmap(UserIcon("icemonnode")); - l->setAlignment(Qt::AlignCenter); - l->show(); - labelLayout->addWidget( l ); - l = new QLabel(view->nameForHost(hostid), labelBox); l->setAlignment(Qt::AlignCenter); l->show(); @@ -152,7 +146,7 @@ m_jobCount++; m_jobsLabel->setText(QString::number(m_jobCount)); - Q3ValueVector<JobHandler>::Iterator it = m_jobHandlers.begin(); + QVector<JobHandler>::Iterator it = m_jobHandlers.begin(); while(it != m_jobHandlers.end() && !(*it).currentFile.isNull()) ++it; @@ -172,7 +166,7 @@ case Job::Finished: case Job::Failed: { - Q3ValueVector<JobHandler>::Iterator it = m_jobHandlers.begin(); + QVector<JobHandler>::Iterator it = m_jobHandlers.begin(); while(it != m_jobHandlers.end() && (*it).currentFile != job.fileName()) ++it; @@ -199,7 +193,7 @@ label->setAlignment(Qt::AlignRight | flags); const int row = grid->rowCount(); grid->addWidget(label, row, 0); - KSqueezedTextLabel *statusLabel = new KSqueezedTextLabel(status, parent); + QLabel *statusLabel = new QLabel(status, parent); //statusLabel->setAlignment(Qt::AlignLeft | flags); grid->addWidget(statusLabel, row, 1); label->show(); diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/icecream-monitor/icemon/src/summaryview.h new/icecream-monitor/icemon/src/summaryview.h --- old/icecream-monitor/icemon/src/summaryview.h 2006-07-08 20:32:42.000000000 +0200 +++ new/icecream-monitor/icemon/src/summaryview.h 2007-07-19 13:04:04.000000000 +0200 @@ -56,7 +56,7 @@ int m_jobCount; SummaryView *m_view; - Q3ValueVector<JobHandler> m_jobHandlers; + QVector<JobHandler> m_jobHandlers; QList<QWidget *> m_widgets; }; ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Remember to have fun... --------------------------------------------------------------------- To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-commit+help@opensuse.org
participants (1)
-
root@Hilbert.suse.de