Fixed private storage and initial memory resizing.

This commit is contained in:
Agnieszka Kostrzewa 2012-03-14 12:51:11 +01:00
parent b3dbbe5fa3
commit 9964ff133c
2 changed files with 45 additions and 35 deletions

View File

@ -263,13 +263,11 @@ class VMSettingsWindow(Ui_SettingsDialog, QDialog):
else:
self.networking_groupbox.setEnabled(False);
#max priv storage
self.priv_img_size = self.vm.get_private_img_sz()/1024/1024
self.max_priv_storage.setMinimum(self.priv_img_size)
self.max_priv_storage.setValue(self.priv_img_size)
#max priv size
self.priv_size.setValue(int(self.vm.memory))
self.priv_size.setMaximum(QubesHost().memory_total/1024)
#self.vmname.selectAll()
#self.vmname.setFocus()
def __apply_basic_tab__(self):
msg = []
@ -330,11 +328,15 @@ class VMSettingsWindow(Ui_SettingsDialog, QDialog):
if self.vm.include_in_backups != self.include_in_backups.isChecked():
self.vm.include_in_backups = self.include_in_backups.isChecked()
#max priv size
priv_size = self.priv_size.value()
if self.vm.memory != priv_size:
self.vm.memory = priv_size
self.anything_changed = True
#max priv storage
priv_size = self.max_priv_storage.value()
if self.priv_img_size != priv_size:
try:
self.vm.resize_private_img(priv_size*1024*1024)
self.anything_changed = True
except Exception as ex:
msg.append(str(ex))
return msg
@ -344,7 +346,8 @@ class VMSettingsWindow(Ui_SettingsDialog, QDialog):
def __init_advanced_tab__(self):
#mem/cpu
self.mem_size.setText(str(self.vm.memory))
self.init_mem.setValue(int(self.vm.memory))
self.init_mem.setMaximum(int(self.vm.maxmem))
self.max_mem_size.setValue(int(self.vm.maxmem))
self.max_mem_size.setMaximum(QubesHost().memory_total/1024)
@ -399,6 +402,10 @@ class VMSettingsWindow(Ui_SettingsDialog, QDialog):
def __apply_advanced_tab__(self):
#mem/cpu
if self.init_mem.value() != int(self.vm.memory):
self.vm.memory = self.init_mem.value()
self.anything_changed = True
if self.max_mem_size.value() != int(self.vm.maxmem):
self.vm.maxmem = self.max_mem_size.value()
self.anything_changed = True

View File

@ -29,7 +29,7 @@
<locale language="English" country="UnitedStates"/>
</property>
<property name="currentIndex">
<number>5</number>
<number>0</number>
</property>
<widget class="QWidget" name="basic_tab">
<property name="locale">
@ -163,8 +163,15 @@
<string>Disk storage</string>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Private storage max. size:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QSpinBox" name="priv_size">
<widget class="QSpinBox" name="max_priv_storage">
<property name="enabled">
<bool>true</bool>
</property>
@ -172,16 +179,16 @@
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="minimum">
<number>256</number>
<number>0</number>
</property>
<property name="maximum">
<number>10000</number>
<number>1048576</number>
</property>
<property name="singleStep">
<number>256</number>
<number>512</number>
</property>
<property name="value">
<number>256</number>
<number>0</number>
</property>
</widget>
</item>
@ -192,13 +199,6 @@
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Private storage max. size:</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
@ -314,22 +314,25 @@
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="mem_size">
<widget class="QSpinBox" name="init_mem">
<property name="enabled">
<bool>true</bool>
</property>
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>xx</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="minimum">
<number>256</number>
</property>
<property name="maximum">
<number>10000</number>
</property>
<property name="singleStep">
<number>256</number>
</property>
<property name="value">
<number>256</number>
</property>
</widget>
</item>
<item row="0" column="2">