edisionnano / QDiskInfo

QDiskInfo is a frontend for smartctl (part of the smartmontools package). It provides a user experience similar to CrystalDiskInfo. It shows the SMART (Self-Monitoring, Analysis, and Reporting Technology) data of modern hard disk drives.
GNU General Public License v3.0
102 stars 9 forks source link

gui doesn't scale correctly for large number of disks #9

Closed sgmihai closed 2 months ago

sgmihai commented 2 months ago

https://i.imgur.com/okYyZrk.png

edisionnano commented 2 months ago

I have a patch that fixes this if you want to give it a try

diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index 2f2ef45..bb0f574 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -13,7 +13,10 @@ MainWindow::MainWindow(QWidget *parent)
     buttonGroup = new QButtonGroup(this);
     buttonGroup->setExclusive(true);

-    horizontalLayout = ui->horizontalLayout;
+    QWidget *containerWidget = ui->scrollAreaWidgetContents;
+    horizontalLayout = new QHBoxLayout(containerWidget);
+    horizontalLayout->setContentsMargins(0, 0, 0, 0);
+    ui->scrollArea->setWidget(containerWidget);

     diskName = qobject_cast<QLabel *>(ui->centralwidget->findChild<QLabel*>("diskName"));
     temperatureValue = qobject_cast<QLabel *>(ui->centralwidget->findChild<QLabel*>("temperatureValueLabel"));
diff --git a/src/mainwindow.ui b/src/mainwindow.ui
index 8ae5160..46219de 100644
--- a/src/mainwindow.ui
+++ b/src/mainwindow.ui
@@ -33,7 +33,36 @@
       <item row="0" column="0">
        <layout class="QHBoxLayout" name="disks">
         <item>
-         <layout class="QHBoxLayout" name="horizontalLayout"/>
+         <widget class="QScrollArea" name="scrollArea">
+          <property name="sizePolicy">
+           <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
+            <horstretch>0</horstretch>
+            <verstretch>0</verstretch>
+           </sizepolicy>
+          </property>
+          <property name="verticalScrollBarPolicy">
+           <enum>Qt::ScrollBarPolicy::ScrollBarAlwaysOff</enum>
+          </property>
+          <property name="widgetResizable">
+           <bool>true</bool>
+          </property>
+          <widget class="QWidget" name="scrollAreaWidgetContents">
+           <property name="geometry">
+            <rect>
+             <x>0</x>
+             <y>0</y>
+             <width>780</width>
+             <height>16</height>
+            </rect>
+           </property>
+           <property name="sizePolicy">
+            <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+             <horstretch>0</horstretch>
+             <verstretch>0</verstretch>
+            </sizepolicy>
+           </property>
+          </widget>
+         </widget>
         </item>
        </layout>
       </item>

KDiskInfo.tar.gz I attatched a Qt6-GLibC binary

sgmihai commented 2 months ago

Thanks, that appears to be a proper fix: https://imgur.com/iheGi5i Ideally we'd have a way to select between horizontal scroll and grid view, if we have enough pixels to display 200 disks and we want to see them all at once. But it's good enough for me as it is.

edisionnano commented 2 months ago

Thanks, that appears to be a proper fix: https://imgur.com/iheGi5i Ideally we'd have a way to select between horizontal scroll and grid view, if we have enough pixels to display 200 disks and we want to see them all at once. But it's good enough for me as it is.

How would the grid look? Perhaps as a popup? If you click the Disk menu up top there's also a dropdown