Skip to content

Commit 6b65740

Browse files
committed
Create new DataView window if use menu Data->New Item(s) and no DataView is created
1 parent 95ffb5e commit 6b65740

File tree

2 files changed

+25
-13
lines changed

2 files changed

+25
-13
lines changed

src/core/gui/core_ui.cpp

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -393,23 +393,35 @@ void mbCoreUi::menuSlotDeviceExport()
393393

394394
void ::mbCoreUi::menuSlotDataViewItemNew()
395395
{
396-
mbCoreDataView *wl = m_dataViewManager->activeDataViewCore();
397-
if (wl)
396+
MBSETTINGS p = dialogsCore()->getDataViewItem(MBSETTINGS(), "New Item(s)");
397+
if (p.count())
398398
{
399-
MBSETTINGS p = dialogsCore()->getDataViewItem(MBSETTINGS(), "New Item(s)");
400-
if (p.count())
399+
const mbCoreDataViewItem::Strings &sItem = mbCoreDataViewItem::Strings::instance();
400+
int count = p.value(mbCoreDialogDataViewItem::Strings::instance().count).toInt();
401+
if (count > 0)
401402
{
402-
const mbCoreDataViewItem::Strings &sItem = mbCoreDataViewItem::Strings::instance();
403-
int count = p.value(mbCoreDialogDataViewItem::Strings::instance().count).toInt();
404-
if (count > 0)
403+
mbCoreDataView *wl = m_dataViewManager->activeDataViewCore();
404+
if (!wl)
405405
{
406-
for (int i = 0; i < count; i++)
406+
QList<mbCoreDataViewUi*> ls = m_dataViewManager->dataViewUisCore();
407+
if (ls.count())
408+
wl = ls.first()->dataViewCore();
409+
else
407410
{
408-
mbCoreDataViewItem *item = builderCore()->newDataViewItem();
409-
item->setSettings(p);
410-
wl->itemAdd(item);
411-
p[sItem.address] = item->addressInt() + item->length();
411+
mbCoreProject *project = baseCore()->projectCore();
412+
if (!project)
413+
return;
414+
wl = m_builder->newDataView();
415+
project->dataViewAdd(wl);
412416
}
417+
418+
}
419+
for (int i = 0; i < count; i++)
420+
{
421+
mbCoreDataViewItem *item = builderCore()->newDataViewItem();
422+
item->setSettings(p);
423+
wl->itemAdd(item);
424+
p[sItem.address] = item->addressInt() + item->length();
413425
}
414426
}
415427
}

src/core/gui/core_ui.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ protected Q_SLOTS:
138138
virtual void menuSlotDeviceImport();
139139
virtual void menuSlotDeviceExport();
140140
// ----------------------------
141-
// ---------WATCH LIST---------
141+
// --------- DATA VIEW --------
142142
// ----------------------------
143143
virtual void menuSlotDataViewItemNew ();
144144
virtual void menuSlotDataViewItemEdit ();

0 commit comments

Comments
 (0)