@@ -1041,7 +1041,74 @@ MainWindow::~MainWindow()
10411041void  MainWindow::setupSettingsMenu ()
10421042{
10431043    LOG_DEBUG () << " begin" 
1044+ 
10441045    QActionGroup *group = new  QActionGroup (this );
1046+     ui->actionNative8bitCpu ->setData (ShotcutSettings::Native8Cpu);
1047+     ui->actionLinear8bitCpu ->setData (ShotcutSettings::Linear8Cpu);
1048+     ui->actionNative10bitCpu ->setData (ShotcutSettings::Native10Cpu);
1049+     ui->actionLinear10bitCpu ->setData (ShotcutSettings::Linear10Cpu);
1050+     ui->actionNative10bitGpuCpu ->setData (ShotcutSettings::Native10GpuCpu);
1051+     group->addAction (ui->actionNative8bitCpu );
1052+     group->addAction (ui->actionLinear8bitCpu );
1053+     group->addAction (ui->actionNative10bitCpu );
1054+     group->addAction (ui->actionLinear10bitCpu );
1055+     group->addAction (ui->actionNative10bitGpuCpu );
1056+     for  (auto  a : group->actions ()) {
1057+         ShotcutSettings::ProcessingMode mode = (ShotcutSettings::ProcessingMode) a->data ().toInt ();
1058+         if  (Settings.processingMode () == mode) {
1059+             a->setChecked (true );
1060+             setProcessingMode (mode);
1061+             break ;
1062+         }
1063+     }
1064+     connect (group, &QActionGroup::triggered, this , [&](QAction *action) {
1065+         ShotcutSettings::ProcessingMode oldMode = Settings.processingMode ();
1066+         ShotcutSettings::ProcessingMode newMode
1067+             = (ShotcutSettings::ProcessingMode) action->data ().toInt ();
1068+         if  (oldMode == newMode)
1069+             return ;
1070+         LOG_INFO () << " Processing Mode" " ->" 
1071+         if  (newMode == ShotcutSettings::Native10GpuCpu) {
1072+             QMessageBox dialog (QMessageBox::Warning,
1073+                                qApp->applicationName (),
1074+                                tr (" GPU is experimental and does not work on all computers. " 
1075+                                   " Plan to do some testing after turning this on.\n " 
1076+                                   " At this time, a project created with GPU processing cannot be " 
1077+                                   " converted to a CPU-only project later.\n " 
1078+                                   " Do you want to enable GPU processing and restart Shotcut?" 
1079+                                QMessageBox::No | QMessageBox::Yes,
1080+                                this );
1081+             dialog.setDefaultButton (QMessageBox::Yes);
1082+             dialog.setEscapeButton (QMessageBox::No);
1083+             dialog.setWindowModality (QmlApplication::dialogModality ());
1084+             dialog.adjustSize ();
1085+             if  (dialog.exec () == QMessageBox::Yes) {
1086+                 Settings.setProcessingMode (newMode);
1087+                 m_exitCode = EXIT_RESTART;
1088+                 QApplication::closeAllWindows ();
1089+             }
1090+         } else  if  (oldMode == ShotcutSettings::Native10GpuCpu) {
1091+             QMessageBox dialog (QMessageBox::Information,
1092+                                qApp->applicationName (),
1093+                                tr (" Shotcut must restart to disable GPU processing mode.\n " 
1094+                                   " Disable GPU processing and restart?" 
1095+                                QMessageBox::No | QMessageBox::Yes,
1096+                                this );
1097+             dialog.setDefaultButton (QMessageBox::Yes);
1098+             dialog.setEscapeButton (QMessageBox::No);
1099+             dialog.setWindowModality (QmlApplication::dialogModality ());
1100+             dialog.adjustSize ();
1101+             if  (dialog.exec () == QMessageBox::Yes) {
1102+                 Settings.setProcessingMode (newMode);
1103+                 m_exitCode = EXIT_RESTART;
1104+                 QApplication::closeAllWindows ();
1105+             }
1106+         } else  {
1107+             setProcessingMode ((ShotcutSettings::ProcessingMode) action->data ().toInt ());
1108+         }
1109+     });
1110+ 
1111+     group = new  QActionGroup (this );
10451112    group->addAction (ui->actionChannels1 );
10461113    group->addAction (ui->actionChannels2 );
10471114    group->addAction (ui->actionChannels4 );
@@ -1617,12 +1684,12 @@ bool MainWindow::isCompatibleWithGpuMode(MltXmlChecker &checker)
16171684{
16181685    if  (checker.needsGPU () && !Settings.playerGPU ()) {
16191686        LOG_INFO () << " file uses GPU but GPU not enabled" 
1620-         QMessageBox
1621-             dialog ( QMessageBox::Warning,
1622-                     qApp->applicationName (),
1623-                     tr (" The file you opened uses GPU effects , but GPU effects are  not enabled." 
1624-                     QMessageBox::Ok,
1625-                     this );
1687+         QMessageBox  dialog ( 
1688+             QMessageBox::Warning,
1689+             qApp->applicationName (),
1690+             tr (" The file you opened uses GPU processing , but GPU processing mode is  not enabled." 
1691+             QMessageBox::Ok,
1692+             this );
16261693        dialog.setWindowModality (QmlApplication::dialogModality ());
16271694        dialog.setDefaultButton (QMessageBox::Ok);
16281695        dialog.setEscapeButton (QMessageBox::Ok);
@@ -1633,16 +1700,16 @@ bool MainWindow::isCompatibleWithGpuMode(MltXmlChecker &checker)
16331700        QMessageBox dialog (QMessageBox::Question,
16341701                           qApp->applicationName (),
16351702                           tr (" The file you opened uses CPU effects that are incompatible with GPU " 
1636-                               " effects, but GPU effects are  enabled.\n " 
1637-                               " Do you want to disable GPU effects  and restart?" 
1703+                               " effects, but GPU mode is  enabled.\n " 
1704+                               " Do you want to disable GPU processing mode  and restart?" 
16381705                           QMessageBox::No | QMessageBox::Yes,
16391706                           this );
16401707        dialog.setWindowModality (QmlApplication::dialogModality ());
16411708        dialog.setDefaultButton (QMessageBox::Yes);
16421709        dialog.setEscapeButton (QMessageBox::No);
16431710        int  r = dialog.exec ();
16441711        if  (r == QMessageBox::Yes) {
1645-             ui-> actionGPU -> setChecked ( false );
1712+             Settings. setProcessingMode (ShotcutSettings::Native10GpuCpu );
16461713            m_exitCode = EXIT_RESTART;
16471714            QApplication::closeAllWindows ();
16481715        }
@@ -1847,6 +1914,33 @@ void MainWindow::setAudioChannels(int channels)
18471914    emit audioChannelsChanged ();
18481915}
18491916
1917+ void  MainWindow::setProcessingMode (ShotcutSettings::ProcessingMode mode)
1918+ {
1919+     LOG_DEBUG () << mode;
1920+     if  (mode != Settings.processingMode ()) {
1921+         Settings.setProcessingMode (mode);
1922+     }
1923+     switch  (mode) {
1924+     case  ShotcutSettings::Native8Cpu:
1925+         ui->actionNative8bitCpu ->setChecked (true );
1926+         break ;
1927+     case  ShotcutSettings::Linear8Cpu:
1928+         ui->actionNative8bitCpu ->setChecked (true );
1929+         break ;
1930+     case  ShotcutSettings::Native10Cpu:
1931+         ui->actionNative10bitCpu ->setChecked (true );
1932+         break ;
1933+     case  ShotcutSettings::Linear10Cpu:
1934+         ui->actionLinear10bitCpu ->setChecked (true );
1935+         break ;
1936+     case  ShotcutSettings::Native10GpuCpu:
1937+         ui->actionNative10bitGpuCpu ->setChecked (true );
1938+         break ;
1939+     }
1940+     MLT.videoWidget ()->setProperty (" processing_mode" 
1941+     MLT.setProcessingMode (mode);
1942+ }
1943+ 
18501944void  MainWindow::showSaveError ()
18511945{
18521946    QMessageBox dialog (QMessageBox::Critical,
@@ -2093,6 +2187,7 @@ bool MainWindow::open(QString url, const Mlt::Properties *properties, bool play,
20932187        m_player->setPauseAfterOpen (!play || !MLT.isClip ());
20942188
20952189        setAudioChannels (MLT.audioChannels ());
2190+         setProcessingMode (MLT.processingMode ());
20962191        if  (url.endsWith (" .mlt" endsWith (" .xml" 
20972192            if  (MLT.producer ()->get_int (kShotcutProjectFolder )) {
20982193                MLT.setProjectFolder (info.absolutePath ());
@@ -2297,8 +2392,6 @@ void MainWindow::readPlayerSettings()
22972392    ui->actionScrubAudio ->setChecked (Settings.playerScrubAudio ());
22982393    if  (ui->actionJack )
22992394        ui->actionJack ->setChecked (Settings.playerJACK ());
2300-     if  (ui->actionGPU )
2301-         ui->actionGPU ->setChecked (Settings.playerGPU ());
23022395
23032396    QString external = Settings.playerExternal ();
23042397    bool  ok = false ;
@@ -2571,7 +2664,6 @@ void MainWindow::writeSettings()
25712664    if  (isFullScreen ())
25722665        showNormal ();
25732666#endif 
2574-     Settings.setPlayerGPU (ui->actionGPU ->isChecked ());
25752667    Settings.setWindowGeometry (saveGeometry ());
25762668    Settings.setWindowState (saveState ());
25772669    Settings.sync ();
@@ -4009,11 +4101,11 @@ void MainWindow::on_actionEnterFullScreen_triggered()
40094101
40104102void  MainWindow::onGpuNotSupported ()
40114103{
4012-     Settings.setPlayerGPU (false );
4013-     if  (ui->actionGPU ) {
4014-         ui->actionGPU ->setChecked (false );
4015-         ui->actionGPU ->setDisabled (true );
4104+     if  (Settings.processingMode () == ShotcutSettings::Native10GpuCpu) {
4105+         Settings.setProcessingMode (ShotcutSettings::Native8Cpu);
40164106    }
4107+     ui->actionNative10bitGpuCpu ->setChecked (false );
4108+     ui->actionNative10bitGpuCpu ->setDisabled (true );
40174109    LOG_WARNING () << " " 
40184110    QMessageBox::critical (this , qApp->applicationName (), tr (" GPU effects are not supported" 
40194111}
@@ -4256,48 +4348,6 @@ void MainWindow::on_actionJack_triggered(bool checked)
42564348    }
42574349}
42584350
4259- void  MainWindow::on_actionGPU_triggered (bool  checked)
4260- {
4261-     if  (checked) {
4262-         QMessageBox dialog (QMessageBox::Warning,
4263-                            qApp->applicationName (),
4264-                            tr (" GPU effects are experimental and do not work good on all computers. " 
4265-                               " Plan to do some testing after turning this on.\n " 
4266-                               " At this time, a project created with GPU effects cannot be " 
4267-                               " converted to a CPU-only project later." 
4268-                               " \n\n " 
4269-                               " Do you want to enable GPU effects and restart Shotcut?" 
4270-                            QMessageBox::No | QMessageBox::Yes,
4271-                            this );
4272-         dialog.setDefaultButton (QMessageBox::Yes);
4273-         dialog.setEscapeButton (QMessageBox::No);
4274-         dialog.setWindowModality (QmlApplication::dialogModality ());
4275-         if  (dialog.exec () == QMessageBox::Yes) {
4276-             m_exitCode = EXIT_RESTART;
4277-             QApplication::closeAllWindows ();
4278-         } else  {
4279-             ui->actionGPU ->setChecked (false );
4280-         }
4281-     } else  {
4282-         QMessageBox dialog (QMessageBox::Information,
4283-                            qApp->applicationName (),
4284-                            tr (" Shotcut must restart to disable GPU effects." 
4285-                               " \n\n " 
4286-                               " Disable GPU effects and restart?" 
4287-                            QMessageBox::No | QMessageBox::Yes,
4288-                            this );
4289-         dialog.setDefaultButton (QMessageBox::Yes);
4290-         dialog.setEscapeButton (QMessageBox::No);
4291-         dialog.setWindowModality (QmlApplication::dialogModality ());
4292-         if  (dialog.exec () == QMessageBox::Yes) {
4293-             m_exitCode = EXIT_RESTART;
4294-             QApplication::closeAllWindows ();
4295-         } else  {
4296-             ui->actionGPU ->setChecked (true );
4297-         }
4298-     }
4299- }
4300- 
43014351void  MainWindow::onExternalTriggered (QAction *action)
43024352{
43034353    LOG_DEBUG () << action->data ().toString ();
@@ -5577,25 +5627,22 @@ void MainWindow::on_actionClearRecentOnExit_toggled(bool arg1)
55775627void  MainWindow::onSceneGraphInitialized ()
55785628{
55795629    if  (Settings.playerGPU () && Settings.playerWarnGPU ()) {
5580-         QMessageBox dialog (QMessageBox::Warning,
5581-                            qApp->applicationName (),
5582-                            tr (" GPU effects are EXPERIMENTAL, UNSTABLE and UNSUPPORTED! Unsupported " 
5583-                               " means do not report bugs about it.\n\n " 
5584-                               " Do you want to disable GPU effects and restart Shotcut?" 
5585-                            QMessageBox::No | QMessageBox::Yes,
5586-                            this );
5630+         QMessageBox
5631+             dialog (QMessageBox::Warning,
5632+                    qApp->applicationName (),
5633+                    tr (" GPU processing is EXPERIMENTAL, UNSTABLE and UNSUPPORTED! Unsupported " 
5634+                       " means do not report bugs about it.\n\n " 
5635+                       " Do you want to disable GPU processing and restart Shotcut?" 
5636+                    QMessageBox::No | QMessageBox::Yes,
5637+                    this );
55875638        dialog.setDefaultButton (QMessageBox::Yes);
55885639        dialog.setEscapeButton (QMessageBox::No);
55895640        dialog.setWindowModality (QmlApplication::dialogModality ());
55905641        if  (dialog.exec () == QMessageBox::Yes) {
5591-             ui-> actionGPU -> setChecked ( false );
5642+             Settings. setProcessingMode (ShotcutSettings::Native8Cpu );
55925643            m_exitCode = EXIT_RESTART;
55935644            QApplication::closeAllWindows ();
5594-         } else  {
5595-             ui->actionGPU ->setVisible (true );
55965645        }
5597-     } else  {
5598-         ui->actionGPU ->setVisible (true );
55995646    }
56005647    auto  videoWidget = (Mlt::VideoWidget *) &(MLT);
56015648    videoWidget->setBlankScene ();
0 commit comments