@@ -16,12 +16,22 @@ VideoModel::VideoModel(QObject* parent)
1616
1717void 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\n Bitrate: %2 kb/s\n Resolution: %3x%4\n Framerate: %5\n Duration: %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\n Bitrate: %2 Mbps\n Resolution: %3x%4\n Framerate: %5\n Duration: %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