VirtualBox

Changeset 25116 in vbox


Ignore:
Timestamp:
Nov 30, 2009 7:58:24 PM (15 years ago)
Author:
vboxsync
Message:

FE/Qt4: 4419: Test immutable images with snapshots: warning for immutable images added.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/include/VBoxTakeSnapshotDlg.h

    r9729 r25116  
    66
    77/*
    8  * Copyright (C) 2006-2008 Sun Microsystems, Inc.
     8 * Copyright (C) 2006-2009 Sun Microsystems, Inc.
    99 *
    1010 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    2424#define __VBoxTakeSnapshotDlg_h__
    2525
     26/* Local includes */
    2627#include "VBoxTakeSnapshotDlg.gen.h"
    2728#include "QIWithRetranslateUI.h"
     29#include "COMDefs.h"
    2830
    29 class VBoxTakeSnapshotDlg : public QIWithRetranslateUI<QDialog>,
    30                             public Ui::VBoxTakeSnapshotDlg
     31class VBoxTakeSnapshotDlg : public QIWithRetranslateUI<QDialog>, public Ui::VBoxTakeSnapshotDlg
    3132{
    3233    Q_OBJECT;
     
    3435public:
    3536
    36     VBoxTakeSnapshotDlg (QWidget *aParent);
     37    VBoxTakeSnapshotDlg(QWidget *pParent, const CMachine &machine);
    3738
    3839protected:
     
    4243private slots:
    4344
    44     void nameChanged (const QString &aName);
     45    void nameChanged(const QString &strName);
    4546};
    4647
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxConsoleWnd.cpp

    r24766 r25116  
    20272027    CMachine machine = mSession.GetMachine();
    20282028
    2029     VBoxTakeSnapshotDlg dlg (this);
     2029    VBoxTakeSnapshotDlg dlg (this, machine);
    20302030
    20312031    QString typeId = machine.GetOSTypeId();
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxSnapshotsWgt.cpp

    r24791 r25116  
    576576    AssertReturn (item, (void) 0);
    577577
    578     VBoxTakeSnapshotDlg dlg (this);
     578    VBoxTakeSnapshotDlg dlg (this, mMachine);
    579579
    580580    QString typeId = mMachine.GetOSTypeId();
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxTakeSnapshotDlg.cpp

    r9089 r25116  
    66
    77/*
    8  * Copyright (C) 2006-2008 Sun Microsystems, Inc.
     8 * Copyright (C) 2006-2009 Sun Microsystems, Inc.
    99 *
    1010 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    2121 */
    2222
     23/* Global includes */
     24#include <QPushButton>
     25
     26/* Local includes */
    2327#include "VBoxTakeSnapshotDlg.h"
    2428#include "VBoxProblemReporter.h"
    2529#include "VBoxUtils.h"
    2630
    27 /* Qt includes */
    28 #include <QPushButton>
    29 
    30 VBoxTakeSnapshotDlg::VBoxTakeSnapshotDlg (QWidget *aParent)
    31     : QIWithRetranslateUI<QDialog> (aParent)
     31VBoxTakeSnapshotDlg::VBoxTakeSnapshotDlg(QWidget *pParent, const CMachine &machine)
     32    : QIWithRetranslateUI<QDialog>(pParent)
    3233{
    3334    /* Apply UI decorations */
    34     Ui::VBoxTakeSnapshotDlg::setupUi (this);
     35    Ui::VBoxTakeSnapshotDlg::setupUi(this);
    3536
    36     QIAltKeyFilter *af = new QIAltKeyFilter (this);
    37     af->watchOn (mLeName);
     37    /* Alt key filter */
     38    QIAltKeyFilter *altKeyFilter = new QIAltKeyFilter(this);
     39    altKeyFilter->watchOn(mLeName);
    3840
    3941    /* Setup connections */
    40     connect (mButtonBox, SIGNAL (helpRequested()),
    41              &vboxProblem(), SLOT (showHelpHelpDialog()));
    42     connect (mLeName, SIGNAL (textChanged (const QString &)),
    43              this, SLOT (nameChanged (const QString &)));
     42    connect (mButtonBox, SIGNAL(helpRequested()), &vboxProblem(), SLOT(showHelpHelpDialog()));
     43    connect (mLeName, SIGNAL(textChanged(const QString &)), this, SLOT(nameChanged(const QString &)));
     44
     45    /* Check if machine have immutable attachments */
     46    int immutableMediums = 0;
     47
     48    if (machine.GetState() == KMachineState_Paused)
     49    {
     50        foreach (const CMediumAttachment &attachment, machine.GetMediumAttachments())
     51        {
     52            CMedium medium = attachment.GetMedium();
     53            if (!medium.isNull() && !medium.GetParent().isNull() && medium.GetBase().GetType() == KMediumType_Immutable)
     54                ++ immutableMediums;
     55        }
     56    }
     57
     58    if (immutableMediums)
     59    {
     60        mLbInfo->setText(tr("Warning: You are taking a snapshot of a running machine which has %n immutable image(s) "
     61                            "attached to it. The automatic resetting of the immutable image(s) will not occur while "
     62                            "the snapshot you are taking is the current snapshot to avoid data corruption.", "",
     63                            immutableMediums));
     64        mLbInfo->useSizeHintForWidth(400);
     65    }
     66    else
     67    {
     68        QGridLayout *lt = qobject_cast<QGridLayout*>(layout());
     69        lt->removeWidget (mLbInfo);
     70        mLbInfo->setHidden (true);
     71
     72        lt->removeWidget (mButtonBox);
     73        lt->addWidget (mButtonBox, 2, 0, 1, 2);
     74    }
    4475
    4576    retranslateUi();
     
    4980{
    5081    /* Translate uic generated strings */
    51     Ui::VBoxTakeSnapshotDlg::retranslateUi (this);
     82    Ui::VBoxTakeSnapshotDlg::retranslateUi(this);
    5283}
    5384
    54 void VBoxTakeSnapshotDlg::nameChanged (const QString &aName)
     85void VBoxTakeSnapshotDlg::nameChanged(const QString &strName)
    5586{
    56     mButtonBox->button (QDialogButtonBox::Ok)->setEnabled (!aName.trimmed().isEmpty());
     87    mButtonBox->button(QDialogButtonBox::Ok)->setEnabled(!strName.trimmed().isEmpty());
    5788}
    5889
  • trunk/src/VBox/Frontends/VirtualBox/ui/VBoxTakeSnapshotDlg.ui

    r8743 r25116  
    33 VBox frontends: Qt4 GUI ("VirtualBox"):
    44
    5  Copyright (C) 2008 Sun Microsystems, Inc.
     5 Copyright (C) 2008-2009 Sun Microsystems, Inc.
    66
    77 This file is part of VirtualBox Open Source Edition (OSE), as
     
    1818 </comment>
    1919 <class>VBoxTakeSnapshotDlg</class>
    20  <widget class="QDialog" name="VBoxTakeSnapshotDlg" >
    21   <property name="geometry" >
     20 <widget class="QDialog" name="VBoxTakeSnapshotDlg">
     21  <property name="geometry">
    2222   <rect>
    2323    <x>0</x>
    2424    <y>0</y>
    25     <width>314</width>
    26     <height>239</height>
     25    <width>300</width>
     26    <height>240</height>
    2727   </rect>
    2828  </property>
     
    3030   <string>Take Snapshot of Virtual Machine</string>
    3131  </property>
    32   <layout class="QVBoxLayout" >
    33    <item>
    34     <layout class="QHBoxLayout" >
     32  <layout class="QGridLayout">
     33   <item rowspan="2" row="0" column="0">
     34    <layout class="QVBoxLayout">
    3535     <item>
    36       <layout class="QVBoxLayout" >
    37        <item>
    38         <widget class="QLabel" name="mLbIcon" >
    39          <property name="sizePolicy" >
    40           <sizepolicy vsizetype="Preferred" hsizetype="Maximum" >
    41            <horstretch>0</horstretch>
    42            <verstretch>0</verstretch>
    43           </sizepolicy>
    44          </property>
    45          <property name="text" >
    46           <string/>
    47          </property>
    48         </widget>
    49        </item>
    50        <item>
    51         <spacer>
    52          <property name="orientation" >
    53           <enum>Qt::Vertical</enum>
    54          </property>
    55          <property name="sizeHint" >
    56           <size>
    57            <width>20</width>
    58            <height>40</height>
    59           </size>
    60          </property>
    61         </spacer>
    62        </item>
    63       </layout>
     36      <widget class="QLabel" name="mLbIcon">
     37       <property name="sizePolicy" >
     38        <sizepolicy vsizetype="Preferred" hsizetype="Maximum">
     39         <horstretch>0</horstretch>
     40         <verstretch>0</verstretch>
     41        </sizepolicy>
     42       </property>
     43      </widget>
    6444     </item>
    6545     <item>
    66       <layout class="QVBoxLayout" >
    67        <property name="spacing" >
    68         <number>10</number>
     46      <spacer>
     47       <property name="orientation">
     48        <enum>Qt::Vertical</enum>
    6949       </property>
    70        <item>
    71         <layout class="QVBoxLayout" >
    72          <property name="spacing" >
    73           <number>2</number>
    74          </property>
    75          <item>
    76           <widget class="QLabel" name="mLbName" >
    77            <property name="text" >
    78             <string>Snapshot &amp;Name</string>
    79            </property>
    80            <property name="buddy" >
    81             <cstring>mLeName</cstring>
    82            </property>
    83           </widget>
    84          </item>
    85          <item>
    86           <widget class="QLineEdit" name="mLeName" />
    87          </item>
    88         </layout>
    89        </item>
    90        <item>
    91         <layout class="QVBoxLayout" >
    92          <property name="spacing" >
    93           <number>2</number>
    94          </property>
    95          <item>
    96           <widget class="QLabel" name="mLbDescription" >
    97            <property name="text" >
    98             <string>Snapshot &amp;Description</string>
    99            </property>
    100            <property name="buddy" >
    101             <cstring>mTeDescription</cstring>
    102            </property>
    103           </widget>
    104          </item>
    105          <item>
    106           <widget class="QTextEdit" name="mTeDescription" />
    107          </item>
    108         </layout>
    109        </item>
    110       </layout>
     50       <property name="sizeHint">
     51        <size>
     52         <width>0</width>
     53         <height>0</height>
     54        </size>
     55       </property>
     56      </spacer>
    11157     </item>
    11258    </layout>
    11359   </item>
    114    <item>
    115     <widget class="QIDialogButtonBox" name="mButtonBox" >
    116      <property name="standardButtons" >
     60   <item row="0" column="1">
     61    <layout class="QVBoxLayout">
     62     <property name="spacing">
     63      <number>2</number>
     64     </property>
     65     <item>
     66      <widget class="QLabel" name="mLbName">
     67       <property name="text" >
     68        <string>Snapshot &amp;Name</string>
     69       </property>
     70       <property name="buddy" >
     71        <cstring>mLeName</cstring>
     72       </property>
     73      </widget>
     74     </item>
     75     <item>
     76      <widget class="QLineEdit" name="mLeName"/>
     77     </item>
     78    </layout>
     79   </item>
     80   <item row="1" column="1">
     81    <layout class="QVBoxLayout">
     82     <property name="spacing">
     83      <number>2</number>
     84     </property>
     85     <item>
     86      <widget class="QLabel" name="mLbDescription">
     87       <property name="text">
     88        <string>Snapshot &amp;Description</string>
     89       </property>
     90       <property name="buddy">
     91        <cstring>mTeDescription</cstring>
     92       </property>
     93      </widget>
     94     </item>
     95     <item>
     96      <widget class="QTextEdit" name="mTeDescription"/>
     97     </item>
     98    </layout>
     99   </item>
     100   <item row="2" column="0" colspan="2">
     101    <widget class="QILabel" name="mLbInfo">
     102     <property name="sizePolicy" >
     103      <sizepolicy vsizetype="Preferred" hsizetype="Preferred">
     104       <horstretch>0</horstretch>
     105       <verstretch>0</verstretch>
     106      </sizepolicy>
     107     </property>
     108     <property name="wordWrap">
     109      <bool>true</bool>
     110     </property>
     111    </widget>
     112   </item>
     113   <item row="3" column="0" colspan="2">
     114    <widget class="QIDialogButtonBox" name="mButtonBox">
     115     <property name="standardButtons">
    117116      <set>QDialogButtonBox::Cancel|QDialogButtonBox::Help|QDialogButtonBox::NoButton|QDialogButtonBox::Ok</set>
    118117     </property>
     
    122121 </widget>
    123122 <customwidgets>
     123  <customwidget>
     124   <class>QILabel</class>
     125   <extends>QLabel</extends>
     126   <header>QILabel.h</header>
     127  </customwidget>
    124128  <customwidget>
    125129   <class>QIDialogButtonBox</class>
     
    136140   <slot>accept()</slot>
    137141   <hints>
    138     <hint type="sourcelabel" >
     142    <hint type="sourcelabel">
    139143     <x>156</x>
    140144     <y>216</y>
    141145    </hint>
    142     <hint type="destinationlabel" >
     146    <hint type="destinationlabel">
    143147     <x>156</x>
    144148     <y>119</y>
     
    152156   <slot>reject()</slot>
    153157   <hints>
    154     <hint type="sourcelabel" >
     158    <hint type="sourcelabel">
    155159     <x>156</x>
    156160     <y>216</y>
    157161    </hint>
    158     <hint type="destinationlabel" >
     162    <hint type="destinationlabel">
    159163     <x>156</x>
    160164     <y>119</y>
Note: See TracChangeset for help on using the changeset viewer.

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