[vlc-commits] [Git][videolan/vlc][master] 2 commits: qt: use QTimeZone::systemTimeZone() instead of QTimeZone::utc()

Steve Lhomme (@robUx4) gitlab at videolan.org
Fri Sep 8 09:11:37 UTC 2023



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
a1b6ba86 by Fatih Uzunoglu at 2023-09-08T08:29:37+00:00
qt: use QTimeZone::systemTimeZone() instead of QTimeZone::utc()

- - - - -
728a7c40 by Fatih Uzunoglu at 2023-09-08T08:29:37+00:00
qt: use QStringLiteral to construct QRegularExpression

- - - - -


13 changed files:

- modules/gui/qt/dialogs/epg/EPGItem.cpp
- modules/gui/qt/dialogs/epg/EPGProgram.cpp
- modules/gui/qt/dialogs/epg/EPGWidget.cpp
- modules/gui/qt/dialogs/extended/extended_panels.cpp
- modules/gui/qt/dialogs/mediainfo/info_panels.cpp
- modules/gui/qt/dialogs/open/open.cpp
- modules/gui/qt/dialogs/open/open_panels.cpp
- modules/gui/qt/dialogs/preferences/simple_preferences.cpp
- modules/gui/qt/dialogs/sout/profile_selector.cpp
- modules/gui/qt/dialogs/sout/sout_widgets.cpp
- modules/gui/qt/medialibrary/mlrecentsmodel.cpp
- modules/gui/qt/medialibrary/mlurlmodel.cpp
- modules/gui/qt/network/networkmediamodel.cpp


Changes:

=====================================
modules/gui/qt/dialogs/epg/EPGItem.cpp
=====================================
@@ -152,7 +152,7 @@ uint16_t EPGItem::eventID() const
 
 bool EPGItem::setData( const vlc_epg_event_t *data )
 {
-    QDateTime newtime = QDateTime::fromSecsSinceEpoch( data->i_start, QTimeZone::utc() );
+    QDateTime newtime = QDateTime::fromSecsSinceEpoch( data->i_start, QTimeZone::systemTimeZone() );
     QString newname = qfu( data->psz_name );
     QString newdesc = qfu( data->psz_description );
     QString newshortdesc = qfu( data->psz_short_description );


=====================================
modules/gui/qt/dialogs/epg/EPGProgram.cpp
=====================================
@@ -98,7 +98,7 @@ void EPGProgram::updateEvents( const vlc_epg_event_t * const * pp_events, size_t
     for( size_t i=0; i<i_events; i++ )
     {
         const vlc_epg_event_t *p_event = pp_events[i];
-        QDateTime eventStart = QDateTime::fromSecsSinceEpoch( p_event->i_start, QTimeZone::utc() );
+        QDateTime eventStart = QDateTime::fromSecsSinceEpoch( p_event->i_start, QTimeZone::systemTimeZone() );
         if( !mindate->isValid() || eventStart < *mindate )
             *mindate = eventStart;
 


=====================================
modules/gui/qt/dialogs/epg/EPGWidget.cpp
=====================================
@@ -109,7 +109,7 @@ void EPGWidget::updateEPG( input_item_t *p_input_item )
     vlc_mutex_lock(  & p_input_item->lock );
     m_epgView->updateEPG( p_input_item->pp_epg, p_input_item->i_epg );
     m_epgView->setEpgTime( ( p_input_item->i_epg_time ) ?
-                           QDateTime::fromSecsSinceEpoch( p_input_item->i_epg_time, QTimeZone::utc() ) :
+                           QDateTime::fromSecsSinceEpoch( p_input_item->i_epg_time, QTimeZone::systemTimeZone() ) :
                            QDateTime() );
     vlc_mutex_unlock( & p_input_item->lock );
 


=====================================
modules/gui/qt/dialogs/extended/extended_panels.cpp
=====================================
@@ -112,8 +112,8 @@ static QString OptionFromWidgetName( QObject *obj )
 {
     /* Gruik ? ... nah */
     return obj->objectName()
-        .remove( QRegularExpression( "Slider|Combo|Dial|Check|Spin|Text" ) )
-        .replace( QRegularExpression( "([A-Z])" ), "-\\1" )
+        .remove( QRegularExpression( QStringLiteral( "Slider|Combo|Dial|Check|Spin|Text" ) ) )
+        .replace( QRegularExpression( QStringLiteral( "([A-Z])" ) ), QStringLiteral( "-\\1" ) )
         .toLower();
 }
 


=====================================
modules/gui/qt/dialogs/mediainfo/info_panels.cpp
=====================================
@@ -259,7 +259,7 @@ void MetaPanel::update( const SharedInputItem& p_item )
         {
             currentURL = newURL;
             lblURL->setText( "<a href='" + currentURL + "'>" +
-                             currentURL.remove( QRegularExpression( ".*://") ) + "</a>" );
+                             currentURL.remove( QRegularExpression( QStringLiteral( ".*://" ) ) ) + "</a>" );
         }
     }
     free( psz_meta );


=====================================
modules/gui/qt/dialogs/open/open.cpp
=====================================
@@ -473,7 +473,7 @@ QStringList OpenDialog::SeparateEntries( const QString& entries )
     int index = 0;
     while( index < entries.count() )
     {
-        int delim_pos = entries.indexOf( QRegularExpression( "\\s+|\"" ), index );
+        int delim_pos = entries.indexOf( QRegularExpression( QStringLiteral( "\\s+|\"" ) ), index );
         if( delim_pos < 0 ) delim_pos = entries.count() - 1;
         entry += entries.mid( index, delim_pos - index + 1 );
         index = delim_pos + 1;


=====================================
modules/gui/qt/dialogs/open/open_panels.cpp
=====================================
@@ -71,7 +71,7 @@
         targetCombo ## StringList << QString( ppsz_devlist[ i ] ); \
     targetCombo->addItems( QDir( "/dev/" )\
         .entryList( targetCombo ## StringList, QDir::System )\
-        .replaceInStrings( QRegularExpression("^"), "/dev/" ) \
+        .replaceInStrings( QRegularExpression(QStringLiteral("^")), "/dev/" ) \
     );
 
 static const char psz_devModule[][8] = { "v4l2", "pvr", "dtv",
@@ -861,9 +861,9 @@ void CaptureOpenPanel::initialize()
 
         QStringList nodes = QDir( "/dev/snd" ).entryList( patterns,
                                                           QDir::System );
-        QStringList names = nodes.replaceInStrings( QRegularExpression("^pcmC"), "hw:" )
-                                 .replaceInStrings( QRegularExpression("c$"), "" )
-                                 .replaceInStrings( QRegularExpression("D"), "," );
+        QStringList names = nodes.replaceInStrings( QRegularExpression(QStringLiteral("^pcmC")), "hw:" )
+                                 .replaceInStrings( QRegularExpression(QStringLiteral("c$")), "" )
+                                 .replaceInStrings( QRegularExpression(QStringLiteral("D")), "," );
         v4l2AudioDevice->addItems( names );
     }
     v4l2AudioDevice->clearEditText();
@@ -1082,9 +1082,9 @@ void CaptureOpenPanel::initialize()
 
         QStringList nodes = QDir( "/dev/snd" ).entryList( patterns,
                                                           QDir::System );
-        QStringList names = nodes.replaceInStrings( QRegularExpression("^pcmC"), "hw:" )
-                                 .replaceInStrings( QRegularExpression("c$"), "" )
-                                 .replaceInStrings( QRegularExpression("D"), "," );
+        QStringList names = nodes.replaceInStrings( QRegularExpression(QStringLiteral("^pcmC")), "hw:" )
+                                 .replaceInStrings( QRegularExpression(QStringLiteral("c$")), "" )
+                                 .replaceInStrings( QRegularExpression(QStringLiteral("D")), "," );
         pvrAudioDevice->addItems( names );
     }
     pvrAudioDevice->clearEditText();


=====================================
modules/gui/qt/dialogs/preferences/simple_preferences.cpp
=====================================
@@ -656,7 +656,7 @@ SPrefsPanel::SPrefsPanel( qt_intf_t *_p_intf, QWidget *_parent,
                     << "dvd*" << "scd*" << "sr*" << "sg*" << "cd*";
             ui.DVDDeviceComboBox->addItems( QDir( "/dev/" )
                     .entryList( DVDDeviceComboBoxStringList, QDir::System )
-                    .replaceInStrings( QRegularExpression("^"), "/dev/" )
+                    .replaceInStrings( QRegularExpression(QStringLiteral("^")), "/dev/" )
             );
 #endif
             configGeneric<StringConfigControl>( "dvd", ui.DVDLabel,


=====================================
modules/gui/qt/dialogs/sout/profile_selector.cpp
=====================================
@@ -200,7 +200,7 @@ void VLCProfileSelector::saveProfiles()
 void VLCProfileSelector::updateOptions( int i )
 {
     QString options = profileBox->itemData( i ).toString();
-    QRegularExpression rx(OLDFORMAT);
+    QRegularExpression rx(QStringLiteral(OLDFORMAT));
     if ( !options.contains( ";" ) ) return;
     if ( rx.match( options ).hasMatch() )
         return updateOptionsOldFormat( i );
@@ -655,7 +655,7 @@ void VLCProfileEditor::codecSelected()
 
 void VLCProfileEditor::fillProfile( const QString& qs )
 {
-    QRegularExpression rx(OLDFORMAT);
+    QRegularExpression rx(QStringLiteral(OLDFORMAT));
     if ( rx.match( qs ).hasMatch() ) return fillProfileOldFormat( qs );
 
     QStringList tuples = qs.split( ";" );


=====================================
modules/gui/qt/dialogs/sout/sout_widgets.cpp
=====================================
@@ -149,11 +149,11 @@ QString FileDestBox::getMRL( const QString& mux )
     QString outputfile = fileEdit->text();
     if( !mux.isEmpty() )
     {
-        if( outputfile.contains( QRegularExpression("\\..{2,4}$")) &&
+        if( outputfile.contains( QRegularExpression(QStringLiteral("\\..{2,4}$"))) &&
             !outputfile.endsWith(mux) )
         {
            /* Replace the extension according to muxer */
-           outputfile.replace(QRegularExpression("\\..{2,4}$"),"."+mux);
+           outputfile.replace(QRegularExpression(QStringLiteral("\\..{2,4}$")),"."+mux);
         } else if (!outputfile.endsWith( mux ) )
         {
            m.option( "mux", mux );
@@ -219,7 +219,7 @@ QString HTTPDestBox::getMRL( const QString& mux )
     /* Path-extension is primary muxer to use if possible,
        otherwise check for mux-choise and see that it isn't mp4
        then fallback to flv*/
-    if ( !path.contains(QRegularExpression("\\..{2,3}$") ) )
+    if ( !path.contains(QRegularExpression(QStringLiteral("\\..{2,3}$")) ) )
     {
         if( !mux.isEmpty() && mux.compare("mp4") )
            m.option( "mux", mux );


=====================================
modules/gui/qt/medialibrary/mlrecentsmodel.cpp
=====================================
@@ -27,7 +27,7 @@
 MLRecentMedia::MLRecentMedia( const vlc_ml_media_t *media )
     : MLItem( MLItemId( media->i_id, VLC_ML_PARENT_UNKNOWN ) )
     , m_url ( media->p_files->i_nb_items > 0 ? media->p_files->p_items[0].psz_mrl : "" )
-    , m_lastPlayedDate(QDateTime::fromSecsSinceEpoch( media->i_last_played_date, QTimeZone::utc() ))
+    , m_lastPlayedDate(QDateTime::fromSecsSinceEpoch( media->i_last_played_date, QTimeZone::systemTimeZone() ))
 {
 }
 


=====================================
modules/gui/qt/medialibrary/mlurlmodel.cpp
=====================================
@@ -134,7 +134,7 @@ MLUrl::MLUrl(const vlc_ml_media_t *_data)
     : MLItem( MLItemId( _data->i_id, VLC_ML_PARENT_UNKNOWN ) )
     , m_url( _data->p_files->i_nb_items > 0 ? _data->p_files->p_items[0].psz_mrl : "" )
     , m_lastPlayedDate(
-          QDateTime::fromSecsSinceEpoch( _data->i_last_played_date, QTimeZone::utc() ).toString( QLocale::system().dateFormat( QLocale::ShortFormat ) )
+          QDateTime::fromSecsSinceEpoch( _data->i_last_played_date, QTimeZone::systemTimeZone() ).toString( QLocale::system().dateFormat( QLocale::ShortFormat ) )
           )
 {
 }


=====================================
modules/gui/qt/network/networkmediamodel.cpp
=====================================
@@ -603,7 +603,7 @@ void NetworkMediaModel::refreshMediaList( MediaTreePtr tree,
             free(str);
 
             if (ok)
-                item.fileModified = QDateTime::fromSecsSinceEpoch(time, QTimeZone::utc());
+                item.fileModified = QDateTime::fromSecsSinceEpoch(time, QTimeZone::systemTimeZone());
         }
 
         if ( m_mediaLib && item.canBeIndexed == true )



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/106a0246e3d4036cbbd16d98002a3d9a80b9917a...728a7c40925a31d2c8dea92d7e3e93401790c087

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/106a0246e3d4036cbbd16d98002a3d9a80b9917a...728a7c40925a31d2c8dea92d7e3e93401790c087
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list