summaryrefslogtreecommitdiffstats
path: root/src/statusbarspaceinfo.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-04-27 00:40:29 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-04-27 00:40:29 +0000
commit7a741e43ff09e70396a918956219b8316c48e522 (patch)
tree3d0f60eccd59786cea7236db2d5c4c1f25874515 /src/statusbarspaceinfo.cpp
parenta48487ef0c329434b58b6f920111bb0999f1109e (diff)
downloaddolphin-7a741e43ff09e70396a918956219b8316c48e522.tar.gz
dolphin-7a741e43ff09e70396a918956219b8316c48e522.zip
TQt4 port Dolphin
This enables compilation under Qt3 and Qt4 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/dolphin@1229359 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/statusbarspaceinfo.cpp')
-rw-r--r--src/statusbarspaceinfo.cpp70
1 files changed, 35 insertions, 35 deletions
diff --git a/src/statusbarspaceinfo.cpp b/src/statusbarspaceinfo.cpp
index 221a4f0..cf70190 100644
--- a/src/statusbarspaceinfo.cpp
+++ b/src/statusbarspaceinfo.cpp
@@ -20,15 +20,15 @@
#include "statusbarspaceinfo.h"
-#include <qpainter.h>
-#include <qtimer.h>
+#include <tqpainter.h>
+#include <tqtimer.h>
#include <kglobalsettings.h>
#include <kdiskfreesp.h>
#include <klocale.h>
#include <kio/job.h>
-StatusBarSpaceInfo::StatusBarSpaceInfo(QWidget* parent) :
- QWidget(parent),
+StatusBarSpaceInfo::StatusBarSpaceInfo(TQWidget* tqparent) :
+ TQWidget(tqparent),
m_gettingSize(false),
m_kBSize(0),
m_kBAvailable(0)
@@ -37,8 +37,8 @@ StatusBarSpaceInfo::StatusBarSpaceInfo(QWidget* parent) :
// Update the space information each 10 seconds. Polling is useful
// here, as files can be deleted/added outside the scope of Dolphin.
- QTimer* timer = new QTimer(this);
- connect(timer, SIGNAL(timeout()), this, SLOT(refresh()));
+ TQTimer* timer = new TQTimer(this);
+ connect(timer, TQT_SIGNAL(timeout()), this, TQT_SLOT(refresh()));
timer->start(10000);
}
@@ -53,32 +53,32 @@ void StatusBarSpaceInfo::setURL(const KURL& url)
update();
}
-void StatusBarSpaceInfo::paintEvent(QPaintEvent* /* event */)
+void StatusBarSpaceInfo::paintEvent(TQPaintEvent* /* event */)
{
- QPainter painter(this);
+ TQPainter painter(this);
const int barWidth = width();
const int barTop = 2;
const int barHeight = height() - 4;
- QString text;
+ TQString text;
const int widthDec = 3; // visual decrement for the available width
- const QColor c1 = colorGroup().background();
- const QColor c2 = KGlobalSettings::buttonTextColor();
- const QColor frameColor((c1.red() + c2.red()) / 2,
+ const TQColor c1 = tqcolorGroup().background();
+ const TQColor c2 = KGlobalSettings::buttonTextColor();
+ const TQColor frameColor((c1.red() + c2.red()) / 2,
(c1.green() + c2.green()) / 2,
(c1.blue() + c2.blue()) / 2);
painter.setPen(frameColor);
- const QColor backgrColor = KGlobalSettings::baseColor();
+ const TQColor backgrColor = KGlobalSettings::baseColor();
painter.setBrush(backgrColor);
- painter.drawRect(QRect(0, barTop + 1 , barWidth - widthDec, barHeight));
+ painter.drawRect(TQRect(0, barTop + 1 , barWidth - widthDec, barHeight));
if ((m_kBSize > 0) && (m_kBAvailable > 0)) {
// draw 'used size' bar
- painter.setPen(Qt::NoPen);
+ painter.setPen(TQt::NoPen);
painter.setBrush(progressColor(backgrColor));
int usedWidth = barWidth - static_cast<int>((m_kBAvailable *
static_cast<float>(barWidth)) / m_kBSize);
@@ -87,10 +87,10 @@ void StatusBarSpaceInfo::paintEvent(QPaintEvent* /* event */)
if (right < left) {
right = left;
}
- painter.drawRect(QRect(left, barTop + 2, right, barHeight - 2));
+ painter.drawRect(TQRect(left, barTop + 2, right, barHeight - 2));
text = i18n("%1 free")
- .arg(KIO::convertSizeFromKB(m_kBAvailable));
+ .tqarg(KIO::convertSizeFromKB(m_kBAvailable));
}
else {
if (m_gettingSize) {
@@ -98,14 +98,14 @@ void StatusBarSpaceInfo::paintEvent(QPaintEvent* /* event */)
}
else {
text = "";
- QTimer::singleShot(0, this, SLOT(hide()));
+ TQTimer::singleShot(0, this, TQT_SLOT(hide()));
}
}
// draw text (usually 'Y GB free')
painter.setPen(KGlobalSettings::textColor());
- painter.drawText(QRect(1, 1, barWidth - 2, barHeight + 4),
- Qt::AlignHCenter | Qt::AlignVCenter | Qt::WordBreak,
+ painter.drawText(TQRect(1, 1, barWidth - 2, barHeight + 4),
+ TQt::AlignHCenter | TQt::AlignVCenter | TQt::WordBreak,
text);
}
@@ -113,7 +113,7 @@ void StatusBarSpaceInfo::paintEvent(QPaintEvent* /* event */)
void StatusBarSpaceInfo::slotFoundMountPoint(const unsigned long& kBSize,
const unsigned long& /* kBUsed */,
const unsigned long& kBAvailable,
- const QString& /* mountPoint */)
+ const TQString& /* mountPoint */)
{
m_gettingSize = false;
m_kBSize = kBSize;
@@ -122,7 +122,7 @@ void StatusBarSpaceInfo::slotFoundMountPoint(const unsigned long& kBSize,
// Bypass a the issue (?) of KDiskFreeSp that for protocols like
// FTP, SMB the size of root partition is returned.
// TODO: check whether KDiskFreeSp is buggy or Dolphin uses it in a wrong way
- const QString protocol(m_url.protocol());
+ const TQString protocol(m_url.protocol());
if (!protocol.isEmpty() && (protocol != "file")) {
m_kBSize = 0;
m_kBAvailable = 0;
@@ -147,26 +147,26 @@ void StatusBarSpaceInfo::refresh()
m_kBSize = 0;
m_kBAvailable = 0;
- const QString mountPoint(KIO::findPathMountPoint(m_url.path()));
+ const TQString mountPoint(KIO::findPathMountPoint(m_url.path()));
- KDiskFreeSp* job = new KDiskFreeSp(this);
- connect(job, SIGNAL(foundMountPoint(const unsigned long&,
+ KDiskFreeSp* job = new KDiskFreeSp(TQT_TQOBJECT(this));
+ connect(job, TQT_SIGNAL(foundMountPoint(const unsigned long&,
const unsigned long&,
const unsigned long&,
- const QString& )),
- this, SLOT(slotFoundMountPoint(const unsigned long&,
+ const TQString& )),
+ this, TQT_SLOT(slotFoundMountPoint(const unsigned long&,
const unsigned long&,
const unsigned long&,
- const QString& )));
- connect(job, SIGNAL(done()),
- this, SLOT(slotDone()));
+ const TQString& )));
+ connect(job, TQT_SIGNAL(done()),
+ this, TQT_SLOT(slotDone()));
job->readDF(mountPoint);
}
-QColor StatusBarSpaceInfo::progressColor(const QColor& bgColor) const
+TQColor StatusBarSpaceInfo::progressColor(const TQColor& bgColor) const
{
- QColor color = KGlobalSettings::buttonBackground();
+ TQColor color = KGlobalSettings::buttonBackground();
// assure that enough contrast is given between the background color
// and the progressbar color
@@ -174,8 +174,8 @@ QColor StatusBarSpaceInfo::progressColor(const QColor& bgColor) const
int bgGreen = bgColor.green();
int bgBlue = bgColor.blue();
- const int backgrBrightness = qGray(bgRed, bgGreen, bgBlue);
- const int progressBrightness = qGray(color.red(), color.green(), color.blue());
+ const int backgrBrightness = tqGray(bgRed, bgGreen, bgBlue);
+ const int progressBrightness = tqGray(color.red(), color.green(), color.blue());
const int limit = 32;
const int diff = backgrBrightness - progressBrightness;
@@ -183,7 +183,7 @@ QColor StatusBarSpaceInfo::progressColor(const QColor& bgColor) const
((diff < 0) && (diff > -limit));
if (adjustColor) {
const int inc = (backgrBrightness < 2 * limit) ? (2 * limit) : -limit;
- color = QColor(bgRed + inc, bgGreen + inc, bgBlue + inc);
+ color = TQColor(bgRed + inc, bgGreen + inc, bgBlue + inc);
}
return color;