VirtualBox

source: vbox/trunk/src/VBox/Frontends/VirtualBox/ui/VBoxVMParallelPortSettings.ui.h@ 5999

最後變更 在這個檔案從5999是 5999,由 vboxsync 提交於 17 年 前

The Giant CDDL Dual-License Header Change.

  • 屬性 svn:eol-style 設為 native
  • 屬性 svn:keywords 設為 Author Date Id Revision
檔案大小: 3.1 KB
 
1/**
2 *
3 * VBox frontends: Qt GUI ("VirtualBox"):
4 * "VM parallel port settings" dialog UI include (Qt Designer)
5 */
6
7/*
8 * Copyright (C) 2006-2007 innotek GmbH
9 *
10 * innotek GmbH confidential
11 * All rights reserved
12 */
13
14/****************************************************************************
15** ui.h extension file, included from the uic-generated form implementation.
16**
17** If you wish to add, delete or rename functions or slots use
18** Qt Designer which will update this file, preserving your code. Create an
19** init() function in place of a constructor, and a destroy() function in
20** place of a destructor.
21*****************************************************************************/
22
23
24void VBoxVMParallelPortSettings::init()
25{
26 /* setup validation */
27
28 mIRQLine->setValidator (new QIULongValidator (0, 255, this));
29 mIOPortLine->setValidator (new QIULongValidator (0, 0xFFFF, this));
30
31 mPortPathLine->setValidator (new QRegExpValidator (QRegExp (".+"), this));
32
33 /* setup constraints */
34
35 mIRQLine->setMaximumWidth (mIRQLine->fontMetrics().width ("888888")
36 + mIRQLine->frameWidth() * 2);
37 mIRQLine->setMinimumWidth (mIRQLine->minimumWidth());
38
39 mIOPortLine->setMaximumWidth (mIOPortLine->fontMetrics().width ("8888888")
40 + mIOPortLine->frameWidth() * 2);
41 mIOPortLine->setMinimumWidth (mIOPortLine->minimumWidth());
42
43 /* set initial values */
44
45 mPortNumCombo->insertStringList (vboxGlobal().LPTPortNames());
46 mPortNumCombo->insertItem (vboxGlobal().toLPTPortName (0, 0));
47}
48
49void VBoxVMParallelPortSettings::getFromPort (const CParallelPort &aPort)
50{
51 mPort = aPort;
52
53 mParallelPortBox->setChecked (mPort.GetEnabled());
54
55 ulong IRQ = mPort.GetIRQ();
56 ulong IOBase = mPort.GetIOBase();
57 mPortNumCombo->setCurrentText (vboxGlobal().toLPTPortName (IRQ, IOBase));
58 mIRQLine->setText (QString::number (IRQ));
59 mIOPortLine->setText ("0x" + QString::number (IOBase, 16).upper());
60
61 mPortPathLine->setText (mPort.GetPath());
62
63 /* ensure everything is up-to-date */
64 mParallelPortBox_toggled (mParallelPortBox->isChecked());
65}
66
67void VBoxVMParallelPortSettings::putBackToPort()
68{
69 mPort.SetEnabled (mParallelPortBox->isChecked());
70
71 mPort.SetIRQ (mIRQLine->text().toULong (NULL, 0));
72 mPort.SetIOBase (mIOPortLine->text().toULong (NULL, 0));
73
74 mPort.SetPath (QDir::convertSeparators (mPortPathLine->text()));
75}
76
77bool VBoxVMParallelPortSettings::isUserDefined()
78{
79 ulong a, b;
80 return !vboxGlobal().toLPTPortNumbers (mPortNumCombo->currentText(), a, b);
81}
82
83void VBoxVMParallelPortSettings::mParallelPortBox_toggled (bool aOn)
84{
85 if (aOn)
86 mPortNumCombo_activated (mPortNumCombo->currentText());
87}
88
89void VBoxVMParallelPortSettings::mPortNumCombo_activated (const QString &aText)
90{
91 ulong IRQ, IOBase;
92 bool std = vboxGlobal().toLPTPortNumbers (aText, IRQ, IOBase);
93
94 mIRQLine->setEnabled (!std);
95 mIOPortLine->setEnabled (!std);
96 if (std)
97 {
98 mIRQLine->setText (QString::number (IRQ));
99 mIOPortLine->setText ("0x" + QString::number (IOBase, 16).upper());
100 }
101}
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

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