Changeset View
Changeset View
Standalone View
Standalone View
src/mainWindow.cpp
Show All 30 Lines | |||||
31 | #include "settingsDialog.h" | 31 | #include "settingsDialog.h" | ||
32 | #include "summaryWidget.h" | 32 | #include "summaryWidget.h" | ||
33 | 33 | | |||
34 | #include <cstdlib> //std::exit() | 34 | #include <cstdlib> //std::exit() | ||
35 | #include <iostream> | 35 | #include <iostream> | ||
36 | 36 | | |||
37 | #include <KActionCollection> | 37 | #include <KActionCollection> | ||
38 | #include <KConfigGroup> | 38 | #include <KConfigGroup> | ||
39 | #include <KCapacityBar> | ||||
39 | #include <KEditToolBar> //for editToolbar dialog | 40 | #include <KEditToolBar> //for editToolbar dialog | ||
40 | #include <KHistoryComboBox> | 41 | #include <KHistoryComboBox> | ||
41 | #include <KIO/Global> // upUrl | 42 | #include <KIO/Global> // upUrl | ||
42 | #include <KLocalizedString> | 43 | #include <KLocalizedString> | ||
43 | #include <KMessageBox> //::start() | 44 | #include <KMessageBox> //::start() | ||
44 | #include <KShell> | 45 | #include <KShell> | ||
45 | #include <KShortcutsDialog> | 46 | #include <KShortcutsDialog> | ||
46 | #include <KStandardAction> | 47 | #include <KStandardAction> | ||
47 | #include <KUrlCompletion> //locationbar | 48 | #include <KUrlCompletion> //locationbar | ||
48 | 49 | | |||
49 | #include <QApplication> //setupActions() | 50 | #include <QApplication> //setupActions() | ||
50 | #include <QDir> | 51 | #include <QDir> | ||
51 | #include <QFileDialog> | 52 | #include <QFileDialog> | ||
53 | #include <QLineEdit> | ||||
52 | #include <QScrollArea> | 54 | #include <QScrollArea> | ||
53 | #include <QStatusBar> | 55 | #include <QStatusBar> | ||
54 | #include <QLineEdit> | 56 | #include <QStorageInfo> | ||
55 | 57 | | |||
56 | namespace Filelight { | 58 | namespace Filelight { | ||
57 | 59 | | |||
58 | MainWindow::MainWindow() | 60 | MainWindow::MainWindow() | ||
59 | : KXmlGuiWindow() | 61 | : KXmlGuiWindow() | ||
60 | , m_histories(nullptr) | 62 | , m_histories(nullptr) | ||
61 | , m_summary(nullptr) | 63 | , m_summary(nullptr) | ||
62 | , m_map(nullptr) | 64 | , m_map(nullptr) | ||
Show All 19 Lines | 66 | { | |||
82 | m_map = new RadialMap::Widget(partWidget); | 84 | m_map = new RadialMap::Widget(partWidget); | ||
83 | m_layout->addWidget(m_map); | 85 | m_layout->addWidget(m_map); | ||
84 | 86 | | |||
85 | // FIXME: drop stupid nullptr argument | 87 | // FIXME: drop stupid nullptr argument | ||
86 | m_stateWidget = new ProgressBox(statusBar(), this, m_manager); | 88 | m_stateWidget = new ProgressBox(statusBar(), this, m_manager); | ||
87 | m_layout->addWidget(m_stateWidget); | 89 | m_layout->addWidget(m_stateWidget); | ||
88 | m_stateWidget->hide(); | 90 | m_stateWidget->hide(); | ||
89 | 91 | | |||
92 | m_capacity = new KCapacityBar(KCapacityBar::DrawTextInline, nullptr); | ||||
93 | statusBar()->addPermanentWidget(m_capacity); | ||||
94 | | ||||
90 | m_numberOfFiles = new QLabel(); | 95 | m_numberOfFiles = new QLabel(); | ||
91 | statusBar()->addPermanentWidget(m_numberOfFiles); | 96 | statusBar()->addPermanentWidget(m_numberOfFiles); | ||
92 | 97 | | |||
93 | KStandardAction::zoomIn(m_map, &RadialMap::Widget::zoomIn, actionCollection()); | 98 | KStandardAction::zoomIn(m_map, &RadialMap::Widget::zoomIn, actionCollection()); | ||
94 | KStandardAction::zoomOut(m_map, &RadialMap::Widget::zoomOut, actionCollection()); | 99 | KStandardAction::zoomOut(m_map, &RadialMap::Widget::zoomOut, actionCollection()); | ||
95 | KStandardAction::preferences(this, &MainWindow::configFilelight, actionCollection()); | 100 | KStandardAction::preferences(this, &MainWindow::configFilelight, actionCollection()); | ||
96 | 101 | | |||
97 | connect(m_map, &RadialMap::Widget::folderCreated, this, &MainWindow::completed); | 102 | connect(m_map, &RadialMap::Widget::folderCreated, this, &MainWindow::completed); | ||
▲ Show 20 Lines • Show All 429 Lines • ▼ Show 20 Line(s) | |||||
527 | { | 532 | { | ||
528 | //IMPORTANT -> url() has already been set | 533 | //IMPORTANT -> url() has already been set | ||
529 | 534 | | |||
530 | emit setWindowCaption(prettyUrl()); | 535 | emit setWindowCaption(prettyUrl()); | ||
531 | 536 | | |||
532 | const int fileCount = tree->children(); | 537 | const int fileCount = tree->children(); | ||
533 | const QString text = (fileCount == 0) ? | 538 | const QString text = (fileCount == 0) ? | ||
534 | i18n("No files.") : | 539 | i18n("No files.") : | ||
535 | i18np("1 file", "%1 files",fileCount); | 540 | i18np("1 file", "%1 Files",fileCount); | ||
meven: Don't change this, we use lowercase in this context (And you would need to change the singular… | |||||
536 | 541 | | |||
537 | m_numberOfFiles->setText(text); | 542 | m_numberOfFiles->setText(text); | ||
543 | | ||||
544 | QStorageInfo space = QStorageInfo::root(); | ||||
545 | | ||||
546 | if(space.isValid()) | ||||
meven: style: `if (space.isValid()) {` | |||||
547 | { | ||||
548 | qint64 m_spaceAvailable = space.bytesAvailable();; | ||||
549 | qint64 m_totalSpace = space.bytesTotal(); | ||||
550 | | ||||
551 | m_capacity->setText(KIO::convertSize(m_spaceAvailable)); | ||||
552 | int percentUsed = 100 - (m_spaceAvailable*100)/m_totalSpace; | ||||
553 | m_capacity->setValue(percentUsed); | ||||
554 | } | ||||
538 | } | 555 | } | ||
539 | 556 | | |||
540 | void MainWindow::showSummary() | 557 | void MainWindow::showSummary() | ||
541 | { | 558 | { | ||
542 | if (m_summary == nullptr) { | 559 | if (m_summary == nullptr) { | ||
543 | m_summary = new SummaryWidget(widget()); | 560 | m_summary = new SummaryWidget(widget()); | ||
544 | m_summary->setObjectName(QStringLiteral("summaryWidget")); | 561 | m_summary->setObjectName(QStringLiteral("summaryWidget")); | ||
545 | connect(m_summary, &SummaryWidget::activated, this, &MainWindow::openUrl); | 562 | connect(m_summary, &SummaryWidget::activated, this, &MainWindow::openUrl); | ||
546 | m_summary->show(); | 563 | m_summary->show(); | ||
547 | m_layout->addWidget(m_summary); | 564 | m_layout->addWidget(m_summary); | ||
548 | } | 565 | } | ||
549 | else m_summary->show(); | 566 | else m_summary->show(); | ||
550 | } | 567 | } | ||
551 | 568 | | |||
552 | } //namespace Filelight | 569 | } //namespace Filelight |
Don't change this, we use lowercase in this context (And you would need to change the singular case otherwise too).