forked from qt-creator/qt-creator
Device support: Disable some widgets when there are no devices.
Change-Id: I7849054f6a3942bf6d8affdf1cdc5a7d28fb997d Reviewed-by: Tobias Hunger <tobias.hunger@nokia.com>
This commit is contained in:
@@ -197,6 +197,14 @@ void DeviceSettingsWidget::displayCurrent()
|
|||||||
fillInValues();
|
fillInValues();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DeviceSettingsWidget::setDeviceInfoWidgetsEnabled(bool enable)
|
||||||
|
{
|
||||||
|
m_ui->configurationLabel->setEnabled(enable);
|
||||||
|
m_ui->configurationComboBox->setEnabled(enable);
|
||||||
|
m_ui->generalGroupBox->setEnabled(enable);
|
||||||
|
m_ui->osSpecificGroupBox->setEnabled(enable);
|
||||||
|
}
|
||||||
|
|
||||||
void DeviceSettingsWidget::fillInValues()
|
void DeviceSettingsWidget::fillInValues()
|
||||||
{
|
{
|
||||||
const IDevice::ConstPtr ¤t = currentDevice();
|
const IDevice::ConstPtr ¤t = currentDevice();
|
||||||
@@ -252,10 +260,12 @@ void DeviceSettingsWidget::currentDeviceChanged(int index)
|
|||||||
m_additionalActionButtons.clear();
|
m_additionalActionButtons.clear();
|
||||||
const IDevice::ConstPtr device = m_deviceManagerModel->device(index);
|
const IDevice::ConstPtr device = m_deviceManagerModel->device(index);
|
||||||
if (device.isNull()) {
|
if (device.isNull()) {
|
||||||
|
setDeviceInfoWidgetsEnabled(false);
|
||||||
m_ui->removeConfigButton->setEnabled(false);
|
m_ui->removeConfigButton->setEnabled(false);
|
||||||
clearDetails();
|
clearDetails();
|
||||||
m_ui->defaultDeviceButton->setEnabled(false);
|
m_ui->defaultDeviceButton->setEnabled(false);
|
||||||
} else {
|
} else {
|
||||||
|
setDeviceInfoWidgetsEnabled(true);
|
||||||
m_ui->removeConfigButton->setEnabled(true);
|
m_ui->removeConfigButton->setEnabled(true);
|
||||||
foreach (const Core::Id actionId, device->actionIds()) {
|
foreach (const Core::Id actionId, device->actionIds()) {
|
||||||
QPushButton * const button = new QPushButton(device->displayNameForActionId(actionId));
|
QPushButton * const button = new QPushButton(device->displayNameForActionId(actionId));
|
||||||
|
@@ -75,6 +75,7 @@ private slots:
|
|||||||
private:
|
private:
|
||||||
void initGui();
|
void initGui();
|
||||||
void displayCurrent();
|
void displayCurrent();
|
||||||
|
void setDeviceInfoWidgetsEnabled(bool enable);
|
||||||
QSharedPointer<const IDevice> currentDevice() const;
|
QSharedPointer<const IDevice> currentDevice() const;
|
||||||
int currentIndex() const;
|
int currentIndex() const;
|
||||||
void clearDetails();
|
void clearDetails();
|
||||||
|
Reference in New Issue
Block a user