This forum has been archived. All content is frozen. Please use KDE Discuss instead.

How to change the green color of active torrents?

Tags: None
(comma "," separated)
asmith
Registered Member
Posts
3
Karma
0
Is there any way to change the color of active torrents in the download list? Unfortunately KTorrent does not offer any option to do it directly, so maybe it is possible through config files.

Or, as a last resource, changing it directly in the source code. After running grep -H -r "green" ktorrent-4.3.1/ (and removing mentions to .po files) that's the result:
Code: Select all
ktorrent-4.3.1/plugins/infowidget/statustab.cpp:      share_ratio->setText(QString("<font color=\"%1\">%2</font>").arg(ratio <= Settings::greenRatio() ? "#ff0000" : "#1c9a1c").arg(KGlobal::locale()->formatNumber(ratio,2)));
ktorrent-4.3.1/plugins/infowidget/infowidgetplugin.cpp:         InfoWidgetPluginSettings::setFirstColor(Qt::green);
ktorrent-4.3.1/libktcore/ktorrent.kcfg:      <entry name="greenRatio" type="Double">
ktorrent-4.3.1/libktcore/dbus/dbussettings.h:      Q_SCRIPTABLE double greenRatio();
ktorrent-4.3.1/libktcore/dbus/dbussettings.cpp:   double DBusSettings::greenRatio()
ktorrent-4.3.1/libktcore/dbus/dbussettings.cpp:      return Settings::greenRatio();
ktorrent-4.3.1/ktorrent/view/viewmodel.cpp:            QColor green(40, 205, 40);
ktorrent-4.3.1/ktorrent/view/viewmodel.cpp:                return green;
ktorrent-4.3.1/ktorrent/view/viewmodel.cpp:            QColor green(40, 205, 40);
ktorrent-4.3.1/ktorrent/view/viewmodel.cpp:            return share_ratio >= Settings::greenRatio() ? green : Qt::red;
ktorrent-4.3.1/ktorrent/pref/qmpref.ui:         <string>Value at which the share ratio will be displayed with a green color. Lower ratios will be displayed in red.</string>
ktorrent-4.3.1/ktorrent/pref/qmpref.ui:       <widget class="QDoubleSpinBox" name="kcfg_greenRatio">
ktorrent-4.3.1/ktorrent/pref/qmpref.ui:         <string>Value at which the share ratio will be displayed with a green color. Lower ratios will be displayed in red.</string>
ktorrent-4.3.1/ktorrent/tools/queuemanagermodel.cpp:               return QColor(40, 205, 40); // green
ktorrent-4.3.1/ChangeLog:- Make ratio configurable at which the share ratio becomes green (254144)
ktorrent-4.3.1/kio-magnet/README:This project is the result of a "green" brainstorm. Legal1ze 1t!


Do you know what file to change?

Thanks.
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS
It seems that KTorrent (or libktcore at least) does have a "greenRatio" option somewhere. Try searching for that in the configuration interface and increasing it to a very high or improbable number (like 1000 or so). If you can't find it, can you post a link to that *.kcfg file and i'll see if I can determine where in the configuration file that key should be written.


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
Minio
Registered Member
Posts
177
Karma
1
OS
But it seems that this "greenRatio" is used for ratio (in torrent world, that is ratio of downloaded data to uploaded data) only, so most likely changing it won't change color of active torrent name.


Best regards
Mirosław Zalewski
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS
In this case, I would advise investigating the ktorrent-4.3.1/ktorrent/view/viewmodel.cpp file first, followed by the ktorrent-4.3.1/plugins/infowidget/infowidgetplugin.cpp files.

While models usually do not control the visualisation, particularly in appearance matters, it may be that the model does exert some control here.
Alternatively, the control could lie in a custom delegate.


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]


Bookmarks



Who is online

Registered users: bancha, Bing [Bot], Google [Bot], Sogou [Bot]