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

Support Crystal Disk Info skins #7

Closed wantija closed 1 month ago

wantija commented 2 months ago

If possible, please add support for using the anime skins that come with the software, if they cannot be bundled with the program allow them to be loaded manually.

edisionnano commented 2 months ago

It's definitely possible, here's a quick hack I threw together image It still needs some refinements; line edits and the table should be semi transparent. It also is a bit junky when resizing the window. CrystalDiskInfo also moves the status and temperature under the line edits and has a chibi version of the character in their original place (which presumably changes depending on the status of the drive?). It also seems to come with some sounds too for some odd reason. Getting the images is easy, you just download the themed version and they are on a folder. I copied the bg under the name bg.png and threw it on the dist folder. Bellow follows my patch:

diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index 7aa1962..23ae482 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -24,6 +24,12 @@ MainWindow::MainWindow(QWidget *parent)
     horizontalLayout->setContentsMargins(0, 0, 0, 0);
     ui->scrollArea->setWidget(containerWidget);

+    QPixmap animeBackground = QPixmap(":/icons/bg.png").scaled(this->size(), Qt::KeepAspectRatioByExpanding, Qt::SmoothTransformation);
+    QPalette palette;
+    palette.setBrush(QPalette::Window, QBrush(animeBackground));
+    ui->centralwidget->setPalette(palette);
+    ui->centralwidget->setAutoFillBackground(true);
+
     diskName = qobject_cast<QLabel *>(ui->centralwidget->findChild<QLabel*>("diskName"));
     temperatureValue = qobject_cast<QLabel *>(ui->centralwidget->findChild<QLabel*>("temperatureValueLabel"));
     healthStatusValue = qobject_cast<QLabel *>(ui->centralwidget->findChild<QLabel*>("healthStatusValueLabel"));
diff --git a/src/mainwindow.ui b/src/mainwindow.ui
index 4a2a378..78be8f4 100644
--- a/src/mainwindow.ui
+++ b/src/mainwindow.ui
@@ -9,7 +9,7 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>800</width>
+    <width>960</width>
     <height>600</height>
    </rect>
   </property>
@@ -54,7 +54,7 @@
             <rect>
              <x>0</x>
              <y>0</y>
-             <width>784</width>
+             <width>625</width>
              <height>16</height>
             </rect>
            </property>
@@ -69,19 +69,6 @@
         </item>
        </layout>
       </item>
-      <item row="3" column="0">
-       <widget class="QTableWidget" name="dataTable">
-        <property name="autoFillBackground">
-         <bool>false</bool>
-        </property>
-        <property name="showGrid">
-         <bool>true</bool>
-        </property>
-        <property name="wordWrap">
-         <bool>true</bool>
-        </property>
-       </widget>
-      </item>
       <item row="1" column="0">
        <layout class="QHBoxLayout" name="navigation">
         <item>
@@ -406,8 +393,34 @@
         </item>
        </layout>
       </item>
+      <item row="3" column="0">
+       <widget class="QTableWidget" name="dataTable">
+        <property name="autoFillBackground">
+         <bool>false</bool>
+        </property>
+        <property name="showGrid">
+         <bool>true</bool>
+        </property>
+        <property name="wordWrap">
+         <bool>true</bool>
+        </property>
+       </widget>
+      </item>
      </layout>
     </item>
+    <item>
+     <spacer name="horizontalSpacer_4">
+      <property name="orientation">
+       <enum>Qt::Orientation::Horizontal</enum>
+      </property>
+      <property name="sizeHint" stdset="0">
+       <size>
+        <width>40</width>
+        <height>20</height>
+       </size>
+      </property>
+     </spacer>
+    </item>
    </layout>
   </widget>
   <widget class="QMenuBar" name="menuBar">
@@ -560,7 +573,7 @@
     <iconset theme="help-about"/>
    </property>
    <property name="text">
-    <string>About Qt</string>
+    <string>About &amp;Qt</string>
    </property>
   </action>
  </widget>
diff --git a/src/resources.qrc b/src/resources.qrc
index 0d2a1f1..d74756a 100644
--- a/src/resources.qrc
+++ b/src/resources.qrc
@@ -1,6 +1,7 @@
 <RCC>
     <qresource prefix="/icons">
         <file alias="icon.svg">../dist/QDiskInfo.svg</file>
+        <file alias="bg.png">../dist/bg.png</file>
     </qresource>
     <qresource prefix="/translations">
         <file alias="qdiskinfo_el_GR.qm">../translations/qdiskinfo_el_GR.qm</file>
edisionnano commented 2 months ago

And here's how it looks with the statuses moved under the line edits image anime.tar.gz The status image is hardcoded just to provide a mockup