mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-02-27 16:54:15 +01:00
OP-781: cleaned up; added comments; removed some debug code; fixed tabs
into spaces
This commit is contained in:
parent
87632e6e13
commit
d0447b5e06
@ -126,10 +126,9 @@ SettingsDialog::SettingsDialog(QWidget *parent, const QString &categoryId,
|
||||
|
||||
QList<IOptionsPage*> pages = sortedOptionsPages();
|
||||
|
||||
QTreeWidgetItem *initialItem = 0;
|
||||
|
||||
int index = 0;
|
||||
bool firstUavGadgetOptionsPageFound = false;
|
||||
QTreeWidgetItem *initialItem = 0;
|
||||
foreach (IOptionsPage *page, pages) {
|
||||
PageData pageData;
|
||||
pageData.index = index;
|
||||
@ -143,9 +142,6 @@ SettingsDialog::SettingsDialog(QWidget *parent, const QString &categoryId,
|
||||
QString trCategories = page->trCategory();
|
||||
QString currentCategory = page->category();
|
||||
|
||||
//qDebug() << "currentCategory: " << currentCategory;
|
||||
//qDebug() << "page id: " << page->id();
|
||||
|
||||
QTreeWidgetItem *categoryItem;
|
||||
if (!categories.contains(currentCategory)) {
|
||||
// Above the first gadget option we insert a separator
|
||||
@ -178,8 +174,6 @@ SettingsDialog::SettingsDialog(QWidget *parent, const QString &categoryId,
|
||||
// the real option page widget will be created later when the user selects it
|
||||
// the place holder is a QLabel and we assume that no option page will be a QLabel...
|
||||
QLabel * placeholderWidget = new QLabel(stackedPages);
|
||||
placeholderWidget->setText("page placeholder");
|
||||
// add widget
|
||||
stackedPages->addWidget(placeholderWidget);
|
||||
|
||||
if (page->id() == initialPage && currentCategory == initialCategory) {
|
||||
@ -199,18 +193,11 @@ SettingsDialog::SettingsDialog(QWidget *parent, const QString &categoryId,
|
||||
}
|
||||
}
|
||||
|
||||
qDebug() << "initialItem: " << initialItem;
|
||||
if (initialItem) {
|
||||
qDebug() << "initialItem text: " << initialItem->text(0);
|
||||
qDebug() << "initialItem selected: " << initialItem->isSelected();
|
||||
qDebug() << "initialItem parent: " << initialItem->parent();
|
||||
if (!initialItem->parent()) {
|
||||
// item has no parent, meaning it is single child
|
||||
// so select category item instead
|
||||
// so select category item instead as single child are not added to the tree
|
||||
initialItem = categories.value(initialCategory);
|
||||
qDebug() << "initialItem text: " << initialItem->text(0);
|
||||
qDebug() << "initialItem selected: " << initialItem->isSelected();
|
||||
qDebug() << "initialItem parent: " << initialItem->parent();
|
||||
}
|
||||
pageTree->setCurrentItem(initialItem);
|
||||
}
|
||||
@ -241,7 +228,6 @@ SettingsDialog::~SettingsDialog()
|
||||
void SettingsDialog::pageSelected()
|
||||
{
|
||||
QTreeWidgetItem *item = pageTree->currentItem();
|
||||
qDebug() << "pageSelected: " << item;
|
||||
if (!item)
|
||||
return;
|
||||
|
||||
@ -252,10 +238,10 @@ void SettingsDialog::pageSelected()
|
||||
// check if we are looking at a place holder or not
|
||||
QWidget *widget = dynamic_cast<QLabel*>(stackedPages->widget(index));
|
||||
if (widget) {
|
||||
// get rid of placeholder
|
||||
// place holder found, get rid of it...
|
||||
stackedPages->removeWidget(widget);
|
||||
delete widget;
|
||||
// insert real page
|
||||
// and replace place holder with actual option page
|
||||
IOptionsPage *page = m_pages.at(index);
|
||||
stackedPages->insertWidget(index, page->createPage(stackedPages));
|
||||
}
|
||||
@ -358,7 +344,6 @@ void SettingsDialog::accept()
|
||||
|
||||
void SettingsDialog::reject()
|
||||
{
|
||||
// foreach (IOptionsPage *page, m_pages)
|
||||
for (int i = 0; i < m_pages.size(); i++) {
|
||||
QWidget * widget = dynamic_cast<QLabel*>(stackedPages->widget(i));
|
||||
if (!widget) {
|
||||
@ -371,7 +356,6 @@ void SettingsDialog::reject()
|
||||
|
||||
void SettingsDialog::apply()
|
||||
{
|
||||
// foreach (IOptionsPage *page, m_pages)
|
||||
for (int i = 0; i < m_pages.size(); i++) {
|
||||
QWidget * widget = dynamic_cast<QLabel*>(stackedPages->widget(i));
|
||||
if (!widget) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user