VirtualBox

Changeset 96139 in vbox


Ignore:
Timestamp:
Aug 11, 2022 2:47:34 PM (3 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
152944
Message:

Recording/FE/Qt: Make use of better error propagation (via r152942). Also, don't (debug) assert when an error occurred, as this now is the job of the now being received error info. ​bugref:10275

Location:
trunk/src/VBox/Frontends/VirtualBox/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationObjects.cpp

    r95278 r96139  
    5555#include "CNetworkAdapter.h"
    5656#include "CRangedIntegerFormValue.h"
     57#include "CRecordingSettings.h"
    5758#include "CStringFormValue.h"
    5859#ifdef VBOX_WITH_UPDATE_AGENT
     
    15541555
    15551556/* static */
    1556 void UINotificationMessage::cannotToggleRecording(const CMachine &comMachine, bool fEnable)
    1557 {
    1558     const QString strMachineName(CMachine(comMachine).GetName());
     1557void UINotificationMessage::cannotToggleRecording(const CRecordingSettings &comRecording, const QString &strMachineName, bool fEnable)
     1558{
    15591559    createMessage(
    15601560        QApplication::translate("UIMessageCenter", "Can't toggle recording ..."),
     
    15641564         : QApplication::translate("UIMessageCenter", "Failed to disable recording for the virtual machine <b>%1</b>.")
    15651565                                   .arg(strMachineName)) +
    1566         UIErrorString::formatErrorInfo(comMachine));
     1566        UIErrorString::formatErrorInfo(comRecording));
    15671567}
    15681568
  • trunk/src/VBox/Frontends/VirtualBox/src/notificationcenter/UINotificationObjects.h

    r94785 r96139  
    616616
    617617        /** Notifies about inability to toggle recording.
    618           * @param  comMachine  Brings the machine recording being toggled for.
    619           * @param  fEnable     Brings whether recording is enabled or not. */
    620         static void cannotToggleRecording(const CMachine &comMachine, bool fEnable);
     618          * @param  comRecording    Brings the recording settings being toggled for.
     619          * @param  strMachineName  Brings the machine name.
     620          * @param  fEnable         Brings whether recording is enabled or not. */
     621        static void cannotToggleRecording(const CRecordingSettings &comRecording, const QString &strMachineName, bool fEnable);
    621622
    622623        /** Notifies about inability to toggle VRDE server.
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp

    r95423 r96139  
    20862086        uisession()->updateStatusRecording();
    20872087        /* Notify about the error: */
    2088         return UINotificationMessage::cannotToggleRecording(machine(), fEnabled);
     2088        return UINotificationMessage::cannotToggleRecording(comRecordingSettings, machine().GetName(), fEnabled);
    20892089    }
    20902090
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsDisplay.cpp

    r95944 r96139  
    12311231                {
    12321232                    comRecordingScreenSettings.SetFilename(newDisplayData.m_strRecordingFilePath);
    1233                     Assert(comRecordingScreenSettings.isOk());
    12341233                    fSuccess = comRecordingScreenSettings.isOk();
    12351234                }
     
    12381237                {
    12391238                    comRecordingScreenSettings.SetVideoWidth(newDisplayData.m_iRecordingVideoFrameWidth);
    1240                     Assert(comRecordingScreenSettings.isOk());
    12411239                    fSuccess = comRecordingScreenSettings.isOk();
    12421240                }
     
    12451243                {
    12461244                    comRecordingScreenSettings.SetVideoHeight(newDisplayData.m_iRecordingVideoFrameHeight);
    1247                     Assert(comRecordingScreenSettings.isOk());
    12481245                    fSuccess = comRecordingScreenSettings.isOk();
    12491246                }
     
    12521249                {
    12531250                    comRecordingScreenSettings.SetVideoFPS(newDisplayData.m_iRecordingVideoFrameRate);
    1254                     Assert(comRecordingScreenSettings.isOk());
    12551251                    fSuccess = comRecordingScreenSettings.isOk();
    12561252                }
     
    12591255                {
    12601256                    comRecordingScreenSettings.SetVideoRate(newDisplayData.m_iRecordingVideoBitRate);
    1261                     Assert(comRecordingScreenSettings.isOk());
    12621257                    fSuccess = comRecordingScreenSettings.isOk();
    12631258                }
     
    12661261                {
    12671262                    comRecordingScreenSettings.SetOptions(newDisplayData.m_strRecordingVideoOptions);
    1268                     Assert(comRecordingScreenSettings.isOk());
    12691263                    fSuccess = comRecordingScreenSettings.isOk();
    12701264                }
     
    12741268                {
    12751269                    comRecordingScreenSettings.SetEnabled(newDisplayData.m_vecRecordingScreens[iScreenIndex]);
    1276                     Assert(comRecordingScreenSettings.isOk());
    12771270                    fSuccess = comRecordingScreenSettings.isOk();
     1271                }
     1272
     1273                if (!fSuccess)
     1274                {
     1275                    if (!comRecordingScreenSettings.isOk())
     1276                        notifyOperationProgressError(UIErrorString::formatErrorInfo(comRecordingScreenSettings));
     1277                    break; /* No point trying to handle the other screens (if any). */
    12781278                }
    12791279            }
     
    12841284            {
    12851285                recordingSettings.SetEnabled(newDisplayData.m_fRecordingEnabled);
    1286                 Assert(recordingSettings.isOk());
    12871286                fSuccess = recordingSettings.isOk();
    12881287            }
     
    13011300            {
    13021301                comRecordingScreenSettings.SetFilename(newDisplayData.m_strRecordingFilePath);
    1303                 Assert(comRecordingScreenSettings.isOk());
    13041302                fSuccess = comRecordingScreenSettings.isOk();
    13051303            }
     
    13081306            {
    13091307                comRecordingScreenSettings.SetVideoWidth(newDisplayData.m_iRecordingVideoFrameWidth);
    1310                 Assert(comRecordingScreenSettings.isOk());
    13111308                fSuccess = comRecordingScreenSettings.isOk();
    13121309            }
     
    13151312            {
    13161313                comRecordingScreenSettings.SetVideoHeight(newDisplayData.m_iRecordingVideoFrameHeight);
    1317                 Assert(comRecordingScreenSettings.isOk());
    13181314                fSuccess = comRecordingScreenSettings.isOk();
    13191315            }
     
    13221318            {
    13231319                comRecordingScreenSettings.SetVideoFPS(newDisplayData.m_iRecordingVideoFrameRate);
    1324                 Assert(comRecordingScreenSettings.isOk());
    13251320                fSuccess = comRecordingScreenSettings.isOk();
    13261321            }
     
    13291324            {
    13301325                comRecordingScreenSettings.SetVideoRate(newDisplayData.m_iRecordingVideoBitRate);
    1331                 Assert(comRecordingScreenSettings.isOk());
    13321326                fSuccess = comRecordingScreenSettings.isOk();
    13331327            }
     
    13361330            {
    13371331                comRecordingScreenSettings.SetOptions(newDisplayData.m_strRecordingVideoOptions);
    1338                 Assert(comRecordingScreenSettings.isOk());
    13391332                fSuccess = comRecordingScreenSettings.isOk();
    13401333            }
     
    13441337            {
    13451338                comRecordingScreenSettings.SetEnabled(newDisplayData.m_vecRecordingScreens[iScreenIndex]);
    1346                 Assert(comRecordingScreenSettings.isOk());
    13471339                fSuccess = comRecordingScreenSettings.isOk();
     1340            }
     1341
     1342            if (!fSuccess)
     1343            {
     1344                notifyOperationProgressError(UIErrorString::formatErrorInfo(comRecordingScreenSettings));
     1345                break; /* No point trying to handle the other screens (if any). */
    13481346            }
    13491347        }
     
    13541352        {
    13551353            recordingSettings.SetEnabled(newDisplayData.m_fRecordingEnabled);
    1356             Assert(recordingSettings.isOk());
    13571354            fSuccess = recordingSettings.isOk();
    13581355        }
     
    13611358    /* Show error message if necessary: */
    13621359    if (!fSuccess)
    1363         notifyOperationProgressError(UIErrorString::formatErrorInfo(m_machine));
     1360    {
     1361        if (!recordingSettings.isOk())
     1362            notifyOperationProgressError(UIErrorString::formatErrorInfo(recordingSettings));
     1363        else if (!m_machine.isOk()) /* Machine could indicate an error when saving the settings. */
     1364            notifyOperationProgressError(UIErrorString::formatErrorInfo(m_machine));
     1365    }
    13641366
    13651367    /* Return result: */
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette