Skip to content

Commit 67fbbe2

Browse files
committed
Change default row height to prevent clipping of duration from 'tech specs'.
Filter video groups with a length less than 2 so they are never added to the view model. Change units for video Size (KB->GB) and Bitrate(Kb->Mbps).
1 parent e20ea30 commit 67fbbe2

File tree

2 files changed

+18
-7
lines changed

2 files changed

+18
-7
lines changed

src/MainWindow.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ MainWindow::MainWindow(QWidget* parent)
3939
// Center screenshots in their column
4040
view->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
4141
view->setIconSize(QSize(128, 128));
42-
view->verticalHeader()->setDefaultSectionSize(80);
42+
view->verticalHeader()->setDefaultSectionSize(120);
4343

4444
// Connect the add/remove directory UI
4545
connect(ui->addDirectoryButton, &QPushButton::clicked,

src/VideoModel.cpp

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,22 @@ VideoModel::VideoModel(QObject* parent)
1616

1717
void VideoModel::setGroupedVideos(std::vector<std::vector<VideoInfo>> const& groups)
1818
{
19+
// 1) Filter out any groups that have fewer than 2 videos.
20+
std::vector<std::vector<VideoInfo>> filteredGroups;
21+
filteredGroups.reserve(groups.size());
22+
for (auto const& g : groups) {
23+
if (g.size() >= 2) {
24+
filteredGroups.push_back(g);
25+
}
26+
}
27+
1928
beginResetModel();
2029
m_rows.clear();
2130
m_groupBoundaries.clear();
2231

32+
// 2) Proceed with normal insertion logic, but using filteredGroups now
2333
int groupIndex = 0;
24-
for (auto const& grp : groups) {
34+
for (auto const& grp : filteredGroups) {
2535
// Insert a 'Separator' row to label this group
2636
RowEntry sep;
2737
sep.type = RowType::Separator;
@@ -90,11 +100,12 @@ QVariant VideoModel::data(QModelIndex const& index, int role) const
90100
case Col_Path:
91101
return QString::fromStdString(vid.path);
92102
case Col_TechSpecs: {
93-
auto sizeKb = vid.size / 1024;
94-
auto br = vid.bit_rate / 1000;
95-
return QString("Size: %1 KB\nBitrate: %2 kb/s\nResolution: %3x%4\nFramerate: %5\nDuration: %6s")
96-
.arg(sizeKb)
97-
.arg(br)
103+
double sizeGB = static_cast<double>(vid.size) / (1024.0 * 1024.0 * 1024.0);
104+
double bitrateMbps = static_cast<double>(vid.bit_rate) / 1'000'000.0;
105+
106+
return QString("Size: %1 GB\nBitrate: %2 Mbps\nResolution: %3x%4\nFramerate: %5\nDuration: %6s")
107+
.arg(sizeGB, 0, 'f', 2)
108+
.arg(bitrateMbps, 0, 'f', 2)
98109
.arg(vid.width)
99110
.arg(vid.height)
100111
.arg(vid.avg_frame_rate, 0, 'f', 2)

0 commit comments

Comments
 (0)