diff options
author | Amaury Pouly <amaury.pouly@gmail.com> | 2014-09-27 21:24:18 +0200 |
---|---|---|
committer | Amaury Pouly <amaury.pouly@gmail.com> | 2014-12-15 22:53:03 +0100 |
commit | 4a711fee423b00698313ac9c9a8df4f25696f8dd (patch) | |
tree | 3547d000faabd96d4c319ebabde5dc9f8a0941e3 /utils/regtools | |
parent | 99ed6d2bea6b8bc76b9775aea4735b68c19f175f (diff) | |
download | rockbox-4a711fee423b00698313ac9c9a8df4f25696f8dd.tar.gz rockbox-4a711fee423b00698313ac9c9a8df4f25696f8dd.zip |
qeditor: display message on "Nothing" backend selection
Change-Id: I071c79500f55afe0b6342cbb5a26a9fddba35d94
Reviewed-on: http://gerrit.rockbox.org/996
Reviewed-by: Amaury Pouly <amaury.pouly@gmail.com>
Diffstat (limited to 'utils/regtools')
-rw-r--r-- | utils/regtools/qeditor/regtab.cpp | 1 | ||||
-rw-r--r-- | utils/regtools/qeditor/utils.cpp | 17 | ||||
-rw-r--r-- | utils/regtools/qeditor/utils.h | 5 |
3 files changed, 19 insertions, 4 deletions
diff --git a/utils/regtools/qeditor/regtab.cpp b/utils/regtools/qeditor/regtab.cpp index 32d08a73d3..3a1c702dc7 100644 --- a/utils/regtools/qeditor/regtab.cpp +++ b/utils/regtools/qeditor/regtab.cpp @@ -134,6 +134,7 @@ RegTab::RegTab(Backend *backend, QWidget *parent) QGroupBox *data_sel_group = new QGroupBox("Data selection"); QHBoxLayout *data_sel_layout = new QHBoxLayout; m_backend_selector = new BackendSelector(m_backend, this); + m_backend_selector->SetNothingMessage("<i>Select a data source to analyse its content.</i>"); m_readonly_check = new QCheckBox("Read-only"); m_readonly_check->setCheckState(Qt::Checked); m_data_soc_label = new QLabel; diff --git a/utils/regtools/qeditor/utils.cpp b/utils/regtools/qeditor/utils.cpp index 677d24dd7f..da5e44ab71 100644 --- a/utils/regtools/qeditor/utils.cpp +++ b/utils/regtools/qeditor/utils.cpp @@ -825,17 +825,20 @@ bool MySwitchableTextEditor::IsModified() BackendSelector::BackendSelector(Backend *backend, QWidget *parent) :QWidget(parent), m_backend(backend) { - m_data_selector = new QComboBox; + m_data_selector = new QComboBox(this); m_data_selector->addItem(QIcon::fromTheme("text-x-generic"), "Nothing...", QVariant(DataSelNothing)); m_data_selector->addItem(QIcon::fromTheme("document-open"), "File...", QVariant(DataSelFile)); #ifdef HAVE_HWSTUB m_data_selector->addItem(QIcon::fromTheme("multimedia-player"), "Device...", QVariant(DataSelDevice)); #endif - m_data_sel_edit = new QLineEdit; + m_data_sel_edit = new QLineEdit(this); m_data_sel_edit->setReadOnly(true); + m_nothing_text = new QLabel(this); + m_nothing_text->setTextFormat(Qt::RichText); QHBoxLayout *data_sel_layout = new QHBoxLayout(this); data_sel_layout->addWidget(m_data_selector); data_sel_layout->addWidget(m_data_sel_edit, 1); + data_sel_layout->addWidget(m_nothing_text, 1); data_sel_layout->addStretch(0); #ifdef HAVE_HWSTUB m_dev_selector = new QComboBox; @@ -863,6 +866,11 @@ BackendSelector::~BackendSelector() delete m_io_backend; } +void BackendSelector::SetNothingMessage(const QString& msg) +{ + m_nothing_text->setText(msg); +} + void BackendSelector::OnDataSelChanged(int index) { if(index == -1) @@ -870,6 +878,7 @@ void BackendSelector::OnDataSelChanged(int index) QVariant var = m_data_selector->itemData(index); if(var == DataSelFile) { + m_nothing_text->hide(); m_data_sel_edit->show(); #ifdef HAVE_HWSTUB m_dev_selector->hide(); @@ -888,7 +897,8 @@ void BackendSelector::OnDataSelChanged(int index) #ifdef HAVE_HWSTUB else if(var == DataSelDevice) { - m_data_sel_edit->hide();; + m_nothing_text->hide(); + m_data_sel_edit->hide(); m_dev_selector->show(); OnDevListChanged(); } @@ -896,6 +906,7 @@ void BackendSelector::OnDataSelChanged(int index) else { m_data_sel_edit->hide(); + m_nothing_text->show(); #ifdef HAVE_HWSTUB m_dev_selector->hide(); #endif diff --git a/utils/regtools/qeditor/utils.h b/utils/regtools/qeditor/utils.h index ec3175b5da..a2a95f1cac 100644 --- a/utils/regtools/qeditor/utils.h +++ b/utils/regtools/qeditor/utils.h @@ -304,11 +304,14 @@ public: BackendSelector(Backend *backend, QWidget *parent = 0); virtual ~BackendSelector(); IoBackend *GetBackend(); + void SetNothingMessage(const QString& msg); signals: void OnSelect(IoBackend *backend); protected: + void ChangeBackend(IoBackend *new_backend); + enum { DataSelNothing, @@ -326,7 +329,7 @@ protected: QComboBox *m_dev_selector; HWStubBackendHelper m_hwstub_helper; #endif - void ChangeBackend(IoBackend *new_backend); + QLabel *m_nothing_text; private slots: #ifdef HAVE_HWSTUB |