void SVPlotPropertyDockWidget::Private::setupUi(SVPlotPropertyDockWidget *dock) {
  QtTreePropertyBrowser *plotBrowser = new QtTreePropertyBrowser(dock);
  plotBrowser->setRootIsDecorated(false);
  setupPlotProperties(plotBrowser);

  QtTreePropertyBrowser *curveBrowser = new QtTreePropertyBrowser(dock);
  curveBrowser->setRootIsDecorated(false);
  setupCurveProperties(curveBrowser);

  browserStack = new QStackedWidget(dock);
  browserStack->addWidget(plotBrowser);
  browserStack->addWidget(curveBrowser);

  dock->setFeatures(QDockWidget::AllDockWidgetFeatures);
  dock->setObjectName("PropertyDock");
  dock->setWidget(browserStack);

  hideProperties();
}
StitchLibraryUi::StitchLibraryUi(QWidget* parent)
    : QDialog(parent), ui(new Ui::StitchLibraryDialog)
{
    ui->setupUi(this);

    ui->stitchSource->addItems(StitchLibrary::inst()->stitchSetList());

    StitchSet* master = StitchLibrary::inst()->masterStitchSet();

    mProxyModel = new QSortFilterProxyModel(this);

    mProxyModel->setSourceModel(master);
    mProxyModel->setSortCaseSensitivity(Qt::CaseInsensitive);

    ui->listView->setModel(mProxyModel);
    ui->listView->setSortingEnabled(true);

    StitchLibraryDelegate *delegate = new StitchLibraryDelegate(ui->listView);
    ui->listView->setItemDelegate(delegate);

    setDialogSize();
    ui->listView->horizontalHeader()->setClickable(true);
    ui->listView->horizontalHeader()->setSortIndicatorShown(true);

    //TODO: Wrong Side.
    ui->listView->hideColumn(4);

    ui->propertiesBox->setVisible(false);
    connect(ui->moreBttn, SIGNAL(clicked()), SLOT(hideProperties()));
    connect(ui->printSet, SIGNAL(clicked()), SLOT(printStitchSet()));

    connect(ui->addStitch, SIGNAL(clicked()), SLOT(addStitch()));
    connect(ui->removeStitch, SIGNAL(clicked()), SLOT(removeStitch()));
    connect(ui->addSelected, SIGNAL(clicked()), SLOT(addSelected()));

    connect(ui->createSet, SIGNAL(clicked()), SLOT(createSet()));
    connect(ui->removeSet, SIGNAL(clicked()), SLOT(removeSet()));

    connect(ui->importSet, SIGNAL(clicked()), SLOT(importSet()));
    connect(ui->exportSet, SIGNAL(clicked()), SLOT(exportSet()));

    connect(ui->setName, SIGNAL(editingFinished()), SLOT(updateStitchSetProperties()));
    connect(ui->author,  SIGNAL(editingFinished()), SLOT(updateStitchSetProperties()));
    connect(ui->email,   SIGNAL(editingFinished()), SLOT(updateStitchSetProperties()));
    connect(ui->org,     SIGNAL(editingFinished()), SLOT(updateStitchSetProperties()));
    connect(ui->url,     SIGNAL(editingFinished()), SLOT(updateStitchSetProperties()));

    setupPropertiesBox();
    
    connect(ui->stitchSource, SIGNAL(currentIndexChanged(QString)), SLOT(changeStitchSet(QString)));

    connect(ui->resetLibrary, SIGNAL(clicked()), SLOT(resetLibrary()));
    connect(ui->icons, SIGNAL(clicked()), SLOT(iconDialog()));

    connect(ui->listView->horizontalHeader(),
            SIGNAL(sectionClicked(int)), SLOT(updateRowSizes()));

    connect(ui->stitchFilter, SIGNAL(textChanged(QString)), SLOT(filterStitchList(QString)));
    connect(ui->clearBttn, SIGNAL(clicked()), SLOT(clearStitchFilter()));

    setButtonStates(master);
}