diff --git a/plugins/fsview/CMakeLists.txt b/plugins/fsview/CMakeLists.txt --- a/plugins/fsview/CMakeLists.txt +++ b/plugins/fsview/CMakeLists.txt @@ -13,14 +13,20 @@ inode.cpp ) +ecm_qt_declare_logging_category(libfsview_SRCS + HEADER fsviewdebug.h + IDENTIFIER FSVIEWLOG + CATEGORY_NAME org.kde.fsview + EXPORT fsview + DESCRIPTION "Konqueror FileSizeView plugin") ########### next target ############### set(fsview_SRCS main.cpp ${libfsview_SRCS} ) add_executable(fsview ${fsview_SRCS}) -target_link_libraries(fsview KF5::KIOWidgets KF5::KDELibs4Support) +target_link_libraries(fsview KF5::KIOWidgets KF5::I18n KF5::IconThemes) install(TARGETS fsview ${KDE_INSTALL_TARGETS_DEFAULT_ARGS}) @@ -31,15 +37,17 @@ add_library(fsviewpart MODULE ${fsviewpart_PART_SRCS}) -target_link_libraries(fsviewpart KF5::Parts KF5::KDELibs4Support) +target_link_libraries(fsviewpart KF5::Parts KF5::IconThemes) -install(TARGETS fsviewpart DESTINATION ${KDE_INSTALL_PLUGINDIR} ) +install(TARGETS fsviewpart DESTINATION ${KDE_INSTALL_PLUGINDIR} ) ########### install files ############### install( FILES fsview_part.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR} ) -install( FILES fsview_part.rc DESTINATION ${KDE_INSTALL_DATADIR}/fsview ) +install( FILES fsview_part.rc DESTINATION ${KDE_INSTALL_KXMLGUI5DIR}/fsview ) + +ecm_qt_install_logging_categories(EXPORT fsview DESTINATION ${KDE_INSTALL_LOGGINGCATEGORIESDIR}) ecm_install_icons( ICONS 22-apps-fsview.png 32-apps-fsview.png DESTINATION ${KDE_INSTALL_ICONDIR} THEME hicolor ) diff --git a/plugins/fsview/fsview.cpp b/plugins/fsview/fsview.cpp --- a/plugins/fsview/fsview.cpp +++ b/plugins/fsview/fsview.cpp @@ -25,17 +25,19 @@ #include #include #include +#include #include #include -#include #include #include #include #include #include +#include "fsviewdebug.h" + // FSView QMap FSView::_dirMetric; @@ -128,7 +130,7 @@ return; } - //kDebug(90100) << "FSView::setPath " << p; + //qCDebug(FSVIEWLOG) << "FSView::setPath " << p; // stop any previous updating stop(); @@ -181,27 +183,27 @@ d = (*it).dirCount; if (0) { - kDebug(90100) << "getDirMetric " << k; + qCDebug(FSVIEWLOG) << "getDirMetric " << k; } if (0) { - kDebug(90100) << " - got size " << s << ", files " << f; + qCDebug(FSVIEWLOG) << " - got size " << s << ", files " << f; } return true; } void FSView::setDirMetric(const QString &k, double s, unsigned int f, unsigned int d) { - if (0) kDebug(90100) << "setDirMetric '" << k << "': size " - << s << ", files " << f << ", dirs " << d << endl; + if (0) qCDebug(FSVIEWLOG) << "setDirMetric '" << k << "': size " + << s << ", files " << f << ", dirs " << d << endl; _dirMetric.insert(k, MetricEntry(s, f, d)); } void FSView::requestUpdate(Inode *i) { - if (0) kDebug(90100) << "FSView::requestUpdate(" << i->path() - << ")" << endl; + if (0) qCDebug(FSVIEWLOG) << "FSView::requestUpdate(" << i->path() + << ")" << endl; ScanDir *peer = i->dirPeer(); if (!peer) { @@ -276,10 +278,10 @@ _lastDir = d; _dirsFinished++; - if (0) kDebug(90100) << "FSFiew::scanFinished: " << d->path() - << ", Data " << data - << ", Progress " << _progress << "/" - << _progressSize << endl; + if (0) qCDebug(FSVIEWLOG) << "FSFiew::scanFinished: " << d->path() + << ", Data " << data + << ", Progress " << _progress << "/" + << _progressSize << endl; } void FSView::selected(TreeMapItem *i) @@ -490,17 +492,17 @@ if ((_progress > 0) && (_progressSize > 0) && _lastDir) { int percent = _progress * 100 / _progressSize; - if (0) kDebug(90100) << "FSView::progress " - << _progress << "/" << _progressSize - << "= " << percent << "%, " - << _dirsFinished << " dirs read, in " - << _lastDir->path() << endl; + if (0) qCDebug(FSVIEWLOG) << "FSView::progress " + << _progress << "/" << _progressSize + << "= " << percent << "%, " + << _dirsFinished << " dirs read, in " + << _lastDir->path() << endl; emit progress(percent, _dirsFinished, _lastDir->path()); } if (_allowRefresh && ((redrawCounter % 4) == 0)) { if (0) { - kDebug(90100) << "doRedraw " << _sm.scanLength(); + qCDebug(FSVIEWLOG) << "doRedraw " << _sm.scanLength(); } redraw(); } else { @@ -526,7 +528,7 @@ _progressSize = 3 * _chunkSize1; if (1) { - kDebug(90100) << "Phase 2: CSize " << _chunkSize1; + qCDebug(FSVIEWLOG) << "Phase 2: CSize " << _chunkSize1; } } break; @@ -550,10 +552,10 @@ /* Go to maximally 66% by scaling with 1.5 */ _progressSize = _progressSize * 3 / 2; - if (1) kDebug(90100) << "Phase 3: CSize " << _chunkSize2 - << ", Todo " << todo - << ", Progress " << _progress - << "/" << _progressSize << endl; + if (1) qCDebug(FSVIEWLOG) << "Phase 3: CSize " << _chunkSize2 + << ", Todo " << todo + << ", Progress " << _progress + << "/" << _progressSize << endl; } break; @@ -570,10 +572,10 @@ _progressSize = (int)((double)todo / (1.0 - percent) + .5); _progress = _progressSize - todo; - if (1) kDebug(90100) << "Phase 4: CSize " << _chunkSize3 - << ", Todo " << todo - << ", Progress " << _progress - << "/" << _progressSize << endl; + if (1) qCDebug(FSVIEWLOG) << "Phase 4: CSize " << _chunkSize3 + << ", Todo " << todo + << ", Progress " << _progress + << "/" << _progressSize << endl; } default: diff --git a/plugins/fsview/fsview_part.h b/plugins/fsview/fsview_part.h --- a/plugins/fsview/fsview_part.h +++ b/plugins/fsview/fsview_part.h @@ -53,10 +53,13 @@ { copySelection(true); } - void trash(Qt::MouseButtons, Qt::KeyboardModifiers modifiers); + void trash(); void del(); void editMimeType(); + void itemSingleClicked(TreeMapItem *i); + void itemDoubleClicked(TreeMapItem *i); + private: void copySelection(bool move); @@ -110,7 +113,6 @@ void slotShowAreaMenu(); void slotShowDepthMenu(); void slotShowColorMenu(); - void slotSettingsChanged(int); void slotProperties(); protected: diff --git a/plugins/fsview/fsview_part.cpp b/plugins/fsview/fsview_part.cpp --- a/plugins/fsview/fsview_part.cpp +++ b/plugins/fsview/fsview_part.cpp @@ -32,7 +32,6 @@ #include #include -#include #include #include #include @@ -46,14 +45,16 @@ #include #include #include +#include #include -#include - +#include #include #include #include +#include "fsviewdebug.h" + K_PLUGIN_FACTORY(FSViewPartFactory, registerPlugin();) // FSJob, for progress @@ -147,9 +148,13 @@ QObject::connect(_colorMenu->menu(), SIGNAL(aboutToShow()), SLOT(slotShowColorMenu())); - slotSettingsChanged(KGlobalSettings::SETTINGS_MOUSE); - connect(KGlobalSettings::self(), SIGNAL(settingsChanged(int)), - SLOT(slotSettingsChanged(int))); + // Both of these click signals are connected. Whether a single or + // double click activates an item is checked against the current + // style setting when the click happens. + QObject::connect(_view, SIGNAL(clicked(TreeMapItem*)), + _ext, SLOT(itemSingleClicked(TreeMapItem*))); + QObject::connect(_view, SIGNAL(doubleClicked(TreeMapItem*)), + _ext, SLOT(itemDoubleClicked(TreeMapItem*))); QObject::connect(_view, SIGNAL(returnPressed(TreeMapItem*)), _ext, SLOT(selected(TreeMapItem*))); @@ -177,8 +182,7 @@ moveToTrashAction->setText(i18nc("@action:inmenu File", "Move to Trash")); moveToTrashAction->setIcon(QIcon::fromTheme(QStringLiteral("user-trash"))); actionCollection()->setDefaultShortcut(moveToTrashAction, QKeySequence(QKeySequence::Delete)); - connect(moveToTrashAction, SIGNAL(triggered(Qt::MouseButtons,Qt::KeyboardModifiers)), - _ext, SLOT(trash(Qt::MouseButtons,Qt::KeyboardModifiers))); + connect(moveToTrashAction, SIGNAL(triggered()), _ext, SLOT(trash())); QAction *deleteAction = actionCollection()->addAction(QStringLiteral("delete")); deleteAction->setIcon(QIcon::fromTheme(QStringLiteral("edit-delete"))); @@ -205,31 +209,12 @@ FSViewPart::~FSViewPart() { - kDebug(90100) << "FSViewPart Destructor"; + qCDebug(FSVIEWLOG); delete _job; _view->saveFSOptions(); } -void FSViewPart::slotSettingsChanged(int category) -{ - if (category != KGlobalSettings::SETTINGS_MOUSE) { - return; - } - - QObject::disconnect(_view, SIGNAL(clicked(TreeMapItem*)), - _ext, SLOT(selected(TreeMapItem*))); - QObject::disconnect(_view, SIGNAL(doubleClicked(TreeMapItem*)), - _ext, SLOT(selected(TreeMapItem*))); - - if (_view->style()->styleHint(QStyle::SH_ItemView_ActivateItemOnSingleClick)) - QObject::connect(_view, SIGNAL(clicked(TreeMapItem*)), - _ext, SLOT(selected(TreeMapItem*))); - else - QObject::connect(_view, SIGNAL(doubleClicked(TreeMapItem*)), - _ext, SLOT(selected(TreeMapItem*))); -} - void FSViewPart::showInfo() { QString info; @@ -262,7 +247,7 @@ _job = nullptr; } - KConfigGroup cconfig(_view->config(), "MetricCache"); + KConfigGroup cconfig = _view->config()->group("MetricCache"); _view->saveMetric(&cconfig); emit completed(); @@ -294,15 +279,15 @@ bool FSViewPart::openFile() // never called since openUrl is reimplemented { - kDebug(90100) << "FSViewPart::openFile " << localFilePath(); + qCDebug(FSVIEWLOG) << localFilePath(); _view->setPath(localFilePath()); return true; } bool FSViewPart::openUrl(const QUrl &url) { - kDebug(90100) << "FSViewPart::openUrl " << url.path(); + qCDebug(FSVIEWLOG) << url.path(); if (!url.isValid()) { return false; @@ -321,7 +306,7 @@ bool FSViewPart::closeUrl() { - kDebug(90100) << "FSViewPart::closeUrl "; + qCDebug(FSVIEWLOG); _view->stop(); @@ -369,7 +354,7 @@ stateChanged(QStringLiteral("has_no_selection")); } - kDebug(90100) << "FSViewPart::updateActions, deletable " << canDel; + qCDebug(FSVIEWLOG) << "deletable" << canDel; } void FSViewPart::contextMenu(TreeMapItem * /*item*/, const QPoint &p) @@ -476,9 +461,9 @@ } } -void FSViewBrowserExtension::trash(Qt::MouseButtons, Qt::KeyboardModifiers modifiers) +void FSViewBrowserExtension::trash() { - bool deleteNotTrash = ((modifiers & Qt::ShiftModifier) != 0); + bool deleteNotTrash = ((QGuiApplication::keyboardModifiers() & Qt::ShiftModifier) != 0); if (deleteNotTrash) { del(); } else { @@ -530,12 +515,27 @@ } } - kDebug(90100) << "FSViewPart::refreshing " - << ((Inode *)commonParent)->path() << endl; + qCDebug(FSVIEWLOG) << "refreshing" + << ((Inode *)commonParent)->path() << endl; _view->requestUpdate((Inode *)commonParent); } +void FSViewBrowserExtension::itemSingleClicked(TreeMapItem *i) +{ + if (_view->style()->styleHint(QStyle::SH_ItemView_ActivateItemOnSingleClick)) { + selected(i); + } +} + + +void FSViewBrowserExtension::itemDoubleClicked(TreeMapItem *i) +{ + if (!_view->style()->styleHint(QStyle::SH_ItemView_ActivateItemOnSingleClick)) { + selected(i); + } +} + void FSViewBrowserExtension::selected(TreeMapItem *i) { if (!i) { diff --git a/plugins/fsview/inode.cpp b/plugins/fsview/inode.cpp --- a/plugins/fsview/inode.cpp +++ b/plugins/fsview/inode.cpp @@ -21,14 +21,16 @@ */ #include "inode.h" -#include -#include + #include #include + #include #include + #include "scan.h" #include "fsview.h" +#include "fsviewdebug.h" // Inode @@ -74,8 +76,8 @@ Inode::~Inode() { - if (0) kDebug(90100) << "~Inode [" << path() - << "]" << endl; + if (0) qCDebug(FSVIEWLOG) << "~Inode [" << path() + << "]" << endl; /* reset Listener of old Peer */ if (_dirPeer) { @@ -108,8 +110,8 @@ void Inode::init(const QString &path) { - if (0) kDebug(90100) << "Inode::init [" << path - << "]" << endl; + if (0) qCDebug(FSVIEWLOG) << "Inode::init [" << path + << "]" << endl; _info = QFileInfo(path); @@ -143,16 +145,16 @@ /* ScanListener interface */ void Inode::sizeChanged(ScanDir *d) { - if (0) kDebug(90100) << "Inode::sizeChanged [" << path() << "] in " - << d->name() << ": size " << d->size() << endl; + if (0) qCDebug(FSVIEWLOG) << "Inode::sizeChanged [" << path() << "] in " + << d->name() << ": size " << d->size() << endl; _resortNeeded = true; } void Inode::scanFinished(ScanDir *d) { - if (0) kDebug(90100) << "Inode::scanFinished [" << path() << "] in " - << d->name() << ": size " << d->size() << endl; + if (0) qCDebug(FSVIEWLOG) << "Inode::scanFinished [" << path() << "] in " + << d->name() << ": size " << d->size() << endl; _resortNeeded = true; @@ -350,27 +352,7 @@ return name; } if (i == 1) { - QString text; - double s = size(); - - if (s < 1000) { - text = QStringLiteral("%1 B").arg((int)(s + .5)); - } else if (s < 10 * 1024) { - text = QStringLiteral("%1 kB").arg(KGlobal::locale()->formatNumber(s / 1024 + .005, 2)); - } else if (s < 100 * 1024) { - text = QStringLiteral("%1 kB").arg(KGlobal::locale()->formatNumber(s / 1024 + .05, 1)); - } else if (s < 1000 * 1024) { - text = QStringLiteral("%1 kB").arg((int)(s / 1024 + .5)); - } else if (s < 10 * 1024 * 1024) { - text = QStringLiteral("%1 MB").arg(KGlobal::locale()->formatNumber(s / 1024 / 1024 + .005, 2)); - } else if (s < 100 * 1024 * 1024) { - text = QStringLiteral("%1 MB").arg(KGlobal::locale()->formatNumber(s / 1024 / 1024 + .05, 1)); - } else if (s < 1000 * 1024 * 1024) { - text = QStringLiteral("%1 MB").arg((int)(s / 1024 / 1024 + .5)); - } else { - text = QStringLiteral("%1 GB").arg(KGlobal::locale()->formatNumber(s / 1024 / 1024 / 1024 + .005, 2)); - } - + QString text = KIO::convertSize(static_cast(size()+0.5)); if (_sizeEstimation > 0) { text += '+'; } diff --git a/plugins/fsview/scan.cpp b/plugins/fsview/scan.cpp --- a/plugins/fsview/scan.cpp +++ b/plugins/fsview/scan.cpp @@ -23,11 +23,11 @@ #include #include -#include #include #include #include "inode.h" +#include "fsviewdebug.h" // ScanManager @@ -104,8 +104,8 @@ return; } - if (0) kDebug(90100) << "ScanManager::stopScan, scanLength " - << _list.count() << endl; + if (0) qCDebug(FSVIEWLOG) << "ScanManager::stopScan, scanLength " + << _list.count() << endl; while (!_list.isEmpty()) { ScanItem *si = _list.takeFirst(); @@ -336,8 +336,8 @@ _dirsFinished++; callSizeChanged(); - if (0) kDebug(90100) << "ScanDir::subScanFinished [" << path() - << "]: " << _dirsFinished << "/" << _dirs.count() << endl; + if (0) qCDebug(FSVIEWLOG) << "ScanDir::subScanFinished [" << path() + << "]: " << _dirsFinished << "/" << _dirs.count() << endl; if (_dirsFinished < _dirs.count()) { return; @@ -386,8 +386,8 @@ void ScanDir::callScanStarted() { - if (0) kDebug(90100) << "ScanDir:Started [" << path() - << "]: size " << size() << ", files " << fileCount() << endl; + if (0) qCDebug(FSVIEWLOG) << "ScanDir:Started [" << path() + << "]: size " << size() << ", files " << fileCount() << endl; ScanListener *mListener = _manager ? _manager->listener() : nullptr; @@ -401,8 +401,8 @@ void ScanDir::callSizeChanged() { - if (0) kDebug(90100) << ". [" << path() - << "]: size " << size() << ", files " << fileCount() << endl; + if (0) qCDebug(FSVIEWLOG) << ". [" << path() + << "]: size " << size() << ", files " << fileCount() << endl; _dirty = true; @@ -422,8 +422,8 @@ void ScanDir::callScanFinished() { - if (0) kDebug(90100) << "ScanDir:Finished [" << path() - << "]: size " << size() << ", files " << fileCount() << endl; + if (0) qCDebug(FSVIEWLOG) << "ScanDir:Finished [" << path() + << "]: size " << size() << ", files " << fileCount() << endl; ScanListener *mListener = _manager ? _manager->listener() : nullptr; diff --git a/plugins/fsview/tests/CMakeLists.txt b/plugins/fsview/tests/CMakeLists.txt --- a/plugins/fsview/tests/CMakeLists.txt +++ b/plugins/fsview/tests/CMakeLists.txt @@ -1,23 +1,24 @@ -set( EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR} ) +include (ECMMarkAsTest) +set( EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR} ) include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/.. ) +include_directories( ${CMAKE_CURRENT_BINARY_DIR}/.. ) ########### next target ############### set(libfsview_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/../treemap.cpp ${CMAKE_CURRENT_SOURCE_DIR}/../fsview.cpp ${CMAKE_CURRENT_SOURCE_DIR}/../scan.cpp ${CMAKE_CURRENT_SOURCE_DIR}/../inode.cpp + ${CMAKE_CURRENT_BINARY_DIR}/../fsviewdebug.cpp ) set(scantest_SRCS scantest.cpp ${libfsview_SRCS}) add_executable(scantest ${scantest_SRCS}) ecm_mark_as_test(scantest) -target_link_libraries(scantest KF5::KIOCore KF5::KDELibs4Support Qt5::Widgets) - - +target_link_libraries(scantest KF5::KIOCore KF5::IconThemes KF5::I18n KF5::WidgetsAddons Qt5::Widgets) diff --git a/plugins/fsview/tests/scantest.cpp b/plugins/fsview/tests/scantest.cpp --- a/plugins/fsview/tests/scantest.cpp +++ b/plugins/fsview/tests/scantest.cpp @@ -20,6 +20,8 @@ #include +#include + #include "scan.h" class MyListener: public ScanListener @@ -32,7 +34,7 @@ void sizeChanged(ScanDir *d) override { - printf("Change in %s: Dirs %d, Files %d", + printf("Change in %s: Dirs %d, Files %d ", qPrintable(d->name()), d->dirCount(), d->fileCount()); printf("Size %llu\n", (unsigned long long int)d->size()); @@ -46,6 +48,8 @@ int main(int argc, char *argv[]) { + QApplication app(argc, argv); + ScanManager m(QStringLiteral("/opt")); if (argc > 1) { m.setTop(argv[1]); diff --git a/plugins/fsview/treemap.cpp b/plugins/fsview/treemap.cpp --- a/plugins/fsview/treemap.cpp +++ b/plugins/fsview/treemap.cpp @@ -42,9 +42,10 @@ #include #include -#include #include +#include "fsviewdebug.h" + // set this to 1 to enable debug output #define DEBUG_DRAWING 0 #define MAX_FIELD 12 @@ -386,7 +387,7 @@ // does full text fit? breakPos = text.length(); - usedWidth = fm->width(text); + usedWidth = fm->horizontalAdvance(text); if (usedWidth < maxWidth) { return usedWidth; } @@ -396,7 +397,7 @@ int bottomPos = 0; while (qAbs(maxWidth - usedWidth) > 3 * fm->maxWidth()) { int halfPos = (bottomPos + breakPos) / 2; - int halfWidth = fm->width(text, halfPos); + int halfWidth = fm->horizontalAdvance(text, halfPos); if (halfWidth < maxWidth) { bottomPos = halfPos; } else { @@ -427,7 +428,7 @@ lastCat = cat; breakPos = pos; - usedWidth = fm->width(text, breakPos); + usedWidth = fm->horizontalAdvance(text, breakPos); if (usedWidth < maxWidth) { break; } @@ -448,7 +449,7 @@ // does full text fit? breakPos = 0; - usedWidth = fm->width(text); + usedWidth = fm->horizontalAdvance(text); if (usedWidth < maxWidth) { return usedWidth; } @@ -458,7 +459,7 @@ int topPos = text.length(); while (qAbs(maxWidth - usedWidth) > 3 * fm->maxWidth()) { int halfPos = (breakPos + topPos) / 2; - int halfWidth = fm->width(text.mid(halfPos)); + int halfWidth = fm->horizontalAdvance(text.mid(halfPos)); if (halfWidth < maxWidth) { breakPos = halfPos; usedWidth = halfWidth; @@ -489,7 +490,7 @@ lastCat = cat; breakPos = pos; - usedWidth = fm->width(text.mid(breakPos)); + usedWidth = fm->horizontalAdvance(text.mid(breakPos)); if (usedWidth < maxWidth) { break; } @@ -510,8 +511,8 @@ QRect r = _rect; - if (0) kDebug(90100) << "DrawField: Rect " << r.x() << "/" << r.y() - << " - " << r.width() << "x" << r.height() << endl; + if (0) qCDebug(FSVIEWLOG) << "Rect " << r.x() << "/" << r.y() + << " - " << r.width() << "x" << r.height() << endl; int h = _fontHeight; bool rotate = dp->rotated(); @@ -659,7 +660,7 @@ // stop as soon as possible when there is no space for "..." static int dotW = 0; if (!dotW) { - dotW = _fm->width(QStringLiteral("...")); + dotW = _fm->horizontalAdvance(QStringLiteral("...")); } if (width < dotW) { return false; @@ -689,10 +690,10 @@ } // width of text and pixmap to be drawn - int w = pixW + _fm->width(name); + int w = pixW + _fm->horizontalAdvance(name); - if (0) kDebug(90100) << " For '" << name << "': Unused " << unused - << ", StrW " << w << ", Width " << width << endl; + if (0) qCDebug(FSVIEWLOG) << " For '" << name << "': Unused " << unused + << ", StrW " << w << ", Width " << width << endl; // if we have limited space at 1st line: // use it only if whole name does fit in last line... @@ -773,7 +774,7 @@ /* truncate and add ... if needed */ if (w > width) { name = _fm->elidedText(name, Qt::ElideRight, width - pixW); - w = _fm->width(name) + pixW; + w = _fm->horizontalAdvance(name) + pixW; } int x = 0; @@ -796,8 +797,8 @@ pixDrawn = true; } - if (0) kDebug(90100) << " Drawing '" << name << "' at " - << x + pixW << "/" << y << endl; + if (0) qCDebug(FSVIEWLOG) << " Drawing '" << name << "' at " + << x + pixW << "/" << y << endl; p->drawText(x + pixW, y, width - pixW, h, @@ -809,7 +810,7 @@ break; } name = remaining; - w = pixW + _fm->width(name); + w = pixW + _fm->horizontalAdvance(name); } // make sure the pix stays visible @@ -1215,9 +1216,9 @@ return; } - if (0) kDebug(90100) << "addFree(" << path(0).join(QStringLiteral("/")) << ", " - << r.x() << "/" << r.y() << "-" - << r.width() << "x" << r.height() << ")" << endl; + if (0) qCDebug(FSVIEWLOG) << "addFree(" << path(0).join(QStringLiteral("/")) << ", " + << r.x() << "/" << r.y() << "-" + << r.width() << "x" << r.height() << ")" << endl; if (_freeRects.isEmpty()) { _freeRects.append(r); @@ -1245,9 +1246,9 @@ return; } - if (0) kDebug(90100) << " united with last to (" - << last.x() << "/" << last.y() << "-" - << last.width() << "x" << last.height() << ")" << endl; + if (0) qCDebug(FSVIEWLOG) << " united with last to (" + << last.x() << "/" << last.y() << "-" + << last.width() << "x" << last.height() << ")" << endl; } // TreeMapWidget @@ -1724,7 +1725,7 @@ return nullptr; } if (DEBUG_DRAWING) { - kDebug(90100) << "item(" << x << "," << y << "):"; + qCDebug(FSVIEWLOG) << "item(" << x << "," << y << "):"; } TreeMapItem *p = _base; @@ -1738,15 +1739,15 @@ i = list->at(idx); if (DEBUG_DRAWING) - kDebug(90100) << " Checking " << i->path(0).join(QStringLiteral("/")) << " (" - << i->itemRect().x() << "/" << i->itemRect().y() - << "-" << i->itemRect().width() - << "x" << i->itemRect().height() << ")" << endl; + qCDebug(FSVIEWLOG) << " Checking " << i->path(0).join(QStringLiteral("/")) << " (" + << i->itemRect().x() << "/" << i->itemRect().y() + << "-" << i->itemRect().width() + << "x" << i->itemRect().height() << ")" << endl; if (i->itemRect().contains(x, y)) { if (DEBUG_DRAWING) { - kDebug(90100) << " .. Got. Index " << idx; + qCDebug(FSVIEWLOG) << " .. Got. Index " << idx; } p->setIndex(idx); @@ -1764,10 +1765,10 @@ last = p; if (DEBUG_DRAWING) - kDebug(90100) << "item(" << x << "," << y << "): Got " - << p->path(0).join(QStringLiteral("/")) << " (Size " - << p->itemRect().width() << "x" << p->itemRect().height() - << ", Val " << p->value() << ")" << endl; + qCDebug(FSVIEWLOG) << "item(" << x << "," << y << "): Got " + << p->path(0).join(QStringLiteral("/")) << " (Size " + << p->itemRect().width() << "x" << p->itemRect().height() + << ", Val " << p->value() << ")" << endl; } return p; @@ -1833,10 +1834,10 @@ emit selectionChanged(); redraw(changed); - if (0) kDebug(90100) << (selected ? "S" : "Des") << "elected Item " - << (item ? item->path(0).join(QLatin1String("")) : QStringLiteral("(null)")) - << " (depth " << (item ? item->depth() : -1) - << ")" << endl; + if (0) qCDebug(FSVIEWLOG) << (selected ? "S" : "Des") << "elected Item " + << (item ? item->path(0).join(QLatin1String("")) : QStringLiteral("(null)")) + << " (depth " << (item ? item->depth() : -1) + << ")" << endl; } void TreeMapWidget::setMarked(int markNo, bool redrawWidget) @@ -1952,8 +1953,8 @@ // remove mark _markNo = 0; - if (1) kDebug(90100) << "setCurrent(" << i->path(0).join(QStringLiteral("/")) - << ") - mark removed" << endl; + if (1) qCDebug(FSVIEWLOG) << "setCurrent(" << i->path(0).join(QStringLiteral("/")) + << ") - mark removed" << endl; // always complete redraw needed to remove mark redraw(); @@ -1974,7 +1975,7 @@ } } - //kDebug(90100) << "Current Item " << (i ? i->path().ascii() : "(null)"); + //qCDebug(FSVIEWLOG) << "Current Item " << (i ? i->path().ascii() : "(null)"); emit currentChanged(i, kbd); } @@ -2059,7 +2060,7 @@ void TreeMapWidget::contextMenuEvent(QContextMenuEvent *e) { - //kDebug(90100) << "TreeMapWidget::contextMenuEvent"; + //qCDebug(FSVIEWLOG) << "TreeMapWidget::contextMenuEvent"; if (receivers(SIGNAL(contextMenuRequested(TreeMapItem*,QPoint)))) { e->accept(); @@ -2077,7 +2078,7 @@ void TreeMapWidget::mousePressEvent(QMouseEvent *e) { - //kDebug(90100) << "TreeMapWidget::mousePressEvent"; + //qCDebug(FSVIEWLOG) << "TreeMapWidget::mousePressEvent"; _oldCurrent = _current; @@ -2148,7 +2149,7 @@ void TreeMapWidget::mouseMoveEvent(QMouseEvent *e) { - //kDebug(90100) << "TreeMapWidget::mouseMoveEvent"; + //qCDebug(FSVIEWLOG) << "TreeMapWidget::mouseMoveEvent"; if (!_pressed) { return; @@ -2196,7 +2197,7 @@ void TreeMapWidget::mouseReleaseEvent(QMouseEvent *) { - //kDebug(90100) << "TreeMapWidget::mouseReleaseEvent"; + //qCDebug(FSVIEWLOG) << "TreeMapWidget::mouseReleaseEvent"; if (!_pressed) { return; @@ -2454,7 +2455,7 @@ if (_needsRefresh) { if (DEBUG_DRAWING) { - kDebug(90100) << "Redrawing " << _needsRefresh->path(0).join(QStringLiteral("/")); + qCDebug(FSVIEWLOG) << "Redrawing " << _needsRefresh->path(0).join(QStringLiteral("/")); } if (_needsRefresh == _base) { @@ -2573,11 +2574,11 @@ TreeMapItem *item) { if (DEBUG_DRAWING) - kDebug(90100) << "+drawItems(" << item->path(0).join(QStringLiteral("/")) << ", " - << item->itemRect().x() << "/" << item->itemRect().y() - << "-" << item->itemRect().width() << "x" - << item->itemRect().height() << "), Val " << item->value() - << ", Sum " << item->sum() << endl; + qCDebug(FSVIEWLOG) << "+drawItems(" << item->path(0).join(QStringLiteral("/")) << ", " + << item->itemRect().x() << "/" << item->itemRect().y() + << "-" << item->itemRect().width() << "x" + << item->itemRect().height() << "), Val " << item->value() + << ", Sum " << item->sum() << endl; drawItem(p, item); item->clearFreeRects(); @@ -2653,7 +2654,7 @@ r = d.remainingRect(item); if (DEBUG_DRAWING) { - kDebug(90100) << "-drawItems(" << item->path(0).join(QStringLiteral("/")) << ")"; + qCDebug(FSVIEWLOG) << "-drawItems(" << item->path(0).join(QStringLiteral("/")) << ")"; } return; } @@ -2668,8 +2669,8 @@ foreach (TreeMapItem *i, *list) { child_sum += i->value(); if (DEBUG_DRAWING) - kDebug(90100) << " child: " << i->text(0) << ", value " - << i->value() << endl; + qCDebug(FSVIEWLOG) << " child: " << i->text(0) << ", value " + << i->value() << endl; } QRect orig = r; @@ -2709,7 +2710,7 @@ self = user_sum - child_sum; if (user_sum < child_sum) { - //kDebug(90100) << "TreeMWidget " << + //qCDebug(FSVIEWLOG) << "TreeMWidget " << // item->path() << ": User sum " << user_sum << " < Child Items sum " << child_sum << endl; // invalid user supplied sum: ignore and use calculate sum @@ -2754,10 +2755,10 @@ // set selfRect (not occupied by children) for tooltip item->addFreeRect(sr); - if (0) kDebug(90100) << "Item " << item->path(0).join(QStringLiteral("/")) << ": SelfR " - << sr.x() << "/" << sr.y() << "-" << sr.width() - << "/" << sr.height() << ", self " << self << "/" - << user_sum << endl; + if (0) qCDebug(FSVIEWLOG) << "Item " << item->path(0).join(QStringLiteral("/")) << ": SelfR " + << sr.x() << "/" << sr.y() << "-" << sr.width() + << "/" << sr.height() << ", self " << self << "/" + << user_sum << endl; if ((sr.height() >= _fontHeight) && (sr.width() >= _fontHeight)) { @@ -2896,7 +2897,7 @@ } if (DEBUG_DRAWING) { - kDebug(90100) << "-drawItems(" << item->path(0).join(QStringLiteral("/")) << ")"; + qCDebug(FSVIEWLOG) << "-drawItems(" << item->path(0).join(QStringLiteral("/")) << ")"; } } @@ -2914,9 +2915,9 @@ TreeMapItemList *list, int idx, int len, bool goBack) { if (DEBUG_DRAWING) - kDebug(90100) << " +drawFill(" << r.x() << "/" << r.y() - << "-" << r.width() << "x" << r.height() - << ", len " << len << ")" << endl; + qCDebug(FSVIEWLOG) << " +drawFill(" << r.x() << "/" << r.y() + << "-" << r.width() << "x" << r.height() + << ", len " << len << ")" << endl; p->setBrush(Qt::Dense4Pattern); p->setPen(Qt::NoPen); @@ -2927,7 +2928,7 @@ while (len > 0 && (i = list->value(idx))) { if (DEBUG_DRAWING) { - kDebug(90100) << " Reset Rect " << i->path(0).join(QStringLiteral("/")); + qCDebug(FSVIEWLOG) << " Reset Rect " << i->path(0).join(QStringLiteral("/")); } i->clearItemRect(); @@ -2939,9 +2940,9 @@ len--; } if (DEBUG_DRAWING) - kDebug(90100) << " -drawFill(" << r.x() << "/" << r.y() - << "-" << r.width() << "x" << r.height() - << ", len " << len << ")" << endl; + qCDebug(FSVIEWLOG) << " -drawFill(" << r.x() << "/" << r.y() + << "-" << r.width() << "x" << r.height() + << ", len " << len << ")" << endl; } // returns false if rect gets to small @@ -2967,9 +2968,9 @@ } if (DEBUG_DRAWING) - kDebug(90100) << " +drawItemArray(" << item->path(0).join(QStringLiteral("/")) - << ", " << r.x() << "/" << r.y() << "-" << r.width() - << "x" << r.height() << ")" << endl; + qCDebug(FSVIEWLOG) << " +drawItemArray(" << item->path(0).join(QStringLiteral("/")) + << ", " << r.x() << "/" << r.y() << "-" << r.width() + << "x" << r.height() << ")" << endl; if (len > 2 && (item->splitMode() == TreeMapItem::Bisection)) { @@ -3019,8 +3020,8 @@ } if (DEBUG_DRAWING) - kDebug(90100) << " -drawItemArray(" << item->path(0).join(QStringLiteral("/")) - << ")" << endl; + qCDebug(FSVIEWLOG) << " -drawItemArray(" << item->path(0).join(QStringLiteral("/")) + << ")" << endl; return drawOn; } @@ -3034,7 +3035,7 @@ if (user_sum <= 0) { if (DEBUG_DRAWING) { - kDebug(90100) << "drawItemArray: Reset " << i->path(0).join(QStringLiteral("/")); + qCDebug(FSVIEWLOG) << "drawItemArray: Reset " << i->path(0).join(QStringLiteral("/")); } i->clearItemRect(); @@ -3055,8 +3056,8 @@ drawFill(item, p, fullRect, list, idx, len, goBack); if (DEBUG_DRAWING) - kDebug(90100) << " -drawItemArray(" << item->path(0).join(QStringLiteral("/")) - << "): Stop" << endl; + qCDebug(FSVIEWLOG) << " -drawItemArray(" << item->path(0).join(QStringLiteral("/")) + << "): Stop" << endl; return false; } @@ -3074,8 +3075,8 @@ if ((item->sorting(nullptr) != -1) && (nextPos < _visibleWidth)) { drawFill(item, p, fullRect, list, idx, len, goBack); if (DEBUG_DRAWING) - kDebug(90100) << " -drawItemArray(" << item->path(0).join(QStringLiteral("/")) - << "): Stop" << endl; + qCDebug(FSVIEWLOG) << " -drawItemArray(" << item->path(0).join(QStringLiteral("/")) + << "): Stop" << endl; return false; } @@ -3137,8 +3138,8 @@ } if (DEBUG_DRAWING) - kDebug(90100) << " -drawItemArray(" << item->path(0).join(QStringLiteral("/")) - << "): Continue" << endl; + qCDebug(FSVIEWLOG) << " -drawItemArray(" << item->path(0).join(QStringLiteral("/")) + << "): Continue" << endl; return true; }