Summary: | Number of files in statusbar | ||
---|---|---|---|
Product: | [Applications] k3b | Reporter: | Andrey Cherepanov <sibskull> |
Component: | GUI/Usability | Assignee: | Sebastian Trueg <trueg> |
Status: | RESOLVED FIXED | ||
Severity: | wishlist | ||
Priority: | NOR | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | unspecified | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: |
Description
Andrey Cherepanov
2006-10-04 12:39:17 UTC
SVN commit 605371 by trueg: Show project statistics in the statusbar. BUG: 135084 M +10 -1 k3bprojectmanager.cpp M +6 -1 k3bprojectmanager.h M +85 -18 k3bstatusbarmanager.cpp M +3 -4 k3bstatusbarmanager.h --- trunk/extragear/multimedia/k3b/src/k3bprojectmanager.cpp #605370:605371 @@ -107,6 +107,10 @@ kdDebug() << "(K3bProjectManager) adding doc " << doc->URL().path() << endl; d->projects.append(doc); + + connect( doc, SIGNAL(changed(K3bDoc*)), + this, SLOT(slotProjectChanged(K3bDoc*)) ); + emit newProject( doc ); } } @@ -180,7 +184,7 @@ } -K3bDoc* K3bProjectManager::activeDoc() const +K3bDoc* K3bProjectManager::activeProject() const { return d->activeProject; } @@ -622,4 +626,9 @@ } +void K3bProjectManager::slotProjectChanged( K3bDoc* doc ) +{ + emit projectChanged( doc ); +} + #include "k3bprojectmanager.moc" --- trunk/extragear/multimedia/k3b/src/k3bprojectmanager.h #605370:605371 @@ -52,7 +52,8 @@ */ bool saveProject( K3bDoc*, const KURL &url ); - K3bDoc* activeDoc() const; + K3bDoc* activeDoc() const { return activeProject(); } + K3bDoc* activeProject() const; K3bDoc* findByUrl( const KURL& url ); bool isEmpty() const; @@ -71,8 +72,12 @@ void newProject( K3bDoc* ); void projectSaved( K3bDoc* ); void closingProject( K3bDoc* ); + void projectChanged( K3bDoc* doc ); void activeProjectChanged( K3bDoc* ); + private slots: + void slotProjectChanged( K3bDoc* doc ); + private: // used internal K3bDoc* createEmptyProject( K3bDoc::DocType ); --- trunk/extragear/multimedia/k3b/src/k3bstatusbarmanager.cpp #605370:605371 @@ -19,6 +19,12 @@ #include "k3b.h" #include <k3bversion.h> #include <k3bglobals.h> +#include "k3bprojectmanager.h" +#include "k3bapplication.h" +#include <k3baudiodoc.h> +#include <k3bdatadoc.h> +#include <k3bmixeddoc.h> +#include <k3bdiritem.h> #include <kiconloader.h> #include <klocale.h> @@ -45,15 +51,15 @@ // setup free temp space box QHBox* boxFreeTemp = new QHBox( m_mainWindow->statusBar() ); boxFreeTemp->setSpacing(2); + + m_labelProjectInfo = new QLabel( m_mainWindow->statusBar() ); + m_pixFreeTemp = new QLabel( boxFreeTemp ); (void)new QLabel( i18n("Temp:"), boxFreeTemp ); m_pixFreeTemp->setPixmap( SmallIcon("folder_green") ); m_labelFreeTemp = new QLabel( boxFreeTemp ); boxFreeTemp->installEventFilter( this ); - // busy widget - m_busyWidget = new K3bBusyWidget( m_mainWindow->statusBar() ); - // setup info area m_labelInfoMessage = new QLabel( " ", m_mainWindow->statusBar() ); @@ -63,8 +69,12 @@ // setup the statusbar m_mainWindow->statusBar()->addWidget( m_labelInfoMessage, 1 ); // for showing some info - m_mainWindow->statusBar()->addWidget( m_busyWidget, 0, true ); + m_mainWindow->statusBar()->addWidget( m_labelProjectInfo, 0, true ); + // a spacer item + m_mainWindow->statusBar()->addWidget( new QLabel( " ", m_mainWindow->statusBar() ), 0, true ); m_mainWindow->statusBar()->addWidget( boxFreeTemp, 0, true ); + // a spacer item + m_mainWindow->statusBar()->addWidget( new QLabel( " ", m_mainWindow->statusBar() ), 0, true ); m_mainWindow->statusBar()->addWidget( m_versionBox, 0, true ); connect( m_mainWindow, SIGNAL(configChanged(KConfig*)), this, SLOT(update()) ); @@ -72,6 +82,10 @@ this, SLOT(showActionStatusText(const QString&)) ); connect( m_mainWindow->actionCollection(), SIGNAL(clearStatusText()), this, SLOT(clearActionStatusText()) ); + connect( k3bappcore->projectManager(), SIGNAL(activeProjectChanged(K3bDoc*)), + this, SLOT(slotActiveProjectChanged(K3bDoc*)) ); + connect( k3bappcore->projectManager(), SIGNAL(projectChanged(K3bDoc*)), + this, SLOT(slotActiveProjectChanged(K3bDoc*)) ); update(); } @@ -121,20 +135,6 @@ } -void K3bStatusBarManager::showBusyInfo( const QString& str ) -{ - m_labelInfoMessage->setText( str ); - m_busyWidget->showBusy( true ); -} - - -void K3bStatusBarManager::endBusy() -{ - m_labelInfoMessage->setText( " " ); - m_busyWidget->showBusy( false ); -} - - void K3bStatusBarManager::showActionStatusText( const QString& text ) { m_mainWindow->statusBar()->message( text ); @@ -161,4 +161,71 @@ } +static QString dataDocStats( K3bDataDoc* dataDoc ) +{ + return i18n("1 file in %1", "%n files in %1", dataDoc->root()->numFiles() ) + .arg( i18n("1 folder", "%n folders", dataDoc->root()->numDirs() ) ); +} + + +void K3bStatusBarManager::slotActiveProjectChanged( K3bDoc* doc ) +{ + if( doc && doc == k3bappcore->projectManager()->activeProject() ) { + switch( doc->type() ) { + case K3bDoc::AUDIO: { + K3bAudioDoc* audioDoc = static_cast<K3bAudioDoc*>( doc ); + m_labelProjectInfo->setText( i18n("Audio CD (1 track)", "Audio CD (%n tracks)", audioDoc->numOfTracks() ) ); + break; + } + + case K3bDoc::DATA: { + K3bDataDoc* dataDoc = static_cast<K3bDataDoc*>( doc ); + m_labelProjectInfo->setText( i18n("Data CD (%1)").arg(dataDocStats(dataDoc)) ); + break; + } + + case K3bDoc::MIXED: { + K3bAudioDoc* audioDoc = static_cast<K3bMixedDoc*>( doc )->audioDoc(); + K3bDataDoc* dataDoc = static_cast<K3bMixedDoc*>( doc )->dataDoc(); + m_labelProjectInfo->setText( i18n("Mixed CD (1 track and %1)", "Mixed CD (%n tracks and %1)", audioDoc->numOfTracks() ) + .arg( dataDocStats(dataDoc)) ); + break; + } + + case K3bDoc::VCD: { + K3bDataDoc* dataDoc = static_cast<K3bDataDoc*>( doc ); + m_labelProjectInfo->setText( i18n("Video CD (%1)").arg(dataDocStats(dataDoc)) ); + break; + } + + case K3bDoc::MOVIX: { + K3bDataDoc* dataDoc = static_cast<K3bDataDoc*>( doc ); + m_labelProjectInfo->setText( i18n("eMovix CD (%1)").arg(dataDocStats(dataDoc)) ); + break; + } + + case K3bDoc::MOVIX_DVD: { + K3bDataDoc* dataDoc = static_cast<K3bDataDoc*>( doc ); + m_labelProjectInfo->setText( i18n("eMovix DVD (%1)").arg(dataDocStats(dataDoc)) ); + break; + } + + case K3bDoc::DVD: { + K3bDataDoc* dataDoc = static_cast<K3bDataDoc*>( doc ); + m_labelProjectInfo->setText( i18n("Data DVD (%1)").arg(dataDocStats(dataDoc)) ); + break; + } + + case K3bDoc::VIDEODVD: { + K3bDataDoc* dataDoc = static_cast<K3bDataDoc*>( doc ); + m_labelProjectInfo->setText( i18n("Video DVD (%1)").arg(dataDocStats(dataDoc)) ); + break; + } + } + } + else if( !doc ) { + m_labelProjectInfo->setText( QString() ); + } +} + #include "k3bstatusbarmanager.moc" --- trunk/extragear/multimedia/k3b/src/k3bstatusbarmanager.h #605370:605371 @@ -21,9 +21,9 @@ #include <qobject.h> class QLabel; -class K3bBusyWidget; class K3bMainWindow; class QEvent; +class K3bDoc; class K3bStatusBarManager : public QObject @@ -36,13 +36,12 @@ public slots: void update(); - void showBusyInfo( const QString& ); - void endBusy(); private slots: void slotFreeTempSpace( const QString&, unsigned long, unsigned long, unsigned long ); void showActionStatusText( const QString& text ); void clearActionStatusText(); + void slotActiveProjectChanged( K3bDoc* doc ); private: bool eventFilter( QObject* o, QEvent* e ); @@ -51,7 +50,7 @@ QLabel* m_pixFreeTemp; QLabel* m_labelFreeTemp; QLabel* m_versionBox; - K3bBusyWidget* m_busyWidget; + QLabel* m_labelProjectInfo; K3bMainWindow* m_mainWindow; }; |