ZoneChooserView::ZoneChooserView(QWidget* parent)
    : QWidget(parent)
{
    QVBoxLayout * mainLayout = new QVBoxLayout();

    mainLayout->setContentsMargins(0,0,0,0);

    this->setLayout(mainLayout);

    QScrollArea * scrollArea = new QScrollArea();

    scrollArea->setWidgetResizable(true);

    scrollArea->setFrameStyle(QFrame::NoFrame);

    mainLayout->addWidget(scrollArea);

    QWidget * scrollWidget = new QWidget();

    scrollArea->setWidget(scrollWidget);

    m_vLayout = new QVBoxLayout();

    m_vLayout->setContentsMargins(0,0,0,0);

    scrollWidget->setLayout(m_vLayout);
}
Example #2
0
void SettingsBottomView::rowsInserted(
  const QModelIndex& parent, int start, int end) {
  QModelIndex index;
  QGridLayout* layout;
  QWidget* page;

  if (!parent.isValid()) {
    layout = new QGridLayout();

    layout->setHorizontalSpacing(5);
    layout->setVerticalSpacing(5);
    layout->setContentsMargins(5, 5, 5, 5);

    QScrollArea* scrollArea = new QScrollArea();

    page = new QWidget();
    page->setLayout(layout);
    page->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Expanding);
    page->setMinimumSize(0, 0);

    scrollArea->setFrameStyle(QFrame::NoFrame);
    scrollArea->setWidget(page);
    scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);

    stack->addWidget(scrollArea);
  }

  // Invalid insertion index will mark insertion of a group
  insertionIndex = parent;
}
Example #3
0
void SettingsBottomView::createEditors() {
  QModelIndex index;
  QGridLayout* layout;

  if (!model()) {
    return;
  }

  delete stack;
  stack = new QStackedWidget(this);

  for (int page = 0; page < model()->rowCount(); ++page) {
    layout = new QGridLayout();

    // Create labels and editors
    index = model()->index(page, 0);
    int row;
    for (row = 0; row < model()->rowCount(index); ++row) {
      QModelIndex child = model()->index(row, 0, index);
      QString description = getSettingDescription(child);

      QLabel* label = new QLabel(description, NULL);
      label->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Minimum);
      layout->addWidget(label, row, 0);

      QWidget* editor = createEditorForIndex(child);
      editor->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
      layout->addWidget(editor, row, 1);

      editor->show();
    }

    // Adding a stretcher at the bottom of all settings
    QWidget* dummy = new QWidget();
    layout->addWidget(dummy, row, 0);
    layout->setRowStretch(row, 1);

    // Setting space on the page
    layout->setHorizontalSpacing(5);
    layout->setVerticalSpacing(5);
    layout->setContentsMargins(5, 5, 5, 5);

    QScrollArea* scrollArea = new QScrollArea();

    QWidget* pageWidget = new QWidget();
    pageWidget->setLayout(layout);
    pageWidget->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Expanding);
    pageWidget->setMinimumSize(0, 0);

    scrollArea->setFrameStyle(QFrame::NoFrame);
    scrollArea->setWidget(pageWidget);
    scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);

    stack->addWidget(scrollArea);
  }

  this->layout()->addWidget(stack);
}
Example #4
0
void AppearanceSettings::initUi()
{
    m_themeCombo = new QComboBox;
    m_themeCombo->setModel(new QStringListModel(this));
    connect(m_themeCombo, SIGNAL(currentIndexChanged(int)), SLOT(themeChanged(int)));

    m_colorCombo = new QComboBox;
    m_colorCombo->setModel(new QStringListModel(this));
    connect(m_colorCombo, SIGNAL(currentIndexChanged(int)), SLOT(colorChanged(int)));

    m_backgroundCombo = new QComboBox;
    m_backgroundCombo->setModel(new QStringListModel(this));
    connect(m_backgroundCombo, SIGNAL(currentIndexChanged(int)), SLOT(backgroundChanged(int)));

    m_softKeyIconCheck = new QCheckBox(tr("Use icons for soft keys"));
    gConfig.beginGroup("ContextMenu");
    int labelType = (QSoftMenuBar::LabelType)gConfig.value("LabelType", QSoftMenuBar::TextLabel).toInt();
    gConfig.endGroup();
    m_softKeyIconCheck->setChecked(labelType == QSoftMenuBar::IconLabel);
    connect(m_softKeyIconCheck, SIGNAL(clicked(bool)), SLOT(softKeyOptionChanged()));

    QFormLayout *form = new QFormLayout;
    form->addRow(tr("Theme"), m_themeCombo);
    form->addRow(tr("Color"), m_colorCombo);
    form->addRow(tr("Background"), m_backgroundCombo);
    form->addRow(m_softKeyIconCheck);
    form->setAlignment(m_softKeyIconCheck, Qt::AlignCenter);

    m_previewTitle = new QLabel;
    m_previewSoftMenuBar = new QLabel;
    m_previewBackground = new QLabel;

    QGridLayout *previewGrid = new QGridLayout;
    previewGrid->setMargin(10);
    previewGrid->setAlignment(Qt::AlignHCenter | Qt::AlignTop);
    previewGrid->addWidget(m_previewTitle, 0, 0);
    previewGrid->addWidget(m_previewSoftMenuBar, 1, 0);
    previewGrid->addWidget(m_previewBackground, 0, 1, 2, 1);

    m_previewBox = new QGroupBox;
    m_previewBox->setLayout(previewGrid);
    form->addRow(m_previewBox);
    m_previewBox->hide();   // hide until a preview is shown

    QScrollArea *scroll = new QScrollArea;
    scroll->setFocusPolicy(Qt::NoFocus);
    scroll->setFrameStyle(QFrame::NoFrame);
    QWidget *w = new QWidget;
    w->setLayout(form);
    scroll->setWidget(w);
    scroll->setWidgetResizable(true);
    scroll->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);

    QVBoxLayout *mainLayout = new QVBoxLayout(this);
    mainLayout->setContentsMargins(0, 0, 0, 0);
    mainLayout->addWidget(scroll);
    setLayout(mainLayout);
}
Example #5
0
QScrollArea *SystemInfo::wrapWithScrollArea(QWidget *widget)
{
    QScrollArea *sv = new QScrollArea();
    sv->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    sv->setFrameStyle(QFrame::NoFrame);
    sv->setWidgetResizable(true);
    sv->setWidget( widget );
    sv->setFocusPolicy( Qt::TabFocus );
    return sv;
}
 void addPage(const QString &name)
 {
     TypeFormatsDialogPage *page = new TypeFormatsDialogPage;
     pages.append(page);
     QScrollArea *scroller = new QScrollArea;
     scroller->setWidgetResizable(true);
     scroller->setWidget(page);
     scroller->setFrameStyle(QFrame::NoFrame);
     tabs->addTab(scroller, name);
 }
PreviewDialog::PreviewDialog(QWidget *parent) : DragWidget(parent)
{
    m_borderImage = false;
    setAutoFillBackground(true);

    m_label = new PreviewLabel(this);
    m_slider = new QSlider(this);

    m_zoomLabel = new QLabel(this);

    setZoom(1);

    QVBoxLayout *layout = new QVBoxLayout(this);
    QHBoxLayout *horizontalLayout = new QHBoxLayout();
    QHBoxLayout *horizontalLayout2 = new QHBoxLayout();
    layout->setMargin(0);
    layout->setContentsMargins(2, 2, 2, 16);
    layout->setSpacing(4);
    QToolButton *toolButton = new QToolButton(this);
    QIcon icon(style()->standardIcon(QStyle::SP_DockWidgetCloseButton));
    toolButton->setIcon(icon);
    toolButton->setToolButtonStyle(Qt::ToolButtonIconOnly);
    toolButton->setFixedSize(icon.availableSizes().value(0) + QSize(4, 4));
    connect(toolButton, SIGNAL(clicked()), this, SLOT(onTogglePane()));

    QScrollArea *scrollArea = new QScrollArea(this);
    WheelFilter *wheelFilter = new WheelFilter(scrollArea);
    scrollArea->setWidget(m_label);
    scrollArea->setFrameStyle(QFrame::NoFrame);
    m_slider->setOrientation(Qt::Horizontal);
    m_slider->setRange(1, 6);
    m_slider->setFixedWidth(80);
    m_zoomLabel->setFixedWidth(50);

    horizontalLayout->addWidget(toolButton);
    horizontalLayout->addSpacing(6);
    horizontalLayout->addWidget(m_slider);
    horizontalLayout->addSpacing(6);
    horizontalLayout->addWidget(m_zoomLabel);
    horizontalLayout->addStretch(1);

    layout->addLayout(horizontalLayout);
    horizontalLayout2->addSpacing(24);
    horizontalLayout2->addWidget(scrollArea);
    layout->addLayout(horizontalLayout2);

    wheelFilter->setTarget(this);

    connect(m_slider, SIGNAL(valueChanged(int)), this, SLOT(onSliderMoved(int)));

    foreach (QWidget *childWidget, findChildren<QWidget*>()) {
        childWidget->installEventFilter(wheelFilter);
    }
NotifyManager::NotifyManager(QWidget *parent) :
    QWidget(parent),
    m_dbus(new Notification("com.deepin.dde.Notification", "/com/deepin/dde/Notification", QDBusConnection::sessionBus(), this))
{
    QWidget *widget = new QWidget;

    m_connectLayout = new QVBoxLayout(widget);
    m_connectLayout->setMargin(0);
    m_connectLayout->setSpacing(1);
    m_connectLayout->addStretch();

    QScrollArea *scrollarea = new QScrollArea;
    scrollarea->setWidget(widget);
    scrollarea->setObjectName("scrollarea");
    scrollarea->setWidgetResizable(true);
    scrollarea->setFocusPolicy(Qt::NoFocus);
    scrollarea->setFrameStyle(QFrame::NoFrame);
    scrollarea->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Expanding);
    scrollarea->setContentsMargins(0, 0, 0, 0);
    scrollarea->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    scrollarea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    scrollarea->setStyleSheet("background-color:transparent;");

    QScrollBar *bar = scrollarea->verticalScrollBar();
    connect(bar, &QScrollBar::valueChanged, this, [=](int value){
            if (m_checkIndex && value == bar->maximum())
                onLoadAgain();
    });

    QVBoxLayout *mainLayout = new QVBoxLayout;
    mainLayout->setMargin(0);
    mainLayout->setSpacing(0);

    m_clearButton = new DImageButton;
    m_clearButton->setText(tr("Clear all"));
    m_clearButton->setStyleSheet("padding: 4px 0;");

    mainLayout->addWidget(m_clearButton, 0, Qt::AlignHCenter);
    mainLayout->addWidget(scrollarea);

    setLayout(mainLayout);

    m_clearButton->setVisible(false);

    connect(m_clearButton, &DImageButton::clicked, this, &NotifyManager::onCloseAllItem);
    connect(m_dbus, &Notification::RecordAdded, this, &NotifyManager::onNotifyAdded);

    m_dbus->setSync(false);

    QDBusPendingReply<QString> notify = m_dbus->GetAllRecords();
    QDBusPendingCallWatcher *notifyWatcher = new QDBusPendingCallWatcher(notify, this);
    connect(notifyWatcher, &QDBusPendingCallWatcher::finished, this, &NotifyManager::onNotifyGetAllFinished);
}
Example #9
0
QWidget* KgGeneral::createTab(QString name)
{
    QScrollArea *scrollArea = new QScrollArea(tabWidget);
    tabWidget->addTab(scrollArea, name);
    scrollArea->setFrameStyle(QFrame::NoFrame);
    scrollArea->setWidgetResizable(true);

    QWidget *tab = new QWidget(scrollArea);
    scrollArea->setWidget(tab);

    return tab;
}
Example #10
0
Qt_launchpad::Qt_launchpad(Genode::Env &env, unsigned long initial_quota,
                           QWidget *parent)
: QMainWindow(parent), Launchpad(env, initial_quota)
{
	setupUi(this);

	// disable minimize and maximize buttons
	Qt::WindowFlags flags = windowFlags();
	flags &= ~Qt::WindowMinMaxButtonsHint;
	setWindowFlags(flags);

	// put a QScrollArea into launcherDockWidget for scrolling of launcher entries
	QScrollArea *launcherScrollArea = new QScrollArea;
	launcherScrollArea->setFrameStyle(QFrame::NoFrame);
	launcherScrollArea->setWidget(launcherDockWidgetContents);

	launcherDockWidget->setWidget(launcherScrollArea);

	QVBoxLayout *launcherDockWidgetLayout = new QVBoxLayout;
	launcherDockWidgetLayout->setContentsMargins(2, 2, 2, 2);
	launcherDockWidgetLayout->setSpacing(2);
	launcherDockWidgetContents->setLayout(launcherDockWidgetLayout);

	// put a QScrollArea into childrenDockWidget for scrolling of child entries
	QScrollArea *childrenScrollArea = new QScrollArea;
	childrenScrollArea->setFrameStyle(QFrame::NoFrame);
	childrenScrollArea->setWidget(childrenDockWidgetContents);

	childrenDockWidget->setWidget(childrenScrollArea);

	QVBoxLayout *childrenDockWidgetLayout = new QVBoxLayout;
	childrenDockWidgetLayout->setContentsMargins(2, 2, 2, 2);
	childrenDockWidgetLayout->setSpacing(2);
	childrenDockWidgetContents->setLayout(childrenDockWidgetLayout);

	// update the available quota bar every 200ms
	QTimer *avail_quota_timer = new QTimer(this);
	connect(avail_quota_timer, SIGNAL(timeout()), this, SLOT(_avail_quota_update()));
	avail_quota_timer->start(200);
}
Example #11
0
Paintbox::Paintbox(QWidget * parent, Qt::WindowFlags flags) : QWidget(parent, flags)
{
	setupUi(this);
	
	stacks = new QUndoGroup(this);
	
	QIcon undo = undo_button->icon();
	undo_button->setDefaultAction(stacks->createUndoAction(undo_button));
	undo_button->defaultAction()->setIcon(undo);

	QIcon redo = redo_button->icon();
	redo_button->setDefaultAction(stacks->createRedoAction(redo_button));
	redo_button->defaultAction()->setIcon(redo);
	
	setUndoStack(parent);	
	
	active = COLOR_PAINT;
	gradient_frame->setHidden(true);
	pick_frame->setHidden(true);
	smooth_frame->setHidden(true);
	mesh_displacement_frame->setHidden(true);
	clone_source_frame->setHidden(true);
	noise_frame->setHidden(true);
	
	brush_viewer->setScene(new QGraphicsScene());
	
	clone_source_view->setScene(new QGraphicsScene());
	clone_source_view->centerOn(0, 0);
	
	item = NULL;
	pixmap_available = false;
	
	//******QT 4.3 Workaround**********
	QScrollArea * scrollArea = new QScrollArea(this);
	gridLayout->removeWidget(widget);
	scrollArea->setWidget(widget);
	static_cast<QGridLayout * >(widget->layout())->addItem(new QSpacerItem(0, 20, QSizePolicy::Minimum, QSizePolicy::Expanding), 11, 0, 1, 2);
	widget->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Expanding));
	scrollArea->setFrameStyle(QFrame::NoFrame);
	scrollArea->setWidgetResizable(true);
	scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
	scrollArea->adjustSize();
	gridLayout->addWidget(scrollArea, 2, 1, 1, 1);
	//**********************************
	
	QObject::connect(clone_source_view, SIGNAL(positionChanged(double, double)), this, SLOT(movePixmapDelta(double, double)));
	QObject::connect(clone_source_view, SIGNAL(positionReset()), this, SLOT(resetPixmapDelta()));

	refreshBrushPreview();
}
Example #12
0
XSettingsWidget::XSettingsWidget(QWidget *parent) :
    SettingsWidget(parent)
{
	QVBoxLayout *mainLayout = new QVBoxLayout(this);
	QScrollArea *area = new QScrollArea(this);
	QWidget *mainWidget = new QWidget(area);
	area->setWidget(mainWidget);
	area->setWidgetResizable(true);
	area->setFrameStyle(QFrame::NoFrame);
	mainLayout->setContentsMargins(0, 0, 0, 0);
	mainLayout->addWidget(area);
	m_layout = new QVBoxLayout(mainWidget);
	m_layout->setContentsMargins(0, 0, 0, 0);
}
Example #13
0
Qt_launchpad::Qt_launchpad(unsigned long initial_quota, QWidget *parent)
    : QMainWindow(parent), Launchpad(initial_quota)
{
	setupUi(this);

	// disable minimize and maximize buttons
	Qt::WindowFlags flags = windowFlags();
	flags &= ((~Qt::WindowMinMaxButtonsHint)|(Qt::WindowStaysOnTopHint));
	setWindowFlags(flags);

	// To trigger lastWindowClosed()
	setAttribute(Qt::WA_QuitOnClose, true);

	launcherDockWidgetContents = new QToolBox();
	// put a QScrollArea into launcherDockWidget for scrolling of launcher entries
  	/*QScrollArea *launcherScrollArea = new QScrollArea;
	launcherScrollArea->setFrameStyle(QFrame::NoFrame);
	launcherScrollArea->setWidget(launcherDockWidgetContents);*/
	launcherDockWidget->setWidget(launcherDockWidgetContents);
	launcherDockWidget->setFont(QFont("OS5",12,QFont::Bold));

	// put a QScrollArea into childrenDockWidget for scrolling of child entries
  	QScrollArea *childrenScrollArea = new QScrollArea;
	childrenScrollArea->setFrameStyle(QFrame::NoFrame);
	childrenScrollArea->setWidget(childrenDockWidgetContents);
	
	childrenDockWidget->setWidget(childrenScrollArea);
	childrenDockWidget->setFont(QFont("OS5",12,QFont::Bold));
	
	QVBoxLayout *childrenDockWidgetLayout = new QVBoxLayout;
	childrenDockWidgetLayout->setContentsMargins(0, 0, 0, 0);
	childrenDockWidgetLayout->setSpacing(0);
	childrenDockWidgetLayout->setAlignment(Qt::AlignTop);
	childrenDockWidgetContents->setLayout(childrenDockWidgetLayout);
	childrenDockWidget->hide();
	statusDockWidget->hide();

	QObject::connect(childrenDockWidget,SIGNAL(topLevelChanged(bool)),this,SLOT(enlarge_childrenDockWg(bool)));
	QObject::connect(statusDockWidget,SIGNAL(topLevelChanged(bool)),this,SLOT(enlarge_statusDockWg(bool)));

	// update the available quota bar every 200ms
	QTimer *avail_quota_timer = new QTimer(this);
	connect(avail_quota_timer, SIGNAL(timeout()), this, SLOT(avail_quota_update()));
	avail_quota_timer->start(200);
	Middle* middle=new Middle();
	QObject::connect(middle,SIGNAL(quit_child()),this,SLOT(close_child()));
	QObject::connect(this,SIGNAL(unlock_child()),middle,SLOT(unlock()));	
	middle->start();
}
Example #14
0
QProjectWidget::QProjectWidget(QWidget * parent):
    QAbstractPageWidget(parent),
    m_projectPropertyView(new QPropertyListView(this)),
    m_projectBar(new StyledBar(this)),
    m_pageView(new QPageView(this)),
    m_pageViewBar(new StyledBar(this))
{
    QVBoxLayout *vl = new QVBoxLayout;

    MiniSplitter *sp = new MiniSplitter;

    vl->setMargin(0);
    vl->addWidget(sp);
    setLayout(vl);

    QWidget* wid = new QWidget;

    sp->addWidget(wid);

    vl = new QVBoxLayout;
    vl->setMargin(0);
    vl->setSpacing(0);
    vl->addWidget(m_projectBar);
    vl->addWidget(m_projectPropertyView);
    wid->setLayout(vl);

    QScrollArea * pagePane = new QScrollArea;
    pagePane->setWidget(m_pageView);
    pagePane->setFrameStyle(QFrame::NoFrame);
    pagePane->viewport()->setStyleSheet("background-color:rgb(255,255,255);");

    wid = new QWidget;
    vl = new QVBoxLayout;
    vl->setMargin(0);
    vl->setSpacing(0);
    vl->addWidget(m_pageViewBar);
    vl->addWidget(pagePane);
    wid->setLayout(vl);

    sp->addWidget(wid);

    sp->setStretchFactor(0,0);
    sp->setStretchFactor(1,1);

    connect(QSoftCore::getInstance()->getProject(),SIGNAL(hostAdded(QAbstractWidgetHost*,int)),
            m_pageView,SLOT(addHost(QAbstractWidgetHost*,int)));
}
Example #15
0
BTSettingsMainWindow::BTSettingsMainWindow(QWidget *parent, Qt::WFlags fl)
    : QMainWindow(parent, fl), m_localDevice(new QBluetoothLocalDevice(this)),
      m_controller(0)
{
    if (!m_localDevice->isValid()) {
        QLabel *label = new QLabel(tr("(Bluetooth not available.)"));
        label->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
        label->setWordWrap(true);
        label->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
        setCentralWidget(label);
        return;
    }

    QScrollArea* scroll = new QScrollArea();
    scroll->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    scroll->setWidgetResizable(true);
    scroll->setFrameStyle(QFrame::NoFrame);

    m_menu = QSoftMenuBar::menuFor(this);
    m_tabs = new QTabWidget();

    m_controller =
            new QCommDeviceController(m_localDevice->deviceName().toLatin1(), this);

    SettingsDisplay *settings = new SettingsDisplay(m_localDevice, m_controller);
    scroll->setWidget(settings);
    scroll->setFocusProxy(settings);
    m_tabs->addTab(scroll, tr("Settings"));

    // Delay initialization of tabs other than the first
    m_tabs->addTab(new QWidget, tr("Paired Devices"));
    m_tabs->setTabEnabled(1, false);

    m_tabs->setCurrentIndex(0);

    // change the context menu when the tab changes
    connect(m_tabs, SIGNAL(currentChanged(int)), SLOT(tabChanged(int)));

    // set the current context menu
    tabChanged(m_tabs->currentIndex());

    setCentralWidget(m_tabs);
    setWindowTitle(tr("Bluetooth"));

    QTimer::singleShot(0, this, SLOT(init()));
}
void SyncMeasuresDialog::createLayout()
{
  setWindowTitle("Updates Available in Library");

  setModal(true);

  setSizeGripEnabled(true);

  setObjectName("BlueGradientWidget");

  // The central pane
  m_centralWidget = new SyncMeasuresDialogCentralWidget(m_project, m_measureManager);

  connect(m_centralWidget, &SyncMeasuresDialogCentralWidget::componentClicked, this, &SyncMeasuresDialog::on_componentClicked);

  connect(m_centralWidget, &SyncMeasuresDialogCentralWidget::noComponents, this, &SyncMeasuresDialog::on_noComponents);

  connect(m_centralWidget, &SyncMeasuresDialogCentralWidget::closeDlg, this, &SyncMeasuresDialog::closeDlg);

  QScrollArea * centralScrollArea = new QScrollArea(this);
  centralScrollArea->setFrameStyle(QFrame::NoFrame);
  centralScrollArea->setObjectName("GrayWidget");
  centralScrollArea->setWidgetResizable(true);
  centralScrollArea->setWidget(m_centralWidget);

  // The right pane

  m_rightScrollArea = new QScrollArea(this);
  m_rightScrollArea->setFrameStyle(QFrame::NoFrame);
  m_rightScrollArea->setObjectName("GrayWidget");
  m_rightScrollArea->setWidgetResizable(true);

  QSplitter * splitter = new QSplitter(this);
  splitter->setOrientation(Qt::Horizontal);
  splitter->addWidget(centralScrollArea);
  splitter->addWidget(m_rightScrollArea);

  QHBoxLayout * mainLayout = new QHBoxLayout();
  mainLayout->addWidget(splitter);

  setLayout(mainLayout);

  m_centralWidget->lowerPushButton->setFocus();

}
void ModuleView::addModule( KCModuleInfo *module )
{
    if( !module ) {
        return;
    }
    if( !module->service() ) {
        qWarning() << "ModuleInfo has no associated KService" ;
        return;
    }
    if ( !KAuthorized::authorizeControlModule( module->service()->menuId() ) ) {
        qWarning() << "Not authorised to load module" ;
        return;
    }
    if( module->service()->noDisplay() ) {
        return;
    }

    // Create the scroller
    QScrollArea * moduleScroll = new QScrollArea( this );
    // Prepare the scroll area
    moduleScroll->setWidgetResizable( true );
    moduleScroll->setFrameStyle( QFrame::NoFrame );
    moduleScroll->viewport()->setAutoFillBackground( false );
    // Create the page
    KPageWidgetItem *page = new KPageWidgetItem( moduleScroll, module->moduleName() );
    // Provide information to the users

    KCModuleProxy * moduleProxy = new KCModuleProxy( *module, moduleScroll );
    moduleScroll->setWidget( moduleProxy );
    moduleProxy->setAutoFillBackground( false );
    connect( moduleProxy, SIGNAL(changed(bool)), this, SLOT(stateChanged()));
    d->mPages.insert( page, moduleProxy );

    d->mModules.insert( page, module );
    updatePageIconHeader( page, true );
    // Add the new page
    d->mPageWidget->addPage( page );
}
Example #18
0
XletQueuesConfigure::XletQueuesConfigure(XletQueues *)
    : QWidget(NULL)
{
    QVBoxLayout *layout = new QVBoxLayout(this);
    setLayout(layout);
    setWindowTitle(tr("Queues configuration"));

    QLabel *desc = new QLabel(tr(
        "Choose which queue should be displayed, and the\n"
        "queues parameters for the Stats on slice:"), this);

    QScrollArea *scrollArea = new QScrollArea(this);
    scrollArea->setFrameStyle(QFrame::NoFrame);
    scrollArea->setWidget(buildConfigureQueueList(this));

    layout->addWidget(desc);
    layout->addWidget(scrollArea);

    QPushButton *leave = new QPushButton(tr("&Close"), this);
    connect(leave, SIGNAL(clicked()), this, SLOT(close()));
    layout->addWidget(leave);
    show();
    setMaximumSize(QSize(width(), 600));
}
OSCollapsibleItemList::OSCollapsibleItemList(bool addScrollArea, QWidget * parent)
  : OSItemSelector(parent),
  m_vLayout(nullptr),
  m_contentLayout(nullptr),
  m_selectedCollapsibleItem(nullptr),
  m_itemsDraggable(false),
  m_itemsRemoveable(false),
  m_showFilterLayout(false),
  m_itemsType(OSItemType::ListItem)
{ 
  this->setObjectName("GrayWidget"); 

  QVBoxLayout* outerVLayout = new QVBoxLayout();
  outerVLayout->setContentsMargins(0,0,0,0);
  this->setLayout(outerVLayout);

  QWidget* outerWidget = new QWidget();

  if (addScrollArea){
    QScrollArea* scrollArea = new QScrollArea();
    scrollArea->setFrameStyle(QFrame::NoFrame);
    scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
    scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
    outerVLayout->addWidget(scrollArea);
    scrollArea->setWidget(outerWidget);
    scrollArea->setWidgetResizable(true);
  }else{
    outerVLayout->addWidget(outerWidget);
  }

  m_vLayout = new QVBoxLayout();
  outerWidget->setLayout(m_vLayout);
  m_vLayout->setContentsMargins(0,0,0,0);
  m_vLayout->setSpacing(0);
  m_vLayout->addStretch(10);
}
Example #20
0
OSInspectorView::OSInspectorView(bool addScrollArea, QWidget * parent)
  : QWidget(parent)
{
  this->setObjectName("GrayWidget");

  QVBoxLayout* outerVLayout = new QVBoxLayout();
  outerVLayout->setContentsMargins(0,0,0,0);
  this->setLayout(outerVLayout);

  m_stackedWidget = new QStackedWidget();

  if (addScrollArea){
    QScrollArea* scrollArea = new QScrollArea();
    scrollArea->setFrameStyle(QFrame::NoFrame);
    scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
    scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
    outerVLayout->addWidget(scrollArea);
    scrollArea->setWidget(m_stackedWidget);
    scrollArea->setWidgetResizable(true);
  }else{
    outerVLayout->addWidget(m_stackedWidget);
  }

}
Example #21
0
ContentDialog::ContentDialog(SettingsWidget* settingsWidget, QWidget* parent)
    : ActivateDialog(parent, Qt::Window)
    , activeChatroomWidget(nullptr)
    , settingsWidget(settingsWidget)
    , videoSurfaceSize(QSize())
    , videoCount(0)
{
    QVBoxLayout* boxLayout = new QVBoxLayout(this);
    boxLayout->setMargin(0);
    boxLayout->setSpacing(0);

    splitter = new QSplitter(this);
    setStyleSheet(Style::getStylesheet(":/ui/contentDialog/contentDialog.css"));
    splitter->setHandleWidth(6);

    QWidget *friendWidget = new QWidget();
    friendWidget->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
    friendWidget->setAutoFillBackground(true);

    friendLayout = new FriendListLayout();
    friendLayout->setMargin(0);
    friendLayout->setSpacing(0);
    friendWidget->setLayout(friendLayout);

    onGroupchatPositionChanged(Settings::getInstance().getGroupchatPosition());

    QScrollArea *friendScroll = new QScrollArea(this);
    friendScroll->setMinimumWidth(220);
    friendScroll->setFrameStyle(QFrame::NoFrame);
    friendScroll->setLayoutDirection(Qt::RightToLeft);
    friendScroll->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    friendScroll->setStyleSheet(Style::getStylesheet(":/ui/friendList/friendList.css"));
    friendScroll->setWidgetResizable(true);
    friendScroll->setWidget(friendWidget);

    QWidget* contentWidget = new QWidget(this);
    contentWidget->setAutoFillBackground(true);
    contentLayout = new ContentLayout(contentWidget);
    contentLayout->setMargin(0);
    contentLayout->setSpacing(0);

    splitter->addWidget(friendScroll);
    splitter->addWidget(contentWidget);
    splitter->setStretchFactor(1, 1);
    splitter->setCollapsible(1, false);
    boxLayout->addWidget(splitter);

    connect(splitter, &QSplitter::splitterMoved, this, &ContentDialog::saveSplitterState);

    connect(settingsWidget, &SettingsWidget::groupchatPositionToggled, this, &ContentDialog::onGroupchatPositionChanged);

    setMinimumSize(500, 220);
    setAttribute(Qt::WA_DeleteOnClose);

    QByteArray geometry = Settings::getInstance().getDialogGeometry();

    if (!geometry.isNull())
        restoreGeometry(geometry);
    else
        resize(720, 400);


    QByteArray splitterState = Settings::getInstance().getDialogSplitterState();

    if (!splitterState.isNull())
        splitter->restoreState(splitterState);

    currentDialog = this;

    setAcceptDrops(true);

    new QShortcut(Qt::CTRL + Qt::Key_Q, this, SLOT(close()));
    new QShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_Tab, this, SLOT(previousContact()));
    new QShortcut(Qt::CTRL + Qt::Key_Tab, this, SLOT(nextContact()));
    new QShortcut(Qt::CTRL + Qt::Key_PageUp, this, SLOT(previousContact()));
    new QShortcut(Qt::CTRL + Qt::Key_PageDown, this, SLOT(nextContact()));

    connect(Core::getInstance(), &Core::usernameSet, this, &ContentDialog::updateTitleAndStatusIcon);

    Translator::registerHandler(std::bind(&ContentDialog::retranslateUi, this), this);
}
AxisDetailsWidget::AxisDetailsWidget(QWidget* parent,
                                     Animation &animation,
                                     Axis &axis,
                                     Engine& engine) :
    ColourGroupGroupWidget(parent, engine),
    iAxis(axis),
    iAnimation(animation),
    iFramesListX(0),
    iFramesListWidth(0),
    iFrameSlider(NULL),
    iGridLayout(NULL) {

    iGridLayout = new QGridLayout();
    iGridLayout->setObjectName(QString::fromUtf8("gridLayout"));

    QSpacerItem* verticalSpacer = new QSpacerItem(20, 115, QSizePolicy::Minimum, QSizePolicy::Expanding);

    QScrollArea* scrollArea = new QScrollArea(this);
    scrollArea->setObjectName(QString::fromUtf8("scrollArea"));
    scrollArea->setWidgetResizable(true);
    scrollArea->setFrameStyle(QFrame::Box);
    scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);

    iScrollAreaWidgetContents = new ScrollContentsWidget(this, animation, axis);
    iScrollAreaWidgetContents->setObjectName(QString::fromUtf8("scrollAreaWidgetContents"));
    iScrollAreaWidgetContents->setGeometry(QRect(0, 0, 531, 305));

    QSizePolicy sizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    sizePolicy.setHorizontalStretch(0);
    sizePolicy.setVerticalStretch(0);
    sizePolicy.setHeightForWidth(iScrollAreaWidgetContents->sizePolicy().hasHeightForWidth());

    iScrollAreaWidgetContents->setSizePolicy(sizePolicy);
    scrollArea->setWidget(iScrollAreaWidgetContents);

    QVBoxLayout* scrollAreaLayout = new QVBoxLayout(iScrollAreaWidgetContents);
    scrollAreaLayout->setObjectName(QString::fromUtf8("scrollAreaLayout"));

    scrollAreaLayout->addLayout(iGridLayout);
    scrollAreaLayout->addItem(verticalSpacer);

    iGridLayout->setVerticalSpacing(FRAME_SPACING);

    iFrameSlider = new QSlider(this);
    iFrameSlider->setObjectName(QString::fromUtf8("horizontalSlider"));
    iFrameSlider->setOrientation(Qt::Horizontal);
    iFrameSlider->setMinimum(iAxis.lowValue());
    iFrameSlider->setMaximum(iAxis.highValue());
    iFrameSlider->setTickPosition(QSlider::TicksBelow);
    iFrameSlider->setPageStep(1);
    iFrameSlider->setSingleStep(1);

    //iGridLayout->addWidget(iFrameSlider, 0, 1, 1, 1);

    iCloseAll = new QToolButton(this);
    iCloseAll->setObjectName(QString::fromUtf8("closeAll"));
    iCloseAll->setIcon(QIcon(":/images/delete.png"));
    iCloseAll->setEnabled(false);

    connect(iCloseAll, SIGNAL(clicked()), this, SLOT(closeAllClicked()));

   // iGridLayout->addWidget(iCloseAll, 0, 2, 1, 1);

    QHBoxLayout* topHorizontalLayout = new QHBoxLayout();
    topHorizontalLayout->setObjectName(QString::fromUtf8("topHorizontalLayout"));

    iSliderSpacer = new QSpacerItem(LED_LABEL_WIDTH + SCROLL_AREA_MARGIN + SLIDER_TICK_OFFSET, iFrameSlider->height(), QSizePolicy::Fixed, QSizePolicy::Fixed);

    topHorizontalLayout->addWidget(iCloseAll);
    topHorizontalLayout->addItem(iSliderSpacer);

    topHorizontalLayout->addWidget(iFrameSlider);
    topHorizontalLayout->addItem(new QSpacerItem(SCROLL_AREA_MARGIN + SLIDER_TICK_OFFSET, iFrameSlider->height(), QSizePolicy::Fixed, QSizePolicy::Fixed));

    QVBoxLayout* contentsLayout = new QVBoxLayout();
    contentsLayout->setObjectName(QString::fromUtf8("contentsLayout"));

    contentsLayout->addLayout(topHorizontalLayout);
    contentsLayout->addWidget(scrollArea);

    QHBoxLayout* mainLayout = new QHBoxLayout(this);
    mainLayout->setObjectName(QString::fromUtf8("mainLayout"));

    mainLayout->addLayout(contentsLayout);

    setAcceptDrops(true);

    connect(iFrameSlider, SIGNAL(valueChanged(int)), &axis, SLOT(setCurrentFrame(int)));
}
Example #23
0
QgsMapStylingWidget::QgsMapStylingWidget( QgsMapCanvas* canvas, QWidget *parent )
    : QWidget( parent )
    , mMapCanvas( canvas )
    , mBlockAutoApply( false )
    , mCurrentLayer( nullptr )
    , mVectorStyleWidget( nullptr )
{
  QBoxLayout* layout = new QVBoxLayout();
  layout->setContentsMargins( 0, 0, 0, 0 );
  this->setLayout( layout );

  mAutoApplyTimer = new QTimer( this );
  mAutoApplyTimer->setSingleShot( true );
  connect( mAutoApplyTimer, SIGNAL( timeout() ), this, SLOT( apply() ) );

  mStackedWidget = new QStackedWidget( this );
  mMapStyleTabs = new QTabWidget( this );
  mMapStyleTabs->setDocumentMode( true );
  mNotSupportedPage = mStackedWidget->addWidget( new QLabel( "Not supported currently" ) );
  mVectorPage = mStackedWidget->addWidget( mMapStyleTabs );

  // create undo widget
  mUndoWidget = new QgsUndoWidget( this->mMapStyleTabs, mMapCanvas );
  mUndoWidget->setObjectName( "Undo Styles" );

  mLayerTitleLabel = new QLabel();
  mLayerTitleLabel->setAlignment( Qt::AlignHCenter );
  layout->addWidget( mLayerTitleLabel );
  layout->addWidget( mStackedWidget );
  mButtonBox = new QDialogButtonBox( QDialogButtonBox::Apply );
  mLiveApplyCheck = new QCheckBox( "Live update" );
  mLiveApplyCheck->setChecked( true );

  mUndoButton = new QToolButton( this );
  mUndoButton->setIcon( QgsApplication::getThemeIcon( "mActionUndo.png" ) );
  mRedoButton = new QToolButton( this );
  mRedoButton->setIcon( QgsApplication::getThemeIcon( "mActionRedo.png" ) );

  connect( mUndoButton, SIGNAL( pressed() ), mUndoWidget, SLOT( undo() ) );
  connect( mRedoButton, SIGNAL( pressed() ), mUndoWidget, SLOT( redo() ) );

  QHBoxLayout* bottomLayout = new QHBoxLayout( );
  bottomLayout->addWidget( mUndoButton );
  bottomLayout->addWidget( mRedoButton );
  bottomLayout->addWidget( mButtonBox );
  bottomLayout->addWidget( mLiveApplyCheck );
  layout->addLayout( bottomLayout );

  mLabelingWidget = new QgsLabelingWidget( 0, mMapCanvas, this );
  mLabelingWidget->setDockMode( true );
  connect( mLabelingWidget, SIGNAL( widgetChanged() ), this, SLOT( autoApply() ) );

  // Only labels for now but styles and diagrams will come later
  QScrollArea* stylescroll = new QScrollArea;
  stylescroll->setWidgetResizable( true );
  stylescroll->setFrameStyle( QFrame::NoFrame );
  QScrollArea* labelscroll = new QScrollArea;
  labelscroll->setWidgetResizable( true );
  labelscroll->setFrameStyle( QFrame::NoFrame );
  labelscroll->setWidget( mLabelingWidget );

  mStyleTabIndex = mMapStyleTabs->addTab( stylescroll, QgsApplication::getThemeIcon( "propertyicons/symbology.png" ), "Styles" );
  mLabelTabIndex = mMapStyleTabs->addTab( labelscroll, QgsApplication::getThemeIcon( "labelingSingle.svg" ), "Labeling" );
  mMapStyleTabs->addTab( mUndoWidget, QgsApplication::getThemeIcon( "labelingSingle.svg" ), "History" );
//  int diagramTabIndex = mMapStyleTabs->addTab( new QWidget(), QgsApplication::getThemeIcon( "propertyicons/diagram.png" ), "Diagrams" );
//  mMapStyleTabs->setTabEnabled( styleTabIndex, false );
//  mMapStyleTabs->setTabEnabled( diagramTabIndex, false );
  mMapStyleTabs->setCurrentIndex( mStyleTabIndex );

  connect( mMapStyleTabs, SIGNAL( currentChanged( int ) ), this, SLOT( updateCurrentWidgetLayer( int ) ) );

  connect( mLiveApplyCheck, SIGNAL( toggled( bool ) ), mButtonBox->button( QDialogButtonBox::Apply ), SLOT( setDisabled( bool ) ) );

  connect( mButtonBox->button( QDialogButtonBox::Apply ), SIGNAL( clicked() ), this, SLOT( apply() ) );

  mButtonBox->button( QDialogButtonBox::Apply )->setEnabled( false );

}
SettingsPageTerrainColors::SettingsPageTerrainColors(QWidget *parent) :
  QWidget(parent),
  colorsChanged(false),
  m_autoSip( true )
{
  setObjectName("SettingsPageTerrainColors");

  setWindowFlags( Qt::Tool );
  setWindowModality( Qt::WindowModal );
  setAttribute(Qt::WA_DeleteOnClose);
  setWindowTitle( tr("Settings - Terrain Colors") );

  if( parent )
    {
      resize( parent->size() );
    }

  // Layout used by scroll area
  QHBoxLayout *sal = new QHBoxLayout;

  // new widget used as container for the dialog layout.
  QWidget* sw = new QWidget;

  // Scroll area
  QScrollArea* sa = new QScrollArea;
  sa->setWidgetResizable( true );
  sa->setFrameStyle( QFrame::NoFrame );
  sa->setWidget( sw );

#ifdef QSCROLLER
  QScroller::grabGesture( sa->viewport(), QScroller::LeftMouseButtonGesture );
#endif

#ifdef QTSCROLLER
  QtScroller::grabGesture( sa->viewport(), QtScroller::LeftMouseButtonGesture );
#endif

  // Add scroll area to its own layout
  sal->addWidget( sa );

  QHBoxLayout *contentLayout = new QHBoxLayout(this);

  // Pass scroll area layout to the content layout.
  contentLayout->addLayout( sal );

  /**
   * Altitude levels in meters to be displayed in color combo box.
   */
  const char *altitudes[51] = {
                 "< 0",
                 "0",
                 "10",
                 "25",
                 "50",
                 "75",
                 "100",
                 "150",
                 "200",
                 "250",
                 "300",
                 "350",
                 "400",
                 "450",
                 "500",
                 "600",
                 "700",
                 "800",
                 "900",
                 "1000",
                 "1250",
                 "1500",
                 "1750",
                 "2000",
                 "2250",
                 "2500",
                 "2750",
                 "3000",
                 "3250",
                 "3500",
                 "3750",
                 "4000",
                 "4250",
                 "4500",
                 "4750",
                 "5000",
                 "5250",
                 "5500",
                 "5750",
                 "6000",
                 "6250",
                 "6500",
                 "6750",
                 "7000",
                 "7250",
                 "7500",
                 "7750",
                 "8000",
                 "8250",
                 "8500",
                 "8750"
  };

  // Determine pixmap size to be used for icons in dependency of the used font
  int size = QFontMetrics(font()).boundingRect("XM").height() - 2;
  pixmapSize = QSize( size, size );
  QPixmap pixmap(pixmapSize);

  // load stored terrain colors into working list
  for( int i = 0; i < SIZEOF_TERRAIN_COLORS; i++ )
    {
      QColor color = GeneralConfig::instance()->getTerrainColor(i);
      terrainColor[i] = color;
    }

  // load ground color
  groundColor = GeneralConfig::instance()->getGroundColor();

  // put all widgets in a HBox layout
  QHBoxLayout *topLayout = new QHBoxLayout(sw);

  // create elevation color bar as image
  elevationImage = new ElevationColorImage( &terrainColor[0], this );
  topLayout->addWidget( elevationImage );

  // all editor widgets will be put into a group box to get a better view
  QGroupBox *editBox = new QGroupBox( tr("Color Selection"), this );

  // put group box in an extra VBox layout to center it vertically
  QVBoxLayout *editAll = new QVBoxLayout;
  editAll->addStretch( 10 );
  editAll->addWidget( editBox );
  editAll->addStretch( 10 );

  topLayout->addLayout( editAll );

  // put all edit widgets (combo box and buttons) in a separate VBox layout
  QVBoxLayout *editLayout = new QVBoxLayout;
  editLayout->setSpacing( editLayout->spacing() * Layout::getIntScaledDensity() );

  QLabel *label = new QLabel( tr("Terrain Level") );
  editLayout->addWidget( label );

  //--------------------------------------------------------------------------
  // The users altitude unit (meters/feed) must be considered during
  // elevation display in the combo box.
  QString unit;

  elevationBox = new QComboBox( this );

#ifdef ANDROID
  QAbstractItemView* listView = elevationBox->view();
  QScrollBar* lvsb = listView->verticalScrollBar();
  lvsb->setStyleSheet( Layout::getCbSbStyle() );
#endif

#ifdef QSCROLLER
  elevationBox->view()->setVerticalScrollMode( QAbstractItemView::ScrollPerPixel );
  QScroller::grabGesture( elevationBox->view()->viewport(), QScroller::LeftMouseButtonGesture );
#endif

#ifdef QTSCROLLER
  elevationBox->view()->setVerticalScrollMode( QAbstractItemView::ScrollPerPixel );
  QtScroller::grabGesture( elevationBox->view()->viewport(), QtScroller::LeftMouseButtonGesture );
#endif

  if( Altitude::getUnit() == Altitude::meters )
    {
      // use unit meter
       unit = "m";

       for( int i = SIZEOF_TERRAIN_COLORS-1; i > 1; i-- )
        {
          pixmap.fill( terrainColor[i] );
          elevationBox->addItem( QIcon( pixmap ), QString(altitudes[i]) + unit );
        }
    }
  else
    {
      // use unit feed
      unit = "ft";

      for( int i = SIZEOF_TERRAIN_COLORS-1; i > 1; i-- )
        {
          int altFeed = static_cast<int>(QString(altitudes[i]).toDouble() * 3.28095);
          pixmap.fill( terrainColor[i] );
          elevationBox->addItem( QIcon( pixmap ), QString::number(altFeed) + unit );
        }
    }

  pixmap.fill( terrainColor[1] );
  elevationBox->addItem( QIcon( pixmap ), QString(altitudes[1]) );

  pixmap.fill( terrainColor[0] );
  elevationBox->addItem( QIcon( pixmap ), QString(altitudes[0]) );

  // set index to level 0
  elevationBox->setCurrentIndex( SIZEOF_TERRAIN_COLORS-2 );

  editLayout->addWidget( elevationBox );

  //--------------------------------------------------------------------------
  // add push button for elevation color chooser dialog
  editColorButton = new QPushButton( tr("Terrain Color") );

  // on click the color chooser dialog will be opened
  connect( editColorButton, SIGNAL(clicked()), this, SLOT(slot_editColor()) );

  editLayout->addWidget( editColorButton );

  //--------------------------------------------------------------------------
  // add push button for ground color chooser dialog
  groundColorButton = new QPushButton( tr("Ground Color") );

  pixmap.fill( groundColor );
  groundColorButton->setIcon( QIcon(pixmap) );

  // on click the color chooser dialog will be opened
  connect( groundColorButton, SIGNAL(clicked()), this, SLOT(slot_editGroundColor()) );

  editLayout->addSpacing( 10 * Layout::getIntScaledDensity() );
  editLayout->addWidget( groundColorButton );
  editLayout->addSpacing( 20 * Layout::getIntScaledDensity() );

  //--------------------------------------------------------------------------
  // add button for assigning of default colors
  defaultColorButton = new QPushButton( tr("Color Defaults") );

  // on click all colors are reset to the defaults
  connect( defaultColorButton, SIGNAL(clicked()), this, SLOT(slot_setColorDefaults()) );

  editLayout->addWidget( defaultColorButton );

  // add stretch items to posit editor widgets in the center of the VBox layout
  editLayout->insertStretch(0, 10 );
  editLayout->addStretch( 10 );

  editBox->setLayout(editLayout);

  //--------------------------------------------------------------------------
  // add spin box for moving elevation zero line
  QGroupBox *setOffsetBox = new QGroupBox( tr("Elevation Offset"), this );

  // put group box in an extra VBox layout to center it vertically
  QVBoxLayout *offsetLayout = new QVBoxLayout;
  offsetLayout->addStretch( 10 );
  offsetLayout->addWidget( setOffsetBox );
  offsetLayout->addStretch( 10 );

  QVBoxLayout *spinboxLayout = new QVBoxLayout;

  elevationOffset = new QSpinBox;
  elevationOffset->setSingleStep(1);
  elevationOffset->setRange(-50, 50);

  connect( elevationOffset, SIGNAL(editingFinished()),
           MainWindow::mainWindow(), SLOT(slotCloseSip()) );

  VarSpinBox* hspin = new VarSpinBox( elevationOffset );
  spinboxLayout->addWidget(hspin);
  setOffsetBox->setLayout(spinboxLayout);

  topLayout->addLayout( offsetLayout );
  topLayout->insertSpacing(1, 60 );
  topLayout->addStretch( 10 );

  QPushButton *cancel = new QPushButton(this);
  cancel->setIcon(QIcon(GeneralConfig::instance()->loadPixmap("cancel.png")));
  cancel->setIconSize(QSize(Layout::getButtonSize(12), Layout::getButtonSize(12)));
  cancel->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::QSizePolicy::Preferred);

  QPushButton *ok = new QPushButton(this);
  ok->setIcon(QIcon(GeneralConfig::instance()->loadPixmap("ok.png")));
  ok->setIconSize(QSize(Layout::getButtonSize(12), Layout::getButtonSize(12)));
  ok->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::QSizePolicy::Preferred);

  QLabel *titlePix = new QLabel(this);
  titlePix->setAlignment( Qt::AlignCenter );
  titlePix->setPixmap(GeneralConfig::instance()->loadPixmap("setup.png"));

  connect(ok, SIGNAL(pressed()), this, SLOT(slotAccept()));
  connect(cancel, SIGNAL(pressed()), this, SLOT(slotReject()));

  QVBoxLayout *buttonBox = new QVBoxLayout;
  buttonBox->setSpacing(0);
  buttonBox->addStretch(2);
  buttonBox->addWidget(cancel, 1);
  buttonBox->addSpacing(30);
  buttonBox->addWidget(ok, 1);
  buttonBox->addStretch(2);
  buttonBox->addWidget(titlePix);
  contentLayout->addLayout(buttonBox);

  load();
}
Example #25
0
WpEditDialog::WpEditDialog(QWidget *parent, Waypoint *wp ) :
  QWidget( parent )
{
  setWindowFlags( Qt::Tool );
  setWindowModality( Qt::WindowModal );
  setAttribute(Qt::WA_DeleteOnClose);

  if( _globalMainWindow )
    {
      // Resize the window to the same size as the main window has. That will
      // completely hide the parent window.
      resize( _globalMainWindow->size() );
    }

  if( wp == 0 )
    {
      setWindowTitle(tr("New Waypoint"));
      m_oldName = "";
    }
  else
    {
      setWindowTitle(tr("Edit Waypoint"));
      m_oldName = wp->name;
    }

  m_wp = wp;

  QTabWidget* tabWidget = new QTabWidget(this);

  // Put all pages into a scroll area. Needed by Maemo Qt, if virtual
  // keyboard is pop up.
  QScrollArea* pgArea = new QScrollArea( tabWidget );
  pgArea->setWidgetResizable( true );
  pgArea->setFrameStyle( QFrame::NoFrame );
  WpEditDialogPageGeneral *pageG = new WpEditDialogPageGeneral(this);
  pgArea->setWidget( pageG );
  tabWidget->addTab( pgArea, tr("General") );

#ifdef QSCROLLER
  QScroller::grabGesture( pgArea->viewport(), QScroller::LeftMouseButtonGesture );
#endif

#ifdef QTSCROLLER
  QtScroller::grabGesture( pgArea->viewport(), QtScroller::LeftMouseButtonGesture );
#endif

  QScrollArea* paArea = new QScrollArea( tabWidget );
  paArea->setWidgetResizable( true );
  paArea->setFrameStyle( QFrame::NoFrame );
  WpEditDialogPageAero *pageA = new WpEditDialogPageAero(this);
  paArea->setWidget( pageA );
  tabWidget->addTab( paArea, tr("Aero") );

#ifdef QSCROLLER
  QScroller::grabGesture( paArea->viewport(), QScroller::LeftMouseButtonGesture );
#endif

#ifdef QTSCROLLER
  QtScroller::grabGesture( paArea->viewport(), QtScroller::LeftMouseButtonGesture );
#endif

  QScrollArea* pcArea = new QScrollArea( tabWidget );
  pcArea->setWidgetResizable( true );
  pcArea->setFrameStyle( QFrame::NoFrame );
  m_comment = new QTextEdit(this);
  m_comment->setWordWrapMode(QTextOption::WordWrap);
  Qt::InputMethodHints imh = (m_comment->inputMethodHints() | Qt::ImhNoPredictiveText);
  m_comment->setInputMethodHints(imh);

  pcArea->setWidget( m_comment );
  tabWidget->addTab( pcArea, tr("Comment") );

#ifdef QSCROLLER
  QScroller::grabGesture( pcArea->viewport(), QScroller::LeftMouseButtonGesture );
#endif

#ifdef QTSCROLLER
  QtScroller::grabGesture( pcArea->viewport(), QtScroller::LeftMouseButtonGesture );
#endif

  connect(this, SIGNAL(load(Waypoint *)),
          pageG, SLOT(slot_load(Waypoint *)));

  connect(this, SIGNAL(load(Waypoint *)),
          pageA, SLOT(slot_load(Waypoint *)));

  connect(this, SIGNAL(save(Waypoint *)),
          pageG, SLOT(slot_save(Waypoint *)));

  connect(this, SIGNAL(save(Waypoint *)),
          pageA, SLOT(slot_save(Waypoint *)));

  // Add ok and cancel buttons
  QPushButton *cancel = new QPushButton;
  cancel->setIcon(QIcon(GeneralConfig::instance()->loadPixmap("cancel.png")));
  cancel->setIconSize(QSize(Layout::getButtonSize(12), Layout::getButtonSize(12)));
  cancel->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::QSizePolicy::Preferred);

  QPushButton *ok = new QPushButton;
  ok->setIcon(QIcon(GeneralConfig::instance()->loadPixmap("ok.png")));
  ok->setIconSize(QSize(Layout::getButtonSize(12), Layout::getButtonSize(12)));
  ok->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::QSizePolicy::Preferred);

  connect(ok, SIGNAL(clicked()), this, SLOT(accept()));
  connect(cancel, SIGNAL(clicked()), this, SLOT(close()));

  QVBoxLayout *buttonBox = new QVBoxLayout;
  buttonBox->setSpacing(0);
  buttonBox->addStretch(2);
  buttonBox->addWidget(cancel, 1);
  buttonBox->addSpacing(30);
  buttonBox->addWidget(ok, 1);
  buttonBox->addStretch(2);

  QHBoxLayout *mainLayout = new QHBoxLayout;
  mainLayout->addWidget(tabWidget);
  mainLayout->addLayout(buttonBox);
  setLayout(mainLayout);

  tabWidget->setCurrentWidget(pageG);

  // load waypoint data into tabulator widgets
  loadWaypointData();
}
Example #26
0
LightSettings::LightSettings( QWidget* parent,  Qt::WFlags fl )
    : QDialog( parent, fl), isStatusView( false )
{
    setWindowTitle(tr("Power Management"));
    QVBoxLayout * baseLayout = new QVBoxLayout( this );
    baseLayout->setMargin( 0 );

    QWidget * container = new QWidget();

    QScrollArea *sView = new QScrollArea;
    sView->setFocusPolicy(Qt::NoFocus);
    sView->setFrameStyle(QFrame::NoFrame);
    sView->setWidget( container );
    sView->setWidgetResizable( true );
    sView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);

    QVBoxLayout *lightLayout = new QVBoxLayout(container);
    lightLayout->setMargin( 0 );
    b = new LightSettingsContainer();
    QtopiaApplication::setInputMethodHint( b->interval_dim, QtopiaApplication::AlwaysOff );
    QtopiaApplication::setInputMethodHint( b->interval_lightoff, QtopiaApplication::AlwaysOff );
    QtopiaApplication::setInputMethodHint( b->interval_suspend, QtopiaApplication::AlwaysOff );

    lightLayout->addWidget(b);

    baseLayout->addWidget(sView);

    // add context menu to push its status to Profiles
    contextMenu = QSoftMenuBar::menuFor( this );
    QAction* actionCapture = new QAction( QIcon( ":icon/Note" ), tr( "Add to current profile" ), this );
    contextMenu->addAction( actionCapture );
    connect( actionCapture, SIGNAL(triggered()), this, SLOT(pushSettingStatus()) );
    connect( qApp, SIGNAL(appMessage(QString,QByteArray)),
        this, SLOT(receive(QString,QByteArray)) );

    connect( b->interval_dim, SIGNAL(valueChanged(int)), this, SLOT(updateLightOffMinValue(int)) );
    connect( b->interval_dim, SIGNAL(valueChanged(int)), this, SLOT(updateSuspendMinValue(int)) );
    connect( b->interval_lightoff, SIGNAL(valueChanged(int)), this, SLOT(updateSuspendMinValue(int)) );

    b->officon->setPixmap(QPixmap(":image/off").scaled(24, 24, Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
    b->brighticon->setPixmap(QPixmap(":image/Light").scaled(24, 24, Qt::IgnoreAspectRatio, Qt::SmoothTransformation));

    QSettings hwConfig("Trolltech", "Hardware");
    hwConfig.beginGroup("PowerManagement");
    lockMode.canSuspend = hwConfig.value("CanSuspendLock", false).toBool();    
    batteryMode.canSuspend = hwConfig.value("CanSuspend", false).toBool();
    externalMode.canSuspend = hwConfig.value("CanSuspendAC", false).toBool();
    hwConfig.endGroup();

    b->notnetworkedsuspend->hide();

    if (batteryMode.canSuspend || externalMode.canSuspend || lockMode.canSuspend) {
        b->interval_suspend->setEnabled(true);
    } else {
        b->interval_suspend->hide();
        b->label_suspend->hide();
    }

    QSettings config("Trolltech","qpe");
    
    config.beginGroup("LockPower");
    lockMode.intervalDim = config.value( "Interval_Dim", 20 ).toInt();
    lockMode.intervalLightOff = config.value("Interval_LightOff", 30).toInt();
    lockMode.intervalSuspend = config.value("Interval", 60).toInt();
    lockMode.brightness = config.value("Brightness", 255).toInt();
    lockMode.brightness = qMax(1,lockMode.brightness * qpe_sysBrightnessSteps() / 255);
    lockMode.initBrightness = lockMode.brightness;
    lockMode.dim = config.value("Dim", true).toBool();
    lockMode.lightoff = config.value("LightOff", false).toBool();
    lockMode.suspend = config.value("Suspend", true).toBool();
    lockMode.networkedsuspend = config.value("NetworkedSuspend", true).toBool();
    config.endGroup();

    config.beginGroup("BatteryPower");
    batteryMode.intervalDim = config.value( "Interval_Dim", 20 ).toInt();
    batteryMode.intervalLightOff = config.value("Interval_LightOff", 30).toInt();
    batteryMode.intervalSuspend = config.value("Interval", 60).toInt();
    batteryMode.brightness = config.value("Brightness", 255).toInt();
    batteryMode.brightness = qMax(1,batteryMode.brightness * qpe_sysBrightnessSteps() / 255);
    batteryMode.initBrightness = batteryMode.brightness;
    batteryMode.dim = config.value("Dim", true).toBool();
    batteryMode.lightoff = config.value("LightOff", false).toBool();
    batteryMode.suspend = config.value("Suspend", true).toBool();
    batteryMode.networkedsuspend = config.value("NetworkedSuspend", true).toBool();
    config.endGroup();

    config.beginGroup("ExternalPower");
    externalMode.intervalDim = config.value( "Interval_Dim", 20 ).toInt();
    externalMode.intervalLightOff = config.value("Interval_LightOff", 30).toInt();
    externalMode.intervalSuspend = config.value("Interval", 240).toInt();
    externalMode.brightness = config.value("Brightness", 255).toInt();
    externalMode.brightness = qMax(1,externalMode.brightness * qpe_sysBrightnessSteps() / 255);
    externalMode.initBrightness = externalMode.brightness;
    externalMode.dim = config.value("Dim", true).toBool();
    externalMode.lightoff = config.value("LightOff", false).toBool();   //default to leave on
    externalMode.suspend = config.value("Suspend", true).toBool();
    externalMode.networkedsuspend = config.value("NetworkedSuspend",false).toBool();
    config.endGroup();

    //must set min > 0 the screen will become completely black
    int maxbright = qpe_sysBrightnessSteps();
    b->brightness->setMaximum( maxbright );
    b->brightness->setMinimum( 1 );
    b->brightness->setTickInterval( qMax(1,maxbright/16) );
    b->brightness->setSingleStep( qMax(1,maxbright/16) );
    b->brightness->setPageStep( qMax(1,maxbright/16) );

    currentMode = &batteryMode;
    applyMode();

    connect(b->powerSource, SIGNAL(currentIndexChanged(int)),
            this, SLOT(powerTypeChanged(int)));
    if ( powerStatus.wallStatus() == QPowerStatus::Available ) {
        b->powerSource->setCurrentIndex(1);
    }

    connect(b->brightness, SIGNAL(valueChanged(int)), this, SLOT(applyBrightness()));

    QtopiaChannel *channel = new QtopiaChannel("Qtopia/PowerStatus", this);
    connect(channel, SIGNAL(received(QString,QByteArray)),
            this, SLOT(sysMessage(QString,QByteArray)));
}
Example #27
0
PreFlightMiscPage::PreFlightMiscPage(QWidget *parent) :
  QWidget(parent)
{
  setObjectName("PreFlightMiscPage");
  setWindowFlags( Qt::Tool );
  setWindowModality( Qt::WindowModal );
  setAttribute(Qt::WA_DeleteOnClose);
  setWindowTitle( tr("PreFlight - Common") );

  if( parent )
    {
      resize( parent->size() );
    }

  // Layout used by scroll area
  QHBoxLayout *sal = new QHBoxLayout;

  // new widget used as container for the dialog layout.
  QWidget* sw = new QWidget;

  // Scroll area
  QScrollArea* sa = new QScrollArea;
  sa->setWidgetResizable( true );
  sa->setFrameStyle( QFrame::NoFrame );
  sa->setWidget( sw );

#ifdef QSCROLLER
  QScroller::grabGesture( sa->viewport(), QScroller::LeftMouseButtonGesture );
#endif

#ifdef QTSCROLLER
  QtScroller::grabGesture( sa->viewport(), QtScroller::LeftMouseButtonGesture );
#endif

  // Add scroll area to its own layout
  sal->addWidget( sa );

  QHBoxLayout *contentLayout = new QHBoxLayout(this);

  // Pass scroll area layout to the content layout.
  contentLayout->addLayout( sal, 10 );

  // Top layout's parent is the scroll widget
  QGridLayout *topLayout = new QGridLayout(sw);

  int row = 0;

  QLabel *lbl = new QLabel(tr("Minimal arrival altitude:"));
  topLayout->addWidget(lbl, row, 0);

  // get current set altitude unit. This unit must be considered during
  // storage. The internal storage is always in meters.
  m_altUnit = Altitude::getUnit();

  // Input accept only feet and meters all other make no sense. Therefore all
  // other (FL) is treated as feet.
  m_edtMinimalArrival = new NumberEditor;
  m_edtMinimalArrival->setDecimalVisible( false );
  m_edtMinimalArrival->setPmVisible( false );
  m_edtMinimalArrival->setRange( 0, 9999);
  m_edtMinimalArrival->setMaxLength(4);
  m_edtMinimalArrival->setSuffix(" " + Altitude::getUnitText());

  QRegExpValidator* eValidator = new QRegExpValidator( QRegExp( "([0-9]{1,4})" ), this );
  m_edtMinimalArrival->setValidator( eValidator );

  int maw = QFontMetrics(font()).width("9999 ft") + 10;
  m_edtMinimalArrival->setMinimumWidth( maw );

  topLayout->addWidget(m_edtMinimalArrival, row, 1);
  topLayout->setColumnStretch(2, 2);
  row++;

  lbl = new QLabel(tr("Arrival altitude display:"));
  topLayout->addWidget(lbl, row, 0);
  m_edtArrivalAltitude = new QComboBox;
  m_edtArrivalAltitude->addItem( tr("Landing Target"), GeneralConfig::landingTarget );
  m_edtArrivalAltitude->addItem( tr("Next Target"), GeneralConfig::nextTarget );
  topLayout->addWidget(m_edtArrivalAltitude, row, 1);
  row++;

  lbl = new QLabel(tr("QNH:"));
  topLayout->addWidget(lbl, row, 0);

  m_edtQNH = new NumberEditor;
  m_edtQNH->setDecimalVisible( false );
  m_edtQNH->setPmVisible( false );
  m_edtQNH->setRange( 0, 9999);
  m_edtQNH->setMaxLength(4);
  m_edtQNH->setSuffix(" hPa");

  eValidator = new QRegExpValidator( QRegExp( "([0-9]{1,4})" ), this );
  m_edtQNH->setValidator( eValidator );

  int mqw = QFontMetrics(font()).width("9999 hPa") + 10;
  m_edtQNH->setMinimumWidth( mqw );

  topLayout->addWidget(m_edtQNH, row, 1);
  row++;

  lbl = new QLabel(tr("LD average time") + ":");
  topLayout->addWidget(lbl, row, 0);

  m_edtLDTime = new NumberEditor;
  m_edtLDTime->setDecimalVisible( false );
  m_edtLDTime->setPmVisible( false );
  m_edtLDTime->setRange( 5, 600 );
  m_edtLDTime->setMaxLength(3);
  m_edtLDTime->setSuffix(" s");
  m_edtLDTime->setTitle( tr("LD average time") );
  m_edtLDTime->setTip( "5 ... 600 s" );

  eValidator = new QRegExpValidator( QRegExp( "([0-9]{1,3})" ), this );
  m_edtLDTime->setValidator( eValidator );

  topLayout->addWidget(m_edtLDTime, row, 1);
  row++;

  topLayout->setRowMinimumHeight(row, 10);
  row++;

  m_chkLogAutoStart = new QCheckBox(tr("Autostart IGC logger"));
  topLayout->addWidget(m_chkLogAutoStart, row, 0 );

  // get current used horizontal speed unit. This unit must be considered
  // during storage.
  m_speedUnit = Speed::getHorizontalUnit();

  m_logAutoStartSpeed = new DoubleNumberEditor( this );
  m_logAutoStartSpeed->setDecimalVisible( true );
  m_logAutoStartSpeed->setPmVisible( false );
  m_logAutoStartSpeed->setMaxLength(4);
  m_logAutoStartSpeed->setRange( 1.0, 99.9);
  m_logAutoStartSpeed->setPrefix( "> " );
  m_logAutoStartSpeed->setSuffix( QString(" ") + Speed::getHorizontalUnitText() );
  m_logAutoStartSpeed->setDecimals( 1 );

  int mlw = QFontMetrics(font()).width("99.9" + Speed::getHorizontalUnitText()) + 10;
  m_logAutoStartSpeed->setMinimumWidth( mlw );

  topLayout->addWidget( m_logAutoStartSpeed, row, 1 );
  row++;

  lbl = new QLabel(tr("B-Record Interval:"));
  topLayout->addWidget(lbl, row, 0);

  m_bRecordInterval = new NumberEditor;
  m_bRecordInterval->setDecimalVisible( false );
  m_bRecordInterval->setPmVisible( false );
  m_bRecordInterval->setRange( 1, 60);
  m_bRecordInterval->setTip("1...60 s");
  m_bRecordInterval->setMaxLength(2);
  m_bRecordInterval->setSuffix(" s");

  eValidator = new QRegExpValidator( QRegExp( "([0-9]{1,2})" ), this );
  m_bRecordInterval->setValidator( eValidator );

  int mbrw = QFontMetrics(font()).width("99 s") + 10;
  m_bRecordInterval->setMinimumWidth( mbrw );

  topLayout->addWidget(m_bRecordInterval, row, 1);
  row++;

  lbl = new QLabel(tr("K-Record Interval:"));
  topLayout->addWidget(lbl, row, 0);

  m_kRecordInterval = new NumberEditor;
  m_kRecordInterval->setDecimalVisible( false );
  m_kRecordInterval->setPmVisible( false );
  m_kRecordInterval->setRange( 0, 300);
  m_kRecordInterval->setTip("0...300 s");
  m_kRecordInterval->setMaxLength(3);
  m_kRecordInterval->setSuffix(" s");
  m_kRecordInterval->setSpecialValueText(tr("Off"));

  eValidator = new QRegExpValidator( QRegExp( "([0-9]{1,2})" ), this );
  m_kRecordInterval->setValidator( eValidator );

  int mkrw = QFontMetrics(font()).width("999 s") + 10;
  m_kRecordInterval->setMinimumWidth( mkrw );

  topLayout->addWidget(m_kRecordInterval, row, 1);
  row++;

  topLayout->setRowMinimumHeight(row, 10);
  row++;

  topLayout->setRowStretch(row, 10);

  QPushButton *help = new QPushButton(this);
  help->setIcon(QIcon(GeneralConfig::instance()->loadPixmap("help32.png")));
  help->setIconSize(QSize(Layout::getButtonSize(12), Layout::getButtonSize(12)));
  help->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::QSizePolicy::Preferred);

  QPushButton *cancel = new QPushButton(this);
  cancel->setIcon(QIcon(GeneralConfig::instance()->loadPixmap("cancel.png")));
  cancel->setIconSize(QSize(Layout::getButtonSize(12), Layout::getButtonSize(12)));
  cancel->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::QSizePolicy::Preferred);

  QPushButton *ok = new QPushButton(this);
  ok->setIcon(QIcon(GeneralConfig::instance()->loadPixmap("ok.png")));
  ok->setIconSize(QSize(Layout::getButtonSize(12), Layout::getButtonSize(12)));
  ok->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::QSizePolicy::Preferred);

  QLabel *titlePix = new QLabel(this);
  titlePix->setAlignment( Qt::AlignCenter );
  titlePix->setPixmap( _globalMapConfig->createGlider(315, 1.6) );

  connect(help, SIGNAL(pressed()), this, SLOT(slotHelp()));
  connect(ok, SIGNAL(pressed()), this, SLOT(slotAccept()));
  connect(cancel, SIGNAL(pressed()), this, SLOT(slotReject()));

  QVBoxLayout *buttonBox = new QVBoxLayout;
  buttonBox->setSpacing(0);
  buttonBox->addWidget(help, 1);
  buttonBox->addStretch(2);
  buttonBox->addWidget(cancel, 1);
  buttonBox->addSpacing(30);
  buttonBox->addWidget(ok, 1);
  buttonBox->addStretch(2);
  buttonBox->addWidget(titlePix);
  contentLayout->addLayout(buttonBox);

  load();
}
Example #28
0
//initialize according to the type and the cube database
//
void
TabWidget::initialize( cube::Cube* cube, QString fileName,
                       cubeparser::Driver* driver, Statistics* statistics )
{
    this->cube = cube;

    TreeWidget* treeWidget;

    if ( type == METRICTAB )
    {
        //metric tabs have a metric tree
        ScrollArea* scrollArea = new ScrollArea( this, ScrollAreaTreeWidget );
        treeWidget = new TreeWidget( scrollArea, METRICTREE, fileName, driver, statistics );
        connect( treeWidget, SIGNAL( setMessage( QString ) ), this, SIGNAL( setMessage( QString ) ) );
        treeWidget->setFont( treeFont );
        treeWidget->setSpacing( spacing );
        treeWidget->setTabWidget( this );
        treeWidget->initialize( cube );
        scrollArea->setMainWidget( treeWidget );
        addTab( scrollArea, "Metric tree" );
    }
    else if ( type == CALLTAB )
    {
        //call tabs have a call tree and a flat call profile
        ScrollArea* scrollArea = new ScrollArea( this, ScrollAreaTreeWidget );
        treeWidget = new TreeWidget( scrollArea, CALLTREE, fileName, driver, statistics );
        connect( treeWidget, SIGNAL( setMessage( QString ) ), this, SIGNAL( setMessage( QString ) ) );
        treeWidget->setFont( treeFont );
        treeWidget->setSpacing( spacing );
        treeWidget->setTabWidget( this );
        treeWidget->initialize( cube );
        scrollArea->setMainWidget( treeWidget );
        addTab( scrollArea, "Call tree" );

        scrollArea = new ScrollArea( this, ScrollAreaTreeWidget );
        treeWidget = new TreeWidget( scrollArea, CALLFLAT );
        connect( treeWidget, SIGNAL( setMessage( QString ) ), this, SIGNAL( setMessage( QString ) ) );
        treeWidget->setFont( treeFont );
        treeWidget->setSpacing( spacing );
        treeWidget->setTabWidget( this );
        treeWidget->initialize( cube );
        scrollArea->setMainWidget( treeWidget );
        addTab( scrollArea, "Flat view" );
    }
    else if ( type == SYSTEMTAB )
    {
        subsetCombo = new QComboBox();
        subsetCombo->setModel( &subsetModel );
        subsetCombo->setWhatsThis(
            tr( "The Boxplot uses the currently selected subset of threads when determining its statistics."
                " Other defined subsets can be chosen from the combobox menu, such as \"All\" threads or"
                " \"Visited\" threads for only threads that visited the currently selected callpath."
                " Additional subsets can be defined from the System Tree with the \"Define subset\" context menu"
                " using the currently selected threads via multiple selection (control + left mouseclick)"
                " or with the \"Find items\" context menu selection option." ) );
        fillSubsetCombo();
        connect( subsetCombo, SIGNAL( currentIndexChanged( int ) ), this, SLOT( displayItems() ) );
        connect( subsetCombo, SIGNAL( currentIndexChanged( int ) ), this, SLOT( updateSubsetCombo() ) );

        //system tabs have a system tree, topologies and box plot
        {
            ScrollArea* scrollArea = new ScrollArea( this, ScrollAreaTreeWidget );
            treeWidget = new TreeWidget( scrollArea, SYSTEMTREE );
            connect( treeWidget, SIGNAL( setMessage( QString ) ), this, SIGNAL( setMessage( QString ) ) );
            connect( treeWidget, SIGNAL( selectionChanged() ), this, SLOT( resetSubsetCombo() ) );
            treeWidget->setFont( treeFont );
            treeWidget->setSpacing( spacing );
            treeWidget->setTabWidget( this );
            treeWidget->initialize( cube );
            scrollArea->setMainWidget( treeWidget );

            SplitterContainer* container = new SplitterContainer();
            container->setComponent( treeWidget ); // main component, used in TabWidget
            container->addWidget( scrollArea );

            connect( treeWidget, SIGNAL( definedSubsetsChanged( const QString & ) ),
                     this, SLOT( fillSubsetCombo( const QString & ) ) );
            container->addWidget( subsetCombo );

            QList<int> sizeList;
            sizeList << container->size().height() << 1;
            container->setSizes( sizeList );
            addTab( container, "System tree" );
        }
        {   // box plot tab
            SplitterContainer* container  = new SplitterContainer();
            ScrollArea*        scrollArea = new ScrollArea( this, ScrollAreaBoxPlot );
            systemBoxWidget = new SystemBoxPlot( scrollArea, treeWidget );
            scrollArea->setMainWidget( systemBoxWidget );
            scrollArea->setWidgetResizable( true );
            scrollArea->setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
            scrollArea->setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff );

            container->setComponent( systemBoxWidget ); // main component, used in TabWidget
            container->addWidget( scrollArea );

            // set lower splitter element to minimum size (1 pixel => replaced by minimumSize())
            QList<int> sizeList;
            sizeList << container->size().height() << 1;
            container->setSizes( sizeList );
            systemBoxPlotIndex = addTab( container, "Box Plot" );
        }
        {
            SystemTopologyWidget* systemTopologyWidget;
            unsigned              numTopologies = cube->get_cartv().size();

            for ( unsigned i = 0; i < numTopologies; i++ )
            {
                QString name = ( cube->get_cartv() ).at( i )->get_name().c_str();
                if ( name == "" )
                {
                    name.append( "Topology " );
                    name.append( QString::number( i ) );
                }
                SplitterContainer* container = new SplitterContainer();
                systemTopologyWidget = new SystemTopologyWidget( treeWidget, i );

                systemTopologyWidget->setLineType( lineType );
                systemTopologyWidget->initialize( cube );

                container->setComponent( systemTopologyWidget );
                container->addWidget( systemTopologyWidget );

                /** add topology dimension toolbar with scrollPane */
                QWidget* dimBar = systemTopologyWidget->getDimensionSelectionBar( cube );
                if ( dimBar != 0 )
                {
                    QScrollArea* scroll = new QScrollArea();
                    container->addWidget( scroll );
                    scroll->setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
                    scroll->setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
                    scroll->setFrameStyle( QFrame::NoFrame );
                    scroll->setMinimumHeight( dimBar->minimumSizeHint().height() );
                    scroll->setMaximumHeight( dimBar->minimumSizeHint().height() );
                    scroll->setWidget( dimBar );
                    long ndims = ( cube->get_cartv() ).at( i )->get_ndims();
                    if ( ndims <= 3 )   // minimize dimension selection bar
                    {
                        QList<int> sizeList;
                        sizeList << 1 << 0;
                        container->setSizes( sizeList );
                    }
                }

                addTab( container, name );
            }
        } // SYSTEMTAB
    }
Example #29
0
SettingsPageTask::SettingsPageTask( QWidget *parent) :
  QWidget( parent ),
  m_selectedSwitchScheme(0),
  m_distUnit(Distance::getUnit()),
  m_startLineValue(0),
  m_startRingValue(0),
  m_startSectorInnerRadiusValue(0),
  m_startSectorOuterRadiusValue(0),
  m_startSectorAngleValue(0),
  m_finishLineValue(0),
  m_finishRingValue(0),
  m_finishSectorInnerRadiusValue(0),
  m_finishSectorOuterRadiusValue(0),
  m_finishSectorAngleValue(0),
  m_obsCircleRadiusValue(0),
  m_obsSectorInnerRadiusValue(0),
  m_obsSectorOuterRadiusValue(0),
  m_obsSectorAngleValue(0)
{
  setObjectName("SettingsPageTask");
  setWindowFlags( Qt::Tool );
  setWindowModality( Qt::WindowModal );
  setAttribute(Qt::WA_DeleteOnClose);
  setWindowTitle( tr("Settings - Task") );

  if( parent )
    {
      resize( parent->size() );
    }

  // Layout used by scroll area
  QHBoxLayout *sal = new QHBoxLayout;

  // new widget used as container for the dialog layout.
  QWidget* sw = new QWidget;

  // Scroll area
  QScrollArea* sa = new QScrollArea;
  sa->setWidgetResizable( true );
  sa->setFrameStyle( QFrame::NoFrame );
  sa->setWidget( sw );

#ifdef ANDROID
  QScrollBar* lvsb = sa->verticalScrollBar();
  lvsb->setStyleSheet( Layout::getCbSbStyle() );
#endif

#ifdef QSCROLLER
  QScroller::grabGesture( sa->viewport(), QScroller::LeftMouseButtonGesture );
#endif

#ifdef QTSCROLLER
  QtScroller::grabGesture( sa->viewport(), QtScroller::LeftMouseButtonGesture );
#endif

  // Add scroll area to its own layout
  sal->addWidget( sa );

  QHBoxLayout *contentLayout = new QHBoxLayout(this);

  // Pass scroll area layout to the content layout.
  contentLayout->addLayout( sal );

  GeneralConfig *conf = GeneralConfig::instance();
  int row = 0;

  QGridLayout *topLayout = new QGridLayout(sw);
  //contentLayout->addLayout(topLayout);

  topLayout->setMargin(10);
  topLayout->setSpacing(20);
  topLayout->setColumnStretch( 3, 5 );

  //---------------------------------------------------------------
  QGroupBox *ssBox = new QGroupBox( tr("Switch Scheme"), this );
  topLayout->addWidget( ssBox, row, 0 );

  ntScheme = new QButtonGroup(this);
  QRadioButton* nearest  = new QRadioButton( tr("Minimum"), this );
  QRadioButton* touched  = new QRadioButton( tr("Touched"), this );

  ntScheme->addButton( nearest, 0 );
  ntScheme->addButton( touched, 1 );

  m_reportSwitch = new QCheckBox( tr("Report"), this );

  QVBoxLayout* vbox = new QVBoxLayout;
  vbox->addWidget( nearest );
  vbox->addWidget( touched );
  vbox->addWidget( m_reportSwitch );
  vbox->addStretch(1);
  ssBox->setLayout(vbox);

  nearest->setEnabled(true);
  touched->setEnabled(true);
  touched->setChecked(true);

  // set active button as selected
  m_selectedSwitchScheme = (int) conf->getActiveTaskSwitchScheme();

  if( ntScheme->button(m_selectedSwitchScheme) )
    {
      ntScheme->button(m_selectedSwitchScheme)->setChecked(true);
    }

  connect( ntScheme, SIGNAL(buttonClicked(int)),
           this, SLOT(slot_buttonPressedNT(int)) );

  //--------------------------------------------------------------
  // as next shape group is added
  QGroupBox* shapeGroup = new QGroupBox( tr("Shape"), this );
  topLayout->addWidget( shapeGroup, row, 1 );

  QGridLayout *gBox = new QGridLayout;
  shapeGroup->setLayout(gBox);

  m_drawShape = new QCheckBox( tr("Draw"), this );
  gBox->addWidget(m_drawShape, 0, 0 );
  m_fillShape = new QCheckBox( tr("Fill"), this );
  gBox->addWidget(m_fillShape, 1, 0 );
  gBox->setColumnStretch( 2, 5 );

  connect( m_fillShape, SIGNAL(stateChanged(int)),
           SLOT(slot_fillShapeStateChanged(int)) );

  m_transShape = new NumberEditor( this );
  m_transShape->setDecimalVisible( false );
  m_transShape->setPmVisible( false );
  m_transShape->setMaxLength(3);
  m_transShape->setSuffix( " %" );
  m_transShape->setRange( 0, 100 );
  m_transShape->setTip(tr("Opacity ") + "0...100");
  m_transShape->setValue( 0 );
  QRegExpValidator* eValidator = new QRegExpValidator( QRegExp( "(0|[1-9][0-9]{0,2})" ), this );
  m_transShape->setValidator( eValidator );

  // Sets a minimum width for the widget
  int mw1 = QFontMetrics(font()).width("100 %") + 10;
  m_transShape->setMinimumWidth( mw1 );
  gBox->addWidget(m_transShape, 1, 1 );

  m_drawShape->setChecked( conf->getTaskDrawShape() );
  m_fillShape->setChecked( conf->getTaskFillShape() );

  //--------------------------------------------------------------
  // as next auto zoom group is added
  QGroupBox* zoomGroup = new QGroupBox( tr("Zoom"), this );
  topLayout->addWidget( zoomGroup, row, 2 );

  QVBoxLayout *zBox = new QVBoxLayout;
  zoomGroup->setLayout(zBox);

  m_autoZoom = new QCheckBox( tr("Auto"), this );
  zBox->addWidget(m_autoZoom);
  zBox->addStretch(10);

  m_autoZoom->setChecked( conf->getTaskPointAutoZoom() );

#ifdef ANDROID
  topLayout->setRowMinimumHeight( ++row, 30 );
#endif

  row++;

  //--------------------------------------------------------------
  // as next start group is added
  QGroupBox* startGroup1 = new QGroupBox( tr("Start"), this );
  topLayout->addWidget( startGroup1, row, 0 );
  QFormLayout *formLayout = new QFormLayout;
  startGroup1->setLayout(formLayout);

  m_startLine = createDNE( this );
  m_startLine->setTip(tr("Line Length"));
  formLayout->addRow(tr("Line:"), m_startLine);

  m_startRing = createDNE( this );
  m_startRing->setTip(tr("Circle Radius"));
  formLayout->addRow(tr("Circle:"), m_startRing);

  //--------------------------------------------------------------
  // as next inner sector group is added
  QGroupBox* startGroup2 = new QGroupBox( tr("Sectors"), this );
  topLayout->addWidget( startGroup2, row, 1 );
  formLayout = new QFormLayout;
  startGroup2->setLayout(formLayout);

  m_startSectorInnerRadius = createDNE( this );
  m_startSectorInnerRadius->setTip(tr("Inner Radius"));
  formLayout->addRow(tr("Radius 1:"), m_startSectorInnerRadius);

  m_startSectorOuterRadius = createDNE( this );
  m_startSectorOuterRadius->setTip(tr("Outer Radius"));
  formLayout->addRow(tr("Radius 2:"), m_startSectorOuterRadius);

  m_startSectorAngle = createNE( this );
  m_startSectorAngle->setTip(tr("Angle 1...360"));

  formLayout->addRow(tr("Angle:"), m_startSectorAngle);

  //--------------------------------------------------------------
  // as next inner scheme group is added
  QGroupBox* startGroup3 = new QGroupBox( tr("Scheme"), this );
  topLayout->addWidget( startGroup3, row, 2 );
  formLayout = new QFormLayout;
  startGroup3->setLayout(formLayout);

  QRadioButton* circle  = new QRadioButton( tr("Circle"), this );
  QRadioButton* sector  = new QRadioButton( tr("Sector"), this );
  QRadioButton* keyhole = new QRadioButton( tr("Keyhole"), this );
  QRadioButton* line    = new QRadioButton( tr("Line"), this );

  startScheme = new QButtonGroup(this);
  startScheme->addButton( circle, GeneralConfig::Circle );
  startScheme->addButton( sector, GeneralConfig::Sector );
  startScheme->addButton( keyhole, GeneralConfig::Keyhole );
  startScheme->addButton( line, GeneralConfig::Line );

  formLayout->addWidget( circle );
  formLayout->addWidget( sector );
  formLayout->addWidget( keyhole );
  formLayout->addWidget( line );

  circle->setEnabled(true);
  circle->setChecked(false);
  sector->setEnabled(true);
  sector->setChecked(false);
  keyhole->setEnabled(true);
  keyhole->setChecked(false);
  line->setEnabled(true);
  line->setChecked(false);

  // set active button as selected
  m_selectedStartScheme = (int) conf->getActiveTaskStartScheme();

  if( startScheme->button(m_selectedStartScheme) )
    {
      startScheme->button(m_selectedStartScheme)->setChecked(true);
    }

#ifdef ANDROID
  topLayout->setRowMinimumHeight( ++row, 30 );
#endif

  row++;

  //--------------------------------------------------------------
  // as next finish group is added
  QGroupBox* finishGroup1 = new QGroupBox( tr("Finish"), this );
  topLayout->addWidget( finishGroup1, row, 0 );
  formLayout = new QFormLayout;
  finishGroup1->setLayout(formLayout);

  m_finishLine = createDNE( this );
  m_finishLine->setTip(tr("Line Length"));
  formLayout->addRow(tr("Line:"), m_finishLine);

  m_finishRing = createDNE( this );
  m_finishRing->setTip(tr("Circle Radius"));
  formLayout->addRow(tr("Circle"), m_finishRing);

  //--------------------------------------------------------------
  // as next inner sector group is added
  QGroupBox* finishGroup2 = new QGroupBox( tr("Sectors"), this );
  topLayout->addWidget( finishGroup2, row, 1 );
  formLayout = new QFormLayout;
  finishGroup2->setLayout(formLayout);

  m_finishSectorInnerRadius = createDNE( this );
  m_finishSectorInnerRadius->setTip(tr("Inner Radius"));
  formLayout->addRow(tr("Radius 1:"), m_finishSectorInnerRadius);

  m_finishSectorOuterRadius = createDNE( this );
  m_finishSectorOuterRadius->setTip(tr("Outer Radius"));
  formLayout->addRow(tr("Radius 2:"), m_finishSectorOuterRadius);

  m_finishSectorAngle = createNE( this );
  m_finishSectorAngle->setTip(tr("Angle 1...360"));
  formLayout->addRow(tr("Angle:"), m_finishSectorAngle);

  //--------------------------------------------------------------
  // as next inner scheme group is added
  QGroupBox* finishGroup3 = new QGroupBox( tr("Scheme"), this );
  topLayout->addWidget( finishGroup3, row, 2 );
  formLayout = new QFormLayout;
  finishGroup3->setLayout(formLayout);

  circle  = new QRadioButton( tr("Circle"), this );
  sector  = new QRadioButton( tr("Sector"), this );
  keyhole = new QRadioButton( tr("Keyhole"), this );
  line    = new QRadioButton( tr("Line"), this );

  finishScheme = new QButtonGroup(this);
  finishScheme->addButton( circle, GeneralConfig::Circle );
  finishScheme->addButton( sector, GeneralConfig::Sector );
  finishScheme->addButton( keyhole, GeneralConfig::Keyhole );
  finishScheme->addButton( line, GeneralConfig::Line );

  formLayout->addWidget( circle );
  formLayout->addWidget( sector );
  formLayout->addWidget( keyhole );
  formLayout->addWidget( line );

  circle->setEnabled(true);
  circle->setChecked(false);
  sector->setEnabled(true);
  sector->setChecked(false);
  keyhole->setEnabled(true);
  keyhole->setChecked(false);
  line->setEnabled(true);
  line->setChecked(false);

  // set active button as selected
  m_selectedFinishScheme = (int) conf->getActiveTaskFinishScheme();

  if( finishScheme->button(m_selectedFinishScheme) )
    {
      finishScheme->button(m_selectedFinishScheme)->setChecked(true);
    }

#ifdef ANDROID
  topLayout->setRowMinimumHeight( ++row, 30 );
#endif

  row++;

  //--------------------------------------------------------------
  // as next observation zone is added
  QGroupBox* obZoneGroup1 = new QGroupBox( tr("Observation"), this );
  topLayout->addWidget( obZoneGroup1, row, 0 );
  formLayout = new QFormLayout;
  obZoneGroup1->setLayout(formLayout);

  m_obsCircleRadius = createDNE( this );
  m_obsCircleRadius->setTip(tr("Circle Radius"));
  formLayout->addRow(tr("Circle:"), m_obsCircleRadius);

  //--------------------------------------------------------------
  // as next inner sector group is added
  QGroupBox* obZoneGroup2 = new QGroupBox( tr("Sectors"), this );
  topLayout->addWidget( obZoneGroup2, row, 1 );
  formLayout = new QFormLayout;
  obZoneGroup2->setLayout(formLayout);

  m_obsSectorInnerRadius = createDNE( this );
  m_obsSectorInnerRadius->setTip(tr("Inner Radius"));
  formLayout->addRow(tr("Radius 1:"), m_obsSectorInnerRadius);

  m_obsSectorOuterRadius = createDNE( this );
  m_obsSectorOuterRadius->setTip(tr("Outer Radius"));
  formLayout->addRow(tr("Radius 2:"), m_obsSectorOuterRadius);

  m_obsSectorAngle = createNE( this );
  m_obsSectorAngle->setTip(tr("Angle 1...360"));
  formLayout->addRow(tr("Angle:"), m_obsSectorAngle);

  //--------------------------------------------------------------
  // as next inner observer scheme group is added
  QGroupBox* obZoneGroup3 = new QGroupBox( tr("Scheme"), this );
  topLayout->addWidget( obZoneGroup3, row, 2 );
  formLayout = new QFormLayout;
  obZoneGroup3->setLayout(formLayout);

  circle  = new QRadioButton( tr("Circle"), this );
  sector  = new QRadioButton( tr("Sector"), this );
  keyhole = new QRadioButton( tr("Keyhole"), this );
  // no line for observer area

  obsScheme = new QButtonGroup(this);
  obsScheme->addButton( circle, GeneralConfig::Circle );
  obsScheme->addButton( sector, GeneralConfig::Sector );
  obsScheme->addButton( keyhole, GeneralConfig::Keyhole );

  formLayout->addWidget( circle );
  formLayout->addWidget( sector );
  formLayout->addWidget( keyhole );

  circle->setEnabled(true);
  circle->setChecked(false);
  sector->setEnabled(true);
  sector->setChecked(false);
  keyhole->setEnabled(true);
  keyhole->setChecked(false);

  // set active button as selected
  m_selectedObsScheme = (int) conf->getActiveTaskObsScheme();

  if( obsScheme->button(m_selectedObsScheme) )
    {
      obsScheme->button(m_selectedObsScheme)->setChecked(true);
    }

  //--------------------------------------------------------------
  // Connect sector check controls.
  connect( m_startSectorOuterRadius, SIGNAL(numberEdited(const QString&)),
           this, SLOT(slot_outerSectorStartChanged(const QString&)) );
  connect( m_finishSectorOuterRadius, SIGNAL(numberEdited(const QString&)),
           this, SLOT(slot_outerSectorFinishChanged(const QString&)) );
  connect( m_obsSectorOuterRadius, SIGNAL(numberEdited(const QString&)),
           this, SLOT(slot_outerSectorObsChanged(const QString&)) );
  connect( startScheme, SIGNAL(buttonClicked(int)), this, SLOT(slot_buttonPressedSS(int)) );
  connect( finishScheme, SIGNAL(buttonClicked(int)), this, SLOT(slot_buttonPressedFS(int)) );
  connect( obsScheme, SIGNAL(buttonClicked(int)), this, SLOT(slot_buttonPressedOS(int)) );

  QPushButton *cancel = new QPushButton(this);
  cancel->setIcon(QIcon(GeneralConfig::instance()->loadPixmap("cancel.png")));
  cancel->setIconSize(QSize(Layout::getButtonSize(12), Layout::getButtonSize(12)));
  cancel->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::QSizePolicy::Preferred);

  QPushButton *ok = new QPushButton(this);
  ok->setIcon(QIcon(GeneralConfig::instance()->loadPixmap("ok.png")));
  ok->setIconSize(QSize(Layout::getButtonSize(12), Layout::getButtonSize(12)));
  ok->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::QSizePolicy::Preferred);

  QLabel *titlePix = new QLabel(this);
  titlePix->setAlignment( Qt::AlignCenter );
  titlePix->setPixmap(GeneralConfig::instance()->loadPixmap("setup.png"));

  connect(ok, SIGNAL(pressed()), this, SLOT(slotAccept()));
  connect(cancel, SIGNAL(pressed()), this, SLOT(slotReject()));

  QVBoxLayout *buttonBox = new QVBoxLayout;
  buttonBox->setSpacing(0);
  buttonBox->addStretch(2);
  buttonBox->addWidget(cancel, 1);
  buttonBox->addSpacing(30);
  buttonBox->addWidget(ok, 1);
  buttonBox->addStretch(2);
  buttonBox->addWidget(titlePix);
  contentLayout->addLayout(buttonBox);

  load();
}
Example #30
0
MainWindow::MainWindow() {
    setupUi(this);
    m_dirty = false;

    m_logWindow->setVisible(false);
    m_imageView->setFocus();
    m_imageView->setHandler(this);

    ParamGroup *g, *gg;

    new ParamChoice(this, "output", "edges", "edges|fill|fill+edges", &output);
    new ParamChoice(this, "input_gamma", "linear-rgb", "srgb|linear-rgb", &input_gamma);

    g = new ParamGroup(this, "structure_tensor");
    new ParamChoice(g, "st_type", "scharr-lab", "central-diff|sobel-rgb|sobel-lab|sobel-L|scharr-rgb|scharr-lab|gaussian-deriv|etf-full|etf-xy", &st_type);
    new ParamDouble(g, "sigma_c", 2.28, 0, 20, 0.1, &sigma_c);
    new ParamDouble(g, "precision_sigma_c", sqrt(-2*log(0.05)), 1, 10, 1, &precision_sigma_c);
    new ParamInt   (g, "etf_N", 3, 0, 10, 1, &etf_N);

    g = new ParamGroup(this, "bilateral_filter", false, &enable_bf);
    new ParamChoice(g, "type", "xy", "oa|xy|fbl|full", &filter_type);
    new ParamInt   (g, "n_e",     1, 0, 20, 1, &n_e);
    new ParamInt   (g, "n_a",     4, 0, 20, 1, &n_a);
    new ParamDouble(g, "sigma_dg", 3, 0, 20, 0.05, &sigma_dg);
    new ParamDouble(g, "sigma_dt", 3, 0, 20, 0.05, &sigma_dt);
    new ParamDouble(g, "sigma_rg", 4.25, 0, 100, 0.05, &sigma_rg);
    new ParamDouble(g, "sigma_rt", 4.25, 0, 100, 0.05, &sigma_rt);
    new ParamDouble(g, "bf_alpha", 0, 0, 10000, 1, &bf_alpha);
    new ParamDouble(g, "precision_g", 2, 1, 10, 1, &precision_g);
    new ParamDouble(g, "precision_t", 2, 1, 10, 1, &precision_t);

    g = new ParamGroup(this, "dog");
    ParamGroup* dog_group = g;
    connect(g, SIGNAL(dirty()), SLOT(dogChanged()));

    new ParamChoice(g, "type", "flow-based", "isotropic|flow-based", &dog_type);
    new ParamDouble(g, "sigma_e", 1.4, 0, 20, 0.005, &sigma_e);
    new ParamDouble(g, "dog_k", 1.6, 1, 10, 0.01, &dog_k);
    new ParamDouble(g, "precision_e", 3, 1, 5, 0.1, &precision_e);
    new ParamDouble(g, "sigma_m", 4.4, 0, 20, 1, &sigma_m);
    new ParamDouble(g, "precision_m", 2, 1, 5, 0.1, &precision_m);
    new ParamDouble(g, "step_m", 1, 0.01, 2, 0.1, &step_m);

    new ParamChoice(g, "adj_func", "smoothstep", "smoothstep|tanh", &dog_adj_func);
    new ParamBool  (g, "dog_reparam", true, &dog_reparam);
    gg = new ParamGroup(g, "", true);
    dog_tau_g = gg;
    dog_eps_ptr = new ParamDouble(gg, "epsilon", 3.50220, -100, 100, 0.005, &dog_eps);
    dog_tau_ptr = new ParamDouble(gg, "tau", 0.95595, 0, 2, 0.005, &dog_tau);
    dog_phi_ptr = new ParamDouble(gg, "phi", 0.3859, 0, 1e32, 0.1, &dog_phi);

    gg = new ParamGroup(g, "", false);
    dog_p_g = gg;
    dog_p_ptr     = new ParamDouble(gg, "p", 21.7, 0, 1e6, 1, &dog_p);
    dog_eps_p_ptr = new ParamDouble(gg, "epsilon_p", 79.5, -1e32, 1e32, 0.5, &dog_eps_p);
    dog_phi_p_ptr = new ParamDouble(gg, "phi_p", 0.017, -1e32, 1e32, 0.05, &dog_phi_p);

    new ParamChoice(g, "dog_fgauss", "euler", "euler|rk2-nn|rk2|rk4", &dog_fgauss);

    g = new ParamGroup(this, "quantization", false, &quantization);
    new ParamChoice(g, "quant_type", "adaptive", "fixed|adaptive", &quant_type);
    new ParamInt   (g, "nbins", 8, 1, 255, 1, &nbins);
    new ParamDouble(g, "phi_q", 2, 0, 100, 0.025, &phi_q);
    new ParamDouble(g, "lambda_delta", 0, 0, 100, 1, &lambda_delta);
    new ParamDouble(g, "omega_delta", 2, 0, 100, 1, &omega_delta);
    new ParamDouble(g, "lambda_phi", 0.9, 0, 100, 1, &lambda_phi);
    new ParamDouble(g, "omega_phi", 1.6, 0, 100, 1, &omega_phi);

    g = new ParamGroup(this, "warp_sharp", false, &warp_sharp);
    new ParamDouble(g, "sigma_w", 1.5, 0, 20, 1, &sigma_w);
    new ParamDouble(g, "precision_w", 2, 1, 5, 0.1, &precision_w);
    new ParamDouble(g, "phi_w", 2.7, 0, 100, 0.025, &phi_w);

    g = new ParamGroup(this, "final_smooth", true, &final_smooth);
    new ParamChoice(g, "type", "flow-nearest", "3x3|5x5|flow-nearest|flow-linear", &final_type);
    new ParamDouble(g, "sigma_a", 1.0, 0, 10, 1, &sigma_a);

    QScrollArea *sa = new QScrollArea(this);
    QWidget *parea = new QWidget(sa);
    sa->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Expanding);
    sa->setFixedWidth(300);
    sa->setWidget(parea);
    sa->setFrameStyle(QFrame::NoFrame);
    sa->setFocusPolicy(Qt::NoFocus);
    sa->setWidgetResizable(true);
    sa->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
    m_vbox1->addWidget(sa);

    m_paramui = new ParamUI(parea, this);
    QVBoxLayout *pbox = new QVBoxLayout(parea);
    pbox->setContentsMargins(4,4,4,4);
    pbox->addWidget(m_paramui);
    pbox->addStretch(0);

    connect(m_select, SIGNAL(currentIndexChanged(int)), this, SLOT(onIndexChanged(int)));

    m_player = new VideoPlayer(this, ":/test.png");
    connect(m_player, SIGNAL(videoChanged(int)), this, SLOT(onVideoChanged(int)));
    connect(m_player, SIGNAL(currentFrameChanged(int)), this, SLOT(setDirty()));
    connect(m_player, SIGNAL(outputChanged(const QImage&)), m_imageView, SLOT(setImage(const QImage&)));
    connect(this, SIGNAL(imageChanged(const QImage&)), m_player, SLOT(setOutput(const QImage&)));

    m_videoControls->setFrameStyle(QFrame::NoFrame);
    m_videoControls->setAutoHide(true);
    connect(m_videoControls, SIGNAL(stepForward()), m_player, SLOT(stepForward()));
    connect(m_videoControls, SIGNAL(stepBack()), m_player, SLOT(stepBack()));
    connect(m_videoControls, SIGNAL(currentFrameTracked(int)), m_player, SLOT(setCurrentFrame(int)));
    connect(m_videoControls, SIGNAL(playbackChanged(bool)), m_player, SLOT(setPlayback(bool)));
    connect(m_videoControls, SIGNAL(trackingChanged(bool)), this, SLOT(setDirty()));

    connect(m_player, SIGNAL(videoChanged(int)), m_videoControls, SLOT(setFrameCount(int)));
    connect(m_player, SIGNAL(playbackChanged(bool)), m_videoControls, SLOT(setPlayback(bool)));
    connect(m_player, SIGNAL(currentFrameChanged(int)), m_videoControls, SLOT(setCurrentFrame(int)));
}