[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-bugs-dist
Subject: [Bug 142248] Loading bar or icon for Ktorrent
From: Joris Guisson <joris.guisson () gmail ! com>
Date: 2007-04-16 19:38:37
Message-ID: 20070416193837.551.qmail () ktown ! kde ! org
[Download RAW message or body]
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
http://bugs.kde.org/show_bug.cgi?id=142248
joris.guisson gmail com changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |FIXED
------- Additional Comments From joris.guisson gmail com 2007-04-16 21:38 -------
SVN commit 654693 by guisson:
Added progress bar to status bar which will be shown when you are searching with the search plugin.
BUG: 142248
M +1 -0 ChangeLog
M +25 -1 apps/ktorrent/ktorrent.cpp
M +4 -0 apps/ktorrent/ktorrent.h
M +7 -0 libktorrent/interfaces/guiinterface.h
M +32 -2 plugins/search/searchwidget.cpp
M +6 -3 plugins/search/searchwidget.h
--- trunk/extragear/network/ktorrent/ChangeLog #654692:654693
@ -14,6 +14,7 @
- Added option to move finished downloads to a different directory
- Readded feature to show the total and the number of running torrents in the
tab of each view
+- Added progress bar in status bar when searching
Changes in 2.1.2
- Fix 2 security vulnerabilities (thanks to Bryan Burns from Juniper Networks
--- trunk/extragear/network/ktorrent/apps/ktorrent/ktorrent.cpp #654692:654693
@ -111,7 +111,7 @
KTorrent::KTorrent()
: DMainWindow(0,"KTorrent"),m_group_view(0),
- m_view_man(0), m_systray_icon(0)
+ m_view_man(0), m_systray_icon(0),m_status_prog(0)
{
setHidden(true);
//setToolviewStyle(KMdi::TextAndIcon);
@ -913,5 +913,29 @
m_core->loadSilentlyDir(url, savedir);
}
+KProgress* KTorrent::addProgressBarToStatusBar()
+{
+ if (m_status_prog)
+ return 0;
+
+ KStatusBar* sb = statusBar();
+ m_status_prog = new KProgress(100,sb);
+ m_status_prog->setValue(0);
+ sb->addWidget(m_status_prog);
+ m_status_prog->show();
+ return m_status_prog;
+}
+
+void KTorrent::removeProgressBarFromStatusBar(KProgress* p)
+{
+ if (m_status_prog != p)
+ return;
+
+ KStatusBar* sb = statusBar();
+ sb->removeWidget(p);
+ delete p;
+ m_status_prog = 0;
+}
+
#include "ktorrent.moc"
--- trunk/extragear/network/ktorrent/apps/ktorrent/ktorrent.h #654692:654693
@ -105,6 +105,8 @
virtual const kt::TorrentInterface* getCurrentTorrent() const;
virtual KToolBar* addToolBar(const char* name);
virtual void removeToolBar(KToolBar* tb);
+ virtual KProgress* addProgressBarToStatusBar();
+ virtual void removeProgressBarFromStatusBar(KProgress* p);
QString getStatusInfo();
QString getStatusTransfer();
@ -216,6 +218,8 @
KAction* m_queueaction;
KAction* m_datacheck;
KAction* m_ipfilter;
+
+ KProgress* m_status_prog;
};
#endif // _KTORRENT_H_
--- trunk/extragear/network/ktorrent/libktorrent/interfaces/guiinterface.h #654692:654693
@ -26,6 +26,7 @
class QIconSet;
class QString;
class KToolBar;
+class KProgress;
namespace kt
{
@ -90,6 +91,12 @
/// Remove a view listener
void removeViewListener(ViewListener* vl);
+ /// Add a progress bar tot the status bar, if one is already present this will fail and return 0
+ virtual KProgress* addProgressBarToStatusBar() = 0;
+
+ /// Remove the progress bar from the status bar
+ virtual void removeProgressBarFromStatusBar(KProgress* p) = 0;
+
/**
* Add a new tab page to the GUI
* param page The widget
--- trunk/extragear/network/ktorrent/plugins/search/searchwidget.cpp #654692:654693
@ -38,6 +38,7 @
#include <kio/job.h>
#include <kmessagebox.h>
#include <kfiledialog.h>
+#include <kprogress.h>
#include <util/log.h>
#include <torrent/globals.h>
#include <interfaces/guiinterface.h>
@ -105,12 +106,19 @
KParts::PartManager* pman = html_part->partManager();
connect(pman,SIGNAL(partAdded(KParts::Part*)),this,SLOT(onFrameAdded(KParts::Part* )));
+
+ connect(html_part->browserExtension(),SIGNAL(loadingProgress(int)),this,SLOT(loadingProgress(int)));
+ prog = 0;
}
SearchWidget::~SearchWidget()
{
-
+ if (prog)
+ {
+ sp->getGUI()->removeProgressBarFromStatusBar(prog);
+ prog = 0;
+ }
}
void SearchWidget::updateSearchEngines(const SearchEngineList & sl)
@ -189,7 +197,6 @
void SearchWidget::onFinished()
{
- statusBarMsg(i18n("Search finished"));
}
void SearchWidget::onOpenTorrent(const KURL & url)
@ -237,6 +244,29 @
{
sp->getCore()->load(url);
}
+
+ void SearchWidget::loadingProgress(int perc)
+ {
+ if (perc < 100 && !prog)
+ {
+ prog = sp->getGUI()->addProgressBarToStatusBar();
+ if (prog)
+ prog->setValue(perc);
+ }
+ else if (prog && perc < 100)
+ {
+ prog->setValue(perc);
+ }
+ else if (perc == 100)
+ {
+ if (prog)
+ {
+ sp->getGUI()->removeProgressBarFromStatusBar(prog);
+ prog = 0;
+ }
+ statusBarMsg(i18n("Search finished"));
+ }
+ }
}
#include "searchwidget.moc"
--- trunk/extragear/network/ktorrent/plugins/search/searchwidget.h #654692:654693
@ -25,7 +25,7 @
#include <kurl.h>
class SearchBar;
-
+class KProgress;
class KPopupMenu;
namespace KParts
@ -41,7 +41,9 @
/**
- author Joris Guisson
+ author Joris Guisson
+
+ Widget which shows a KHTML window with the users search in it
*/
class SearchWidget : public QWidget
{
@ -71,7 +73,7 @
void onFrameAdded(KParts::Part* p);
void statusBarMsg(const QString & url);
void openTorrent(const KURL & url);
-
+ void loadingProgress(int perc);
private:
HTMLPart* html_part;
@ -79,6 +81,7 @
KPopupMenu* right_click_menu;
int back_id;
SearchPlugin* sp;
+ KProgress* prog;
};
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic