1
0
Fork 0
forked from len0rd/rockbox

qeditor: rework mainwindow tab names handling

With the previous code, tab names would be ignored if tab is detached
which can happen early on.

Change-Id: I9eac4202850f3e79a04590a4ba1444850ec6a583
Reviewed-on: http://gerrit.rockbox.org/986
Reviewed-by: Amaury Pouly <amaury.pouly@gmail.com>
This commit is contained in:
Amaury Pouly 2014-09-27 13:28:44 +02:00
parent fe1fed8873
commit 3b4e63173d
4 changed files with 20 additions and 7 deletions

View file

@ -43,8 +43,15 @@ void DocumentTab::OnModified(bool modified)
m_tab->SetTabModified(this, modified);
}
void DocumentTab::SetTabWidget(MyTabWidget *tab)
{
m_tab = tab;
SetTabName(m_tabname);
}
void DocumentTab::SetTabName(const QString& name)
{
m_tabname = name;
if(m_tab)
m_tab->SetTabName(this, name);
}
@ -201,20 +208,20 @@ void MainWindow::OnLoadDesc()
}
}
void MainWindow::AddTab(DocumentTab *doc, const QString& title)
void MainWindow::AddTab(DocumentTab *doc)
{
m_tab->setCurrentIndex(m_tab->addTab(doc->GetWidget(), title));
m_tab->setCurrentIndex(m_tab->addTab(doc->GetWidget(), ""));
doc->SetTabWidget(m_tab);
}
void MainWindow::OnNewRegTab()
{
AddTab(new RegTab(m_backend, this), "Register Tab");
AddTab(new RegTab(m_backend, this));
}
void MainWindow::OnNewRegEdit()
{
AddTab(new RegEdit(m_backend, this), "Register Editor");
AddTab(new RegEdit(m_backend, this));
}
bool MainWindow::Quit()