Example #1
0
void StackedWidget::reloadData() {
	removePages();

	DataManager& manager = DataManager::getInstance();

	if( manager.isempty() ) {
		addWidget( new QLabel(tr("No quantities found.")) );
		return;
	}

	//Home
	StackedWidgetHome *home = new StackedWidgetHome(this);
	addWidget(home);
	connect(home, &StackedWidgetHome::quantityChosen, this, &StackedWidget::quantityChosen);

	//all quantities
	for(Quantity& quantity : manager) {
		QScrollArea *scroll = new QScrollArea(this);
		scroll->setWidgetResizable(true);
		scroll->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
		scroll->setWidget(new QuantityWidget( quantity, this ));
		addWidget(scroll);
	}

	QStackedWidget::update();
}
Example #2
0
PaletteBox::PaletteBox(QWidget* parent)
   : QDockWidget(tr("Palettes"), parent)
      {
      setObjectName("palette-box");
      setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);

      QScrollArea* sa = new QScrollArea;
      sa->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum);
      sa->setContextMenuPolicy(Qt::CustomContextMenu);
      sa->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
      sa->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
      sa->setWidgetResizable(true);
      setWidget(sa);

      QWidget* paletteList = new QWidget;
      sa->setWidget(paletteList);
      vbox = new QVBoxLayout;
      paletteList->setLayout(vbox);
      _dirty = false;
      vbox->setMargin(0);
      vbox->setSpacing(1);
      vbox->addStretch();
      paletteList->show();

//      connect(sa, SIGNAL(customContextMenuRequested(const QPoint&)), SLOT(contextMenu(const QPoint&)));
      }
Example #3
0
/*!
  \brief Constructor.
  Creates a new instance of ProjectWindow.
  \param pro project data to show, not null.
  \param parent parent widgets of this window, default value is 0.
 */
Ui::ProjectWindow::ProjectWindow(Core::Project *pro, QWidget *parent /* = 0 */)
        : QMdiSubWindow(parent),
          project(pro)
{
    // entry conditions
    Q_CHECK_PTR(pro);

    setAttribute(Qt::WA_DeleteOnClose);

    setWindowIcon(QIcon(":/proj"));
    setWindowTitle(project->name());
    setMinimumSize(200, 200);

    // project view, the main widget
    view = new ProjectView(this);
    scene = new ProjectScene(project, this);
    view->setScene(scene);
    view->setSceneRect(0, 0, project->width(), project->height());
    QScrollArea* centerPanel = new QScrollArea(this);
    centerPanel->viewport()->setStyleSheet(QString("background-color:#C0C0C0"));
    centerPanel->setAlignment(Qt::AlignCenter);
    centerPanel->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
    centerPanel->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    centerPanel->setWidget(view);

    // status bar
    statusBar = new QWidget(this);
    QHBoxLayout *statusLayout = new QHBoxLayout(statusBar);
    statusLayout->setMargin(0);
    statusBar->setLayout(statusLayout);
    QLineEdit* percentInput = new QLineEdit(statusBar);
    percentInput->setText("100");
    percentInput->setFixedSize(40, 18);
    QLabel *msgLabel = new QLabel(statusBar);
    msgLabel->setText("%");
    msgLabel->setFixedWidth(8);
    QPushButton *gridButton = new QPushButton(statusBar);
    gridButton->setText("#");
    gridButton->setCheckable(true);
    gridButton->setFixedSize(20, 18);
    QLabel *ctrlLabel = new QLabel(statusBar);
    ctrlLabel->setFixedWidth(qApp->style()->pixelMetric(QStyle::PM_ScrollBarExtent) - 6);
    statusLayout->addWidget(percentInput);
    statusLayout->addWidget(msgLabel);
    statusLayout->addWidget(gridButton);
    statusLayout->addWidget(centerPanel->horizontalScrollBar(), 100);
    statusLayout->addWidget(ctrlLabel);

    QWidget *mainPanel = new QWidget(this);
    QVBoxLayout *mainLayout = new QVBoxLayout;
    mainLayout->setMargin(0);
    mainLayout->setSpacing(0);
    mainLayout->addWidget(centerPanel);
    mainLayout->addWidget(statusBar);
    mainPanel->setLayout(mainLayout);
    setWidget(mainPanel);

    connect(gridButton, SIGNAL(clicked(bool)), scene, SLOT(showGrid(bool)));
    connect(appCtx->mainWindow(), SIGNAL(antialiasingChanged(bool)), scene, SLOT(setAntialiasing(bool)));
}
Example #4
0
EffectStackEdit::EffectStackEdit(QWidget *parent) :
        QWidget(parent),
        m_in(0),
        m_out(0),
        m_frameSize(QPoint())
{
    setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding));
    QVBoxLayout *vbox1 = new QVBoxLayout(parent);
    vbox1->setContentsMargins(0, 0, 0, 0);
    vbox1->setSpacing(0);

    QScrollArea *area = new QScrollArea;
    QWidget *wid = new QWidget(parent);
    area->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    area->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
    wid->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum));
    area->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::MinimumExpanding));

    vbox1->addWidget(area);
    area->setWidget(wid);
    area->setWidgetResizable(true);
    m_vbox = new QVBoxLayout(wid);
    m_vbox->setContentsMargins(0, 0, 0, 0);
    m_vbox->setSpacing(0);
    wid->show();

}
Example #5
0
    MainWindow(QWidget* parent) {
        resize(800, 600);

        QLabel* imageLabel = new QLabel;
        QImage image("sample.png");
        imageLabel->setPixmap(QPixmap::fromImage(image));
        QWidget* wdg = imageLabel;

        // Standard QScrollArea will add scroll bars around the image label
        QScrollArea* scrollArea = new QScrollArea(this);

        // The UnboundedScrollArea shows how it should look like
        //QScrollArea* scrollArea = new UnboundedScrollArea(this);

        scrollArea->setHorizontalScrollBarPolicy( Qt::ScrollBarAsNeeded);
        scrollArea->setVerticalScrollBarPolicy( Qt::ScrollBarAsNeeded);
        scrollArea->setWidget(wdg);

        QGridLayout* layout = new QGridLayout();
        layout->setMargin(0);
        layout->setHorizontalSpacing(0);
        layout->setVerticalSpacing(0);
        layout->setRowStretch(0, 1);
        layout->setRowStretch(2, 1);
        layout->setColumnStretch(0, 1);
        layout->setColumnStretch(2, 1);
        layout->addWidget(scrollArea, 1, 1);

        QWidget* centralWidget = new QWidget(this);
        centralWidget->setLayout(layout);
        setCentralWidget(centralWidget);
    }
Example #6
0
//---------------------------------------------------------------------------
PlotLegend::PlotLegend( QWidget *parent ):
        QwtLegend( parent )
{
    setMinimumHeight( 1 );
    setMaxColumns( 1 );
    setContentsMargins( 0, 0, 0, 0 );

    QLayout* layout = contentsWidget()->layout();
    layout->setAlignment( Qt::AlignLeft | Qt::AlignTop );
    layout->setSpacing( 0 );

    QScrollArea *scrollArea = findChild<QScrollArea *>();
    if ( scrollArea )
    {
        scrollArea->setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
        scrollArea->setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
    }

#if 1
    QFont fnt = font();
    if ( fnt.pointSize() > 8 )
    {
        fnt.setPointSize( 8 );
        setFont( fnt );
    }
#endif
}
void QmitkFunctionality::CreatePartControl(void* parent)
{

  // scrollArea
  QScrollArea* scrollArea = new QScrollArea;  
  //QVBoxLayout* scrollAreaLayout = new QVBoxLayout(scrollArea);
  scrollArea->setFrameShadow(QFrame::Plain);
  scrollArea->setFrameShape(QFrame::NoFrame);
  scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
  scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);

  // m_Parent
  m_Parent = new QWidget;
  //m_Parent->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding));
  this->CreateQtPartControl(m_Parent);

  //scrollAreaLayout->addWidget(m_Parent);
  //scrollArea->setLayout(scrollAreaLayout);

  // set the widget now
  scrollArea->setWidgetResizable(true);
  scrollArea->setWidget(m_Parent);

  // add the scroll area to the real parent (the view tabbar)
  QWidget* parentQWidget = static_cast<QWidget*>(parent);
  QVBoxLayout* parentLayout = new QVBoxLayout(parentQWidget);
  parentLayout->setMargin(0);
  parentLayout->setSpacing(0);
  parentLayout->addWidget(scrollArea);

  // finally set the layout containing the scroll area to the parent widget (= show it)
  parentQWidget->setLayout(parentLayout);

  this->AfterCreateQtPartControl();
}
void RenderWindow::slotMenuAboutNews()
{
	QString filename = systemData.docDir + "NEWS";

	QFile f(filename);
	QString text = "";
	if (f.open(QIODevice::ReadOnly | QIODevice::Text))
	{
		text = f.readAll();
	}

	QLabel *label = new QLabel;
	label->setText(text);
	label->setWordWrap(true);
	label->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);

	QScrollArea *scroll = new QScrollArea();
	scroll->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
	scroll->setWidget(label);
	scroll->setWidgetResizable(true);

	QHBoxLayout *layout = new QHBoxLayout();
	layout->addWidget(scroll);
	QDialog *dialog = new QDialog();
	dialog->setLayout(layout);
	dialog->setWindowTitle(QObject::tr("News"));
	dialog->show();
}
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 #10
0
_choicedialog::_choicedialog(QWidget* _parent, QString _sAllowed) : QDialog(_parent)
{
  setAttribute(Qt::WA_DeleteOnClose);
  setWindowFlags(windowFlags() | Qt::Tool);

  QVBoxLayout *j = new QVBoxLayout();
  setLayout(j);

  QWidget *g = new QWidget();

  QVBoxLayout *jj = new QVBoxLayout();
  g->setLayout(jj);
  QScrollArea *a = new QScrollArea(this);
  a->setWidget(g);
  a->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
  a->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded); 
  a->setWidgetResizable(true);

  QStringList l;
  if (_sAllowed.contains(";")) l = _sAllowed.split(";");
  else if (_sAllowed.contains(",")) l = _sAllowed.split(",");
  
  for (int i = 0; i < l.size(); i++){   
    
    pref[l.at(i)] = new QCheckBox(l.at(i), g); 
    QCheckBox *c = pref[l.at(i)];
    jj->addWidget(c);
    c->setChecked(sSet.contains(l.at(i)));
  }

  j->addWidget(a);

  setWindowTitle(tr("Selectable Properties"));
  setModal(true);
  
  QWidget *f = new QWidget();
  QHBoxLayout *fj = new QHBoxLayout();
  f->setLayout(fj);
  j->addWidget(f);
 
  QPushButton *p;

  p = new QPushButton(tr("&Ok"), f); fj->addWidget(p);
  connect(p, SIGNAL( clicked() ), this, SLOT(performClose()) );
 
  move(QApplication::desktop()->width() / 2 - sizeHint().width() / 2, QApplication::desktop()->height() / 2 - sizeHint().height() / 2);
  
  qApp->setActiveWindow(this);

  exec();
  
}
Example #11
0
QWidget *TilesetItemBox::makeCategory(const QString &categoryItem)
{
    QTabWidget *TileSetsCategories = ui->TileSetsCategories;
    QWidget *catWid;
    QWidget *scrollWid;
    QGridLayout *catLayout;
    QLabel *grpLabel;
    QComboBox *tilesetGroup;
    QSpacerItem *spItem;
    QScrollArea *TileSets;
    FlowLayout *theLayOut;


    catWid = new QWidget();
    scrollWid = new QWidget();
    catLayout = new QGridLayout(catWid);
    catLayout->setSpacing(0);
    catLayout->setContentsMargins(0, 0, 0, 0);
    grpLabel = new QLabel(catWid);
    grpLabel->setText(tr("Group:"));
    catLayout->addWidget(grpLabel, 0, 0, 1, 1);

    tilesetGroup = new QComboBox(catWid);

    catLayout->addWidget(tilesetGroup, 0, 1, 1, 1);
    tilesetGroup->setInsertPolicy(QComboBox::InsertAlphabetically);
    spItem = new QSpacerItem(1283, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
    catLayout->addItem(spItem, 0, 2, 1, 1);
    TileSets = new QScrollArea(catWid);
    TileSets->setWidget(scrollWid);
    TileSets->setWidgetResizable(true);
    TileSets->setFrameShape(QFrame::StyledPanel);
    TileSets->setFrameShadow(QFrame::Raised);
    TileSets->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
    TileSets->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);

    theLayOut = new FlowLayout(scrollWid);
    theLayOut->setSizeConstraint(QLayout::SetNoConstraint);

    catLayout->addWidget(TileSets, 1, 0, 1, 3);

    TileSetsCategories->addTab(catWid, QString());
    TileSetsCategories->setTabText(TileSetsCategories->indexOf(catWid), categoryItem);

    return catWid;
}
Example #12
0
TrackInfoWidget::TrackInfoWidget( const Tomahawk::query_ptr& query, QWidget* parent )
    : QWidget( parent )
    , ui( new Ui::TrackInfoWidget )
{
    QWidget* widget = new QWidget;
    m_headerWidget = new BasicHeader;
    ui->setupUi( widget );

    m_pixmap = TomahawkUtils::defaultPixmap( TomahawkUtils::DefaultTrackImage, TomahawkUtils::Original, QSize( 48, 48 ) );

    m_relatedTracksModel = new PlayableModel( ui->trackView );
    ui->trackView->trackView()->setPlayableModel( m_relatedTracksModel );
    ui->trackView->setCaption( tr( "Similar Tracks" ) );
    ui->trackView->setEmptyTip( tr( "Sorry, but we could not find similar tracks for this song!" ) );

    ui->topHits->setStyleSheet( QString( "QListView { background-color: #f9f9f9; }" ) );
    TomahawkStyle::stylePageFrame( ui->trackFrame );
    ui->topHits->setVisible( false );
    ui->topHitsLabel->setVisible( false );

    {
        QScrollArea* area = new QScrollArea();
        area->setWidgetResizable( true );
        area->setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
        area->setWidget( widget );

        QPalette pal = palette();
        pal.setBrush( backgroundRole(), Qt::white );
        area->setPalette( pal );
        area->setAutoFillBackground( true );
        area->setFrameShape( QFrame::NoFrame );
        area->setAttribute( Qt::WA_MacShowFocusRect, 0 );

        QVBoxLayout* layout = new QVBoxLayout();
        layout->addWidget( m_headerWidget );
        layout->addWidget( area );
        setLayout( layout );
        TomahawkUtils::unmarginLayout( layout );
    }

    load( query );
}
Example #13
0
    void CChatWidget::initWidget()
    {
        QGridLayout* pMainLayout = new QGridLayout(this);
        setLayout(pMainLayout);

        m_pChatListWidget = new QWidget(this);
        pMainLayout->addWidget(m_pChatListWidget, 0, 0, 10, 2, Qt::AlignLeft);

        m_pPeerInfoWidget = new QWidget(this);
        pMainLayout->addWidget(m_pPeerInfoWidget, 0, 2, 2, 8);
        QHBoxLayout* pPeerInfoLayout = new QHBoxLayout(m_pPeerInfoWidget);
        m_pPeerInfoWidget->setLayout(pPeerInfoLayout);
        pPeerInfoLayout->addWidget(new QLabel(tr("name"), m_pPeerInfoWidget));
        pPeerInfoLayout->addWidget(new QLabel(tr("ip"), m_pPeerInfoWidget));
        pPeerInfoLayout->addWidget(new QLabel(tr("port"), m_pPeerInfoWidget));

        m_pRecordWidget = new QWidget(this);
        m_pRecordWidget->setLayout(new QVBoxLayout(m_pRecordWidget));
        QScrollArea* pLogArea = new QScrollArea(this);
        pLogArea->setWidget(m_pRecordWidget);
        pLogArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
        pLogArea->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
        pMainLayout->addWidget(pLogArea, 2, 2, 5, 8);

        pLogArea->setWidgetResizable(true);
        pLogArea->setStyleSheet(
                    "QWidget{background-color: transparent;} QScrollArea{background-color: rgba(255, 255, 255, 59);}");

        m_psbRecord = pLogArea->verticalScrollBar();

        QWidget* pInputWidget = new QWidget(this);
        pMainLayout->addWidget(pInputWidget, 7, 2, 3, 8);
        QHBoxLayout* pInputLayout = new QHBoxLayout(pInputWidget);
        pInputWidget->setLayout(pInputLayout);
        m_pteInput = new QTextEdit(pInputWidget);
        pInputLayout->addWidget(m_pteInput);
        QPushButton* pbtnSend = new QPushButton(tr("send"), pInputWidget);
        pInputLayout->addWidget(pbtnSend);

        bool VARIABLE_IS_NOT_USED bIsSendConOK = connect(pbtnSend, SIGNAL(clicked()), this, SLOT(sendButtonClicked()));
        Q_ASSERT(bIsSendConOK);
    }
Example #14
0
QWidget *StartWidget::createPluginsList()
{
	QWidget * const circleWidget = new CircleWidget(QSize(70, 70), ":/mainWindow/images/startTab/new.svg");
	circleWidget->setStyleSheet(BrandManager::styles()->startTabButtonStyle());

	QVBoxLayout * const innerLayout = new QVBoxLayout;
	innerLayout->addStretch();
	foreach (const Id &editor, mMainWindow->editorManager().editors()) {
		const Id editorTmpId = Id::loadFromString("qrm:/" + editor.editor());
		foreach (const Id &diagram, mMainWindow->editorManager().diagrams(editorTmpId)) {
			QWidget * const pluginWidget = createPluginButton(editor, diagram, circleWidget);
			innerLayout->addWidget(pluginWidget);
		}
	}

	innerLayout->addStretch();
	innerLayout->setContentsMargins(0, 0, 0, 0);
	innerLayout->setMargin(0);
	innerLayout->setSpacing(0);

	QWidget *innerWidget = new QWidget;
	innerWidget->setLayout(innerLayout);

	QScrollArea *scrollArea = new QScrollArea;
	scrollArea->setFrameShape(QFrame::NoFrame);
	scrollArea->setWidgetResizable(true);
	scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
	scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
	scrollArea->setWidget(innerWidget);

	QHBoxLayout * const mainLayout = new QHBoxLayout;
	mainLayout->addWidget(circleWidget, Qt::AlignCenter);
	mainLayout->addWidget(scrollArea);
	mainLayout->setStretch(0, 0);
	mainLayout->setStretch(1, 10);
	mainLayout->setMargin(0);

	QWidget * const result = new QWidget;
	result->setLayout(mainLayout);

	return result;
}
Example #15
0
/**
 * \brief    Constructeur de l'éditeur de document
 * \param    d  document ressource
 */
DocumentEditor::DocumentEditor(Document *d, QWidget *parent) :
    NoteEditor(d, parent), resource(d){

    // add or create note
    QPushButton* addBtn = new QPushButton("Ajouter une note existante");
    QObject::connect(addBtn, SIGNAL(clicked()), this, SLOT(addFront()));
    QPushButton* createBtn = new QPushButton("Créer une note");
    QObject::connect(createBtn, SIGNAL(clicked()), this, SLOT(createFront()));
    QHBoxLayout* addLayout = new QHBoxLayout();
    addLayout->addWidget(addBtn);
    addLayout->addWidget(createBtn);

    // scroll area
    QWidget* mainWidget = new QWidget(this);
    QVBoxLayout * vLayout = new QVBoxLayout(mainWidget);
    QScrollArea * scrollArea = new QScrollArea(mainWidget);
    scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
    scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
    scrollArea->setWidgetResizable(false);
    scrollLayout = new QVBoxLayout;
    QWidget* scrollAreaWidgetContents = new QWidget;
    for (Document::iterator it = d->begin(); it != d->end(); ++it){
        DocumentEditorRow* row = new DocumentEditorRow(*it, this);
        rows.push_back(row);
        scrollLayout->addWidget(rows.back());
        QObject::connect(row, SIGNAL(onMoveUp(DocumentEditorRow*)), this, SLOT(moveUp(DocumentEditorRow*)));
        QObject::connect(row, SIGNAL(onMoveDown(DocumentEditorRow*)), this, SLOT(moveDown(DocumentEditorRow*)));
        QObject::connect(row, SIGNAL(onEdit(DocumentEditorRow*)), this, SLOT(edit(DocumentEditorRow*)));
        QObject::connect(row, SIGNAL(onSupress(DocumentEditorRow*)), this, SLOT(supress(DocumentEditorRow*)));
        QObject::connect(row, SIGNAL(onAdd(DocumentEditorRow*)), this, SLOT(add(DocumentEditorRow*)));
        QObject::connect(row, SIGNAL(onCreate(DocumentEditorRow*)), this, SLOT(create(DocumentEditorRow*)));
    }
    scrollAreaWidgetContents->setLayout(scrollLayout);
    scrollLayout->setSizeConstraint(QLayout::SetFixedSize);
    scrollArea->setWidget(scrollAreaWidgetContents);
    vLayout->addWidget(scrollArea);

    // layout
    layout->addLayout(addLayout);
    layout->addWidget(mainWidget);
}
Example #16
0
/**
 * @brief creates the Line widget
 * representative of this class and assign it to the appropriate
 * class variable.
 */
void Line::BuildEditor() {
    //Creating forms
    ParameterHolder = new QFormLayout();
    QGridLayout *ButtonHolder = new QGridLayout();
    QFormLayout *HolderHolder = new QFormLayout();

    //making parameterHolder form more useful
    ParameterHolder->setSizeConstraint(QLayout::SetMinimumSize);

    //Populating forms
    PopulateButtons(ButtonHolder);
    PopulateParameters(ParameterHolder);

    //Encapsulating Widgets
    QWidget *ParamWidg = new QWidget();
    QWidget *ButtonWidg = new QWidget();
    QWidget *HolderWidg = new QWidget();
    ParamWidg->setLayout(ParameterHolder);
    ButtonWidg->setLayout(ButtonHolder);
    HolderWidg->setLayout(HolderHolder);

    //Creating scrollbar
    QScrollArea *scrollArea = new QScrollArea();
    scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
    scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);

    //Setting Pointers
    scrollArea->setWidget(ParamWidg);
    HolderHolder->addRow(scrollArea);
    HolderHolder->addRow(ButtonWidg);

    //hide yo kids, hide yo wife, hide everything
    Line_Color->setEnabled(false);
    Line_Width->setEnabled(false);
    Line_Style->setEnabled(false);


    this->CommandEditorWidget = HolderWidg;

    this->move(0,0);
}
void MenuWidget::addSection(const python::list& section)
{                        
    QWidget* page = new QWidget();
    page->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Preferred);
    QVBoxLayout* vbox = new QVBoxLayout();
    page->setLayout(vbox);

    buttonList.push_back(vector<QWidget*>());
    vector<QWidget*>& buttons = buttonList.back();

    int numItems = python::len(section) / 2;

    for(int j=0; j < numItems; ++j){
        // extract a pair of elements
        const string label = python::extract<string>(section[j*2]);
        const string function = python::extract<string>(section[j*2+1]);

        if(function == "#label"){
            vbox->addWidget(new QLabel(label.c_str()), 0, Qt::AlignCenter);

        } else if(label == "#monitor"){

        } else {
            FuncButtonBox* box = new FuncButtonBox(label, function);
            box->button.sigClicked().connect(boost::bind(&MenuWidget::onButtonClicked, this, buttons.size(), box));
            vbox->addWidget(box, 0, Qt::AlignCenter);
            buttons.push_back(box);
        }
    }

    vbox->addStretch();

    QScrollArea* area = new QScrollArea();
    area->setWidgetResizable(true);
    area->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
    area->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    area->setAlignment(Qt::AlignHCenter);
    area->setWidget(page);
    pageStack.addWidget(area);
}
ExtremeDownloadDialog::ExtremeDownloadDialog(QWidget *parent) :
    QDialog(parent)
{
    QVBoxLayout *mainLayout = new QVBoxLayout;

    QScrollArea *scrollArea = new QScrollArea;
    scrollArea->setWidgetResizable(true);
    scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);

    scrollBar = scrollArea->verticalScrollBar();

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

    grid = new QGridLayout(contents);

    manager = new QNetworkAccessManager;
    pageNumber = 1;

    QNetworkRequest request(QUrl( QString("http://www.extreme-down.net/films-sd/dvdrip/page/%1/").arg(pageNumber++) ));
    QNetworkReply *reply = manager->get(request);
    connect(reply,SIGNAL(finished()),this,SLOT(extract()));

    QScrollBar *scroll = scrollArea->verticalScrollBar();
    connect(scroll,SIGNAL(valueChanged(int)),this,SLOT(needMore(int)));


    QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Close);

    connect(buttonBox,SIGNAL(accepted()),this,SLOT(accept()));
    connect(buttonBox,SIGNAL(rejected()),this,SLOT(reject()));

    mainLayout->addWidget(scrollArea);
    mainLayout->addWidget(buttonBox);

    this->setLayout(mainLayout);
}
Example #19
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);
  }

}
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 #21
0
KeyBinder::KeyBinder(QWidget * parent, const QString & helpText, const QString & defaultText, const QString & resetButtonText) : QWidget(parent)
{
    this->defaultText = defaultText;
    enableSignal = false;

    // Two-column tab layout
    QHBoxLayout * pageKeysLayout = new QHBoxLayout(this);
    pageKeysLayout->setSpacing(0);
    pageKeysLayout->setContentsMargins(0, 0, 0, 0);

    // Table for category list
    QVBoxLayout * catListContainer = new QVBoxLayout();
    catListContainer->setContentsMargins(10, 10, 10, 10);
    catList = new QListWidget();
    catList->setFixedWidth(180);
    catList->setStyleSheet("QListWidget::item { font-size: 14px; } QListWidget:hover { border-color: #F6CB1C; } QListWidget::item:selected { background: #150A61; color: yellow; }");
    catList->setFocusPolicy(Qt::NoFocus);
    connect(catList, SIGNAL(currentRowChanged(int)), this, SLOT(changeBindingsPage(int)));
    catListContainer->addWidget(catList);
    pageKeysLayout->addLayout(catListContainer);

    // Reset all binds button
    if (!resetButtonText.isEmpty())
    {
        QPushButton * btnResetAll = new QPushButton(resetButtonText);
        catListContainer->addWidget(btnResetAll);
        btnResetAll->setFixedHeight(40);
        catListContainer->setStretch(1, 0);
        catListContainer->setSpacing(10);
        connect(btnResetAll, SIGNAL(clicked()), this, SIGNAL(resetAllBinds()));
    }

    // Container for pages of key bindings
    QWidget * bindingsPagesContainer = new QWidget();
    QVBoxLayout * rightLayout = new QVBoxLayout(bindingsPagesContainer);

    // Scroll area for key bindings
    QScrollArea * scrollArea = new QScrollArea();
    scrollArea->setContentsMargins(0, 0, 0, 0);
    scrollArea->setWidget(bindingsPagesContainer);
    scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
    scrollArea->setWidgetResizable(true);
    scrollArea->setFrameShape(QFrame::NoFrame);
    scrollArea->setStyleSheet("background: #130F2A;");

    // Add key binding pages to bindings tab
    pageKeysLayout->addWidget(scrollArea);
    pageKeysLayout->setStretch(1, 1);

    // Custom help text
    QLabel * helpLabel = new QLabel();
    helpLabel->setText(helpText);
    helpLabel->setStyleSheet("color: #130F2A; background: #F6CB1C; border: solid 4px #F6CB1C; border-radius: 10px; padding: auto 20px;");
    helpLabel->setFixedHeight(24);
    rightLayout->addWidget(helpLabel, 0, Qt::AlignCenter);

    // Category list and bind table row heights
    const int rowHeight = 20;
    QSize catSize, headerSize;
    catSize.setHeight(36);
    headerSize.setHeight(24);

    // Category list header
    QListWidgetItem * catListHeader = new QListWidgetItem(tr("Category"));
    catListHeader->setSizeHint(headerSize);
    catListHeader->setFlags(Qt::NoItemFlags);
    catListHeader->setForeground(QBrush(QColor("#130F2A")));
    catListHeader->setBackground(QBrush(QColor("#F6CB1C")));
    catListHeader->setTextAlignment(Qt::AlignCenter);
    catList->addItem(catListHeader);

    // Populate
    bindingsPages = new QHBoxLayout();
    bindingsPages->setContentsMargins(0, 0, 0, 0);
    rightLayout->addLayout(bindingsPages);
    QWidget * curPage = NULL;
    QVBoxLayout * curLayout = NULL;
    QTableWidget * curTable = NULL;
    bool bFirstPage = true;
    selectedBindTable = NULL;
    bindComboBoxCellMappings = new QHash<QObject *, QTableWidgetItem *>();
    bindCellComboBoxMappings = new QHash<QTableWidgetItem *, QComboBox *>();
    for (int i = 0; i < BINDS_NUMBER; i++)
    {
        if (cbinds[i].category != NULL)
        {
            // Add stretch at end of previous layout
            if (curLayout != NULL) curLayout->insertStretch(-1, 1);

            // Category list item
            QListWidgetItem * catItem = new QListWidgetItem(HWApplication::translate("binds (categories)", cbinds[i].category));
            catItem->setSizeHint(catSize);
            catList->addItem(catItem);

            // Create new page
            curPage = new QWidget();
            curLayout = new QVBoxLayout(curPage);
            curLayout->setSpacing(2);
            bindingsPages->addWidget(curPage);
            if (!bFirstPage) curPage->setVisible(false);
        }

        // Description
        if (cbinds[i].description != NULL)
        {
            QLabel * desc = new QLabel(HWApplication::translate("binds (descriptions)", cbinds[i].description));
            curLayout->addWidget(desc, 0);
            QFrame * divider = new QFrame();
            divider->setFrameShape(QFrame::HLine);
            divider->setFrameShadow(QFrame::Plain);
            curLayout->addWidget(divider, 0);
        }

        // New table
        if (cbinds[i].category != NULL || cbinds[i].description != NULL)
        {
            curTable = new QTableWidget(0, 2);
            curTable->verticalHeader()->setVisible(false);
            curTable->horizontalHeader()->setVisible(false);
            curTable->horizontalHeader()->setResizeMode(QHeaderView::Stretch);
            curTable->verticalHeader()->setDefaultSectionSize(rowHeight);
            curTable->setShowGrid(false);
            curTable->setStyleSheet("QTableWidget { border: none; } ");
            curTable->setSelectionBehavior(QAbstractItemView::SelectRows);
            curTable->setSelectionMode(QAbstractItemView::SingleSelection);
            curTable->setFocusPolicy(Qt::NoFocus);
            connect(curTable, SIGNAL(itemSelectionChanged()), this, SLOT(bindSelectionChanged()));
            connect(curTable, SIGNAL(itemClicked(QTableWidgetItem *)), this, SLOT(bindCellClicked(QTableWidgetItem *)));
            curLayout->addWidget(curTable, 0);
        }

        // Hidden combo box
        QComboBox * comboBox = CBBind[i] = new QComboBox(curTable);
        comboBox->setModel((QAbstractItemModel*)DataManager::instance().bindsModel());
        comboBox->setVisible(false);
        comboBox->setFixedWidth(200);

        // Table row
        int row = curTable->rowCount();
        QTableWidgetItem * nameCell = new QTableWidgetItem(HWApplication::translate("binds", cbinds[i].name));
        nameCell->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
        curTable->insertRow(row);
        curTable->setItem(row, 0, nameCell);
        QTableWidgetItem * bindCell = new QTableWidgetItem(comboBox->currentText());
        bindCell->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
        curTable->setItem(row, 1, bindCell);
        curTable->resizeColumnsToContents();
        curTable->setFixedHeight(curTable->verticalHeader()->length() + 10);

        // Updates the text in the table cell
        connect(comboBox, SIGNAL(currentIndexChanged(const QString &)), this, SLOT(bindChanged(const QString &)));

        // Map combo box and that row's cells to each other
        bindComboBoxCellMappings->insert(comboBox, bindCell);
        bindCellComboBoxMappings->insert(nameCell, comboBox);
        bindCellComboBoxMappings->insert(bindCell, comboBox);
    }
void
QvisPostableWindowSimpleObserver::CreateEntireWindow()
{
    // If the window is already created, return.
    if(isCreated)
        return;

    // Create the central widget and the top layout.
    QWidget *topCentral = 0;
    QVBoxLayout *vLayout = 0;
    if(notepad)
    {
        central = new QWidget( this );
        setCentralWidget( central );
        topCentral = central;
        topLayout = new QVBoxLayout(central);
        topLayout->setMargin(10);
        vLayout = topLayout;
    }
    else
    {
        topCentral = new QWidget(this);
        vLayout = new QVBoxLayout(topCentral);
        vLayout->setMargin(10);
        vLayout->setSpacing(5);
        setCentralWidget( topCentral );
        
        QScrollArea *sv = new QScrollArea(topCentral);
        sv->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
        sv->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
        sv->setWidgetResizable(true);
        central = new QWidget(0);
        sv->setWidget(central);
        vLayout->addWidget(sv);
        topLayout = new QVBoxLayout(central);
        topLayout->setMargin(10);
    }

    // Call the Sub-class's CreateWindowContents function to create the
    // internal parts of the window.
    CreateWindowContents();

    // Create a button layout and the buttons.
    vLayout->addSpacing(10);
    QGridLayout *buttonLayout = new QGridLayout(0);
    vLayout->addLayout(buttonLayout);
    buttonLayout->setColumnStretch(1, 50);

    // Create the extra buttons if necessary.
    if(buttonCombination & MakeDefaultButton)
    {
        QPushButton *makeDefaultButton = new QPushButton(tr("Make default"),
            topCentral);
        connect(makeDefaultButton, SIGNAL(clicked()),
                this, SLOT(makeDefaultHelper()));
        buttonLayout->addWidget(makeDefaultButton, 0, 0);
    }
    if(buttonCombination & ResetButton)
    {
        QPushButton *resetButton = new QPushButton(tr("Reset"), topCentral);
        connect(resetButton, SIGNAL(clicked()), this, SLOT(reset()));
        buttonLayout->addWidget(resetButton, 0, 4);
    }

    if(buttonCombination & LoadButton)
    {
        QPushButton *loadButton = new QPushButton(tr("Load"),
            topCentral);
        connect(loadButton, SIGNAL(clicked()), this, SLOT(loadSubject()));
        buttonLayout->addWidget(loadButton, 0, 2);
    }
    if(buttonCombination & SaveButton)
    {
        QPushButton *saveButton = new QPushButton(tr("Save"), topCentral);
        connect(saveButton, SIGNAL(clicked()), this, SLOT(saveSubject()));
        buttonLayout->addWidget(saveButton, 0, 3);
    }

    if(buttonCombination & ApplyButton)
    {
        QPushButton *applyButton = new QPushButton(tr("Apply"), topCentral);
        connect(applyButton, SIGNAL(clicked()), this, SLOT(apply()));
        buttonLayout->addWidget(applyButton, 1, 0);
    }
    else
    {
        // Add a little space to try and make up for the absence of the
        // grid layout.
        buttonLayout->setColumnStretch(1, 50);
    }
    QPushButton *helpButton = new QPushButton(topCentral);
    helpButton->setVisible(false);
    helpButton->setText(tr("?"));
    connect(helpButton, SIGNAL(clicked()), this, SLOT(help()));
    buttonLayout->addWidget(helpButton, 1, 2);

    postButton = new QPushButton(tr("Post"), topCentral);
    // Make the window post itself when the post button is clicked.
    if(notepad)
    {
        connect(postButton, SIGNAL(clicked()), this, SLOT(post()));
        postButton->setEnabled(postEnabled);
    }
    else
        postButton->setEnabled(false);
    buttonLayout->addWidget(postButton, 1, 3);
    QPushButton *dismissButton = new QPushButton(tr("Dismiss"), topCentral);
    connect(dismissButton, SIGNAL(clicked()), this, SLOT(hide()));
    buttonLayout->addWidget(dismissButton, 1, 4);


    if(notepad != 0 && stretchWindow)
        vLayout->addStretch(0);

    // Set the isCreated flag.
    isCreated = true;
}
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 #24
0
Dashboard::Dashboard( QWidget* parent )
    : QWidget( parent )
    , ui( new Ui::Dashboard )
    , m_header( new BasicHeader( this ) )
{
    QWidget* widget = new QWidget;
    ui->setupUi( widget );

    m_header->setPixmap( ImageRegistry::instance()->pixmap( RESPATH "images/dashboard.svg", QSize( 0, 0 ) ) );
    m_header->setCaption( tr( "Dashboard" ) );
    m_header->setDescription( tr( "An overview of your recent activity" ) );

    RecentPlaylistsModel* model = new RecentPlaylistsModel( HISTORY_PLAYLIST_ITEMS, this );

    QPalette trackViewPal = ui->tracksView->palette();
    trackViewPal.setColor( QPalette::Foreground, TomahawkStyle::PAGE_FOREGROUND );
    trackViewPal.setColor( QPalette::Text, TomahawkStyle::PAGE_FOREGROUND );
    trackViewPal.setColor( QPalette::Highlight, QColor( "#252020" ) );
    trackViewPal.setColor( QPalette::HighlightedText, Qt::white );

    ui->playlistWidget->setFrameShape( QFrame::NoFrame );
    ui->playlistWidget->setAttribute( Qt::WA_MacShowFocusRect, 0 );
    ui->playlistWidget->setItemDelegate( new PlaylistDelegate() );
    ui->playlistWidget->setModel( model );
    ui->playlistWidget->overlay()->resize( 380, 86 );
    ui->playlistWidget->setVerticalScrollMode( QAbstractItemView::ScrollPerPixel );
    ui->playlistWidget->setPalette( trackViewPal );
    ui->playlistWidget->setMinimumHeight( 400 );
    updatePlaylists();

    m_tracksModel = new RecentlyPlayedModel( ui->tracksView, HISTORY_TRACK_ITEMS );
    ui->tracksView->proxyModel()->setStyle( PlayableProxyModel::ShortWithAvatars );
    ui->tracksView->overlay()->setEnabled( false );
    ui->tracksView->setPlaylistModel( m_tracksModel );
    ui->tracksView->setAutoResize( true );
    m_tracksModel->setSource( source_ptr() );

    ui->tracksView->setPalette( trackViewPal );
    ui->tracksView->setAlternatingRowColors( false );
    ui->tracksView->setFrameShape( QFrame::NoFrame );
    ui->tracksView->setAttribute( Qt::WA_MacShowFocusRect, 0 );

    m_recentAlbumsModel = new AlbumModel( ui->additionsView );
    ui->additionsView->setPlayableModel( m_recentAlbumsModel );
    ui->additionsView->proxyModel()->sort( -1 );

    QScrollArea* area = new QScrollArea();
    area->setWidgetResizable( true );
    area->setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOn );
    area->setWidget( widget );

    QPalette pal = palette();
    // background: qradialgradient(cx: 0.5, cy: -1.8, fx: 0.5, fy: 0, radius: 2, stop: 0 %1, stop: 1 %2);
    pal.setBrush( backgroundRole(), TomahawkStyle::PAGE_BACKGROUND );
    area->setPalette( pal );
    area->setAutoFillBackground( true );
    area->setFrameShape( QFrame::NoFrame );
    area->setAttribute( Qt::WA_MacShowFocusRect, 0 );

    QVBoxLayout* layout = new QVBoxLayout();
    layout->addWidget( m_header );
    layout->addWidget( area );
    setLayout( layout );
    TomahawkUtils::unmarginLayout( layout );

    TomahawkStyle::styleScrollBar( ui->playlistWidget->verticalScrollBar() );
    TomahawkStyle::styleScrollBar( ui->additionsView->verticalScrollBar() );

    QFont f;
    f.setBold( true );
    QFontMetrics fm( f );
    ui->tracksView->setMinimumWidth( fm.width( tr( "Recently played tracks" ) ) * 2 );

    QPalette p = ui->label->palette();
    p.setColor( QPalette::Foreground, TomahawkStyle::PAGE_FOREGROUND );
    p.setColor( QPalette::Text, TomahawkStyle::PAGE_TEXT );

    ui->label->setPalette( p );
    ui->label_2->setPalette( p );
    ui->label_3->setPalette( p );

    ui->playlistWidget->setStyleSheet( "QListView { background-color: transparent; }" );
    TomahawkStyle::stylePageFrame( ui->playlistFrame );

    ui->additionsView->setStyleSheet( "QListView { background-color: transparent; }" );
    TomahawkStyle::stylePageFrame( ui->additionsFrame );

    ui->tracksView->setStyleSheet( "QTreeView { background-color: transparent; }" );
    TomahawkStyle::stylePageFrame( ui->trackFrame );

    MetaPlaylistInterface* mpl = new MetaPlaylistInterface();
    mpl->addChildInterface( ui->tracksView->playlistInterface() );
    mpl->addChildInterface( ui->additionsView->playlistInterface() );
    m_playlistInterface = playlistinterface_ptr( mpl );

    connect( SourceList::instance(), SIGNAL( ready() ), SLOT( onSourcesReady() ) );
    connect( SourceList::instance(), SIGNAL( sourceAdded( Tomahawk::source_ptr ) ), SLOT( onSourceAdded( Tomahawk::source_ptr ) ) );
    connect( ui->playlistWidget, SIGNAL( activated( QModelIndex ) ), SLOT( onPlaylistActivated( QModelIndex ) ) );
    connect( model, SIGNAL( emptinessChanged( bool ) ), this, SLOT( updatePlaylists() ) );
}
Example #25
0
SetupDialog::SetupDialog( ConfigTabs _tab_to_open ) :
	m_bufferSize( ConfigManager::inst()->value( "mixer",
					"framesperaudiobuffer" ).toInt() ),
	m_toolTips( !ConfigManager::inst()->value( "tooltips",
							"disabled" ).toInt() ),
	m_warnAfterSetup( !ConfigManager::inst()->value( "app",
						"nomsgaftersetup" ).toInt() ),
	m_displaydBV( ConfigManager::inst()->value( "app", 
		      				"displaydbv" ).toInt() ),
	m_MMPZ( !ConfigManager::inst()->value( "app", "nommpz" ).toInt() ),
	m_disableBackup( !ConfigManager::inst()->value( "app",
							"disablebackup" ).toInt() ),
	m_hqAudioDev( ConfigManager::inst()->value( "mixer",
							"hqaudio" ).toInt() ),
	m_lang( ConfigManager::inst()->value( "app",
							"language" ) ),
	m_workingDir( QDir::toNativeSeparators( ConfigManager::inst()->workingDir() ) ),
	m_vstDir( QDir::toNativeSeparators( ConfigManager::inst()->vstDir() ) ),
	m_artworkDir( QDir::toNativeSeparators( ConfigManager::inst()->artworkDir() ) ),
	m_flDir( QDir::toNativeSeparators( ConfigManager::inst()->flDir() ) ),
	m_ladDir( QDir::toNativeSeparators( ConfigManager::inst()->ladspaDir() ) ),
	m_gigDir( QDir::toNativeSeparators( ConfigManager::inst()->gigDir() ) ),
	m_sf2Dir( QDir::toNativeSeparators( ConfigManager::inst()->sf2Dir() ) ),
#ifdef LMMS_HAVE_FLUIDSYNTH
	m_defaultSoundfont( QDir::toNativeSeparators( ConfigManager::inst()->defaultSoundfont() ) ),
#endif
#ifdef LMMS_HAVE_STK
	m_stkDir( QDir::toNativeSeparators( ConfigManager::inst()->stkDir() ) ),
#endif
	m_backgroundArtwork( QDir::toNativeSeparators( ConfigManager::inst()->backgroundArtwork() ) ),
	m_smoothScroll( ConfigManager::inst()->value( "ui", "smoothscroll" ).toInt() ),
	m_enableAutoSave( ConfigManager::inst()->value( "ui", "enableautosave" ).toInt() ),
	m_oneInstrumentTrackWindow( ConfigManager::inst()->value( "ui",
					"oneinstrumenttrackwindow" ).toInt() ),
	m_compactTrackButtons( ConfigManager::inst()->value( "ui",
					"compacttrackbuttons" ).toInt() ),
	m_syncVSTPlugins( ConfigManager::inst()->value( "ui",
							"syncvstplugins" ).toInt() ),
	m_animateAFP(ConfigManager::inst()->value( "ui",
						   "animateafp").toInt() ),
	m_printNoteLabels(ConfigManager::inst()->value( "ui",
						   "printnotelabels").toInt() ),
	m_displayWaveform(ConfigManager::inst()->value( "ui",
						   "displaywaveform").toInt() ),
	m_disableAutoQuit(ConfigManager::inst()->value( "ui",
						   "disableautoquit").toInt() )
{
	setWindowIcon( embed::getIconPixmap( "setup_general" ) );
	setWindowTitle( tr( "Setup LMMS" ) );
	setModal( true );

	Engine::projectJournal()->setJournalling( false );

	QVBoxLayout * vlayout = new QVBoxLayout( this );
	vlayout->setSpacing( 0 );
	vlayout->setMargin( 0 );
	QWidget * settings = new QWidget( this );
	QHBoxLayout * hlayout = new QHBoxLayout( settings );
	hlayout->setSpacing( 0 );
	hlayout->setMargin( 0 );

	m_tabBar = new TabBar( settings, QBoxLayout::TopToBottom );
	m_tabBar->setExclusive( true );
	m_tabBar->setFixedWidth( 72 );

	QWidget * ws = new QWidget( settings );
	int wsHeight = 370;
#ifdef LMMS_HAVE_STK
	wsHeight += 50;
#endif
#ifdef LMMS_HAVE_FLUIDSYNTH
	wsHeight += 50;
#endif
	ws->setFixedSize( 360, wsHeight );
	QWidget * general = new QWidget( ws );
	general->setFixedSize( 360, 240 );
	QVBoxLayout * gen_layout = new QVBoxLayout( general );
	gen_layout->setSpacing( 0 );
	gen_layout->setMargin( 0 );
	labelWidget( general, tr( "General settings" ) );

	TabWidget * bufsize_tw = new TabWidget( tr( "BUFFER SIZE" ), general );
	bufsize_tw->setFixedHeight( 80 );

	m_bufSizeSlider = new QSlider( Qt::Horizontal, bufsize_tw );
	m_bufSizeSlider->setRange( 1, 256 );
	m_bufSizeSlider->setTickPosition( QSlider::TicksBelow );
	m_bufSizeSlider->setPageStep( 8 );
	m_bufSizeSlider->setTickInterval( 8 );
	m_bufSizeSlider->setGeometry( 10, 16, 340, 18 );
	m_bufSizeSlider->setValue( m_bufferSize / 64 );

	connect( m_bufSizeSlider, SIGNAL( valueChanged( int ) ), this,
						SLOT( setBufferSize( int ) ) );

	m_bufSizeLbl = new QLabel( bufsize_tw );
	m_bufSizeLbl->setGeometry( 10, 40, 200, 24 );
	setBufferSize( m_bufSizeSlider->value() );

	QPushButton * bufsize_reset_btn = new QPushButton(
			embed::getIconPixmap( "reload" ), "", bufsize_tw );
	bufsize_reset_btn->setGeometry( 290, 40, 28, 28 );
	connect( bufsize_reset_btn, SIGNAL( clicked() ), this,
						SLOT( resetBufSize() ) );
	ToolTip::add( bufsize_reset_btn, tr( "Reset to default-value" ) );

	QPushButton * bufsize_help_btn = new QPushButton(
			embed::getIconPixmap( "help" ), "", bufsize_tw );
	bufsize_help_btn->setGeometry( 320, 40, 28, 28 );
	connect( bufsize_help_btn, SIGNAL( clicked() ), this,
						SLOT( displayBufSizeHelp() ) );


	TabWidget * misc_tw = new TabWidget( tr( "MISC" ), general );
	const int XDelta = 10;
	const int YDelta = 18;
	const int HeaderSize = 30;
	int labelNumber = 0;


	LedCheckBox * enable_tooltips = new LedCheckBox(
							tr( "Enable tooltips" ),
								misc_tw );
	labelNumber++;
	enable_tooltips->move( XDelta, YDelta*labelNumber );
	enable_tooltips->setChecked( m_toolTips );
	connect( enable_tooltips, SIGNAL( toggled( bool ) ),
					this, SLOT( toggleToolTips( bool ) ) );


	LedCheckBox * restart_msg = new LedCheckBox(
			tr( "Show restart warning after changing settings" ),
								misc_tw );
	labelNumber++;
	restart_msg->move( XDelta, YDelta*labelNumber );
	restart_msg->setChecked( m_warnAfterSetup );
	connect( restart_msg, SIGNAL( toggled( bool ) ),
				this, SLOT( toggleWarnAfterSetup( bool ) ) );


	LedCheckBox * dbv = new LedCheckBox( tr( "Display volume as dBV " ),
								misc_tw );
	labelNumber++;
	dbv->move( XDelta, YDelta*labelNumber );
	dbv->setChecked( m_displaydBV );
	connect( dbv, SIGNAL( toggled( bool ) ),
				this, SLOT( toggleDisplaydBV( bool ) ) );


	LedCheckBox * mmpz = new LedCheckBox(
				tr( "Compress project files per default" ),
								misc_tw );
	labelNumber++;
	mmpz->move( XDelta, YDelta*labelNumber );
	mmpz->setChecked( m_MMPZ );
	connect( mmpz, SIGNAL( toggled( bool ) ),
					this, SLOT( toggleMMPZ( bool ) ) );

	LedCheckBox * oneitw = new LedCheckBox(
				tr( "One instrument track window mode" ),
								misc_tw );
	labelNumber++;
	oneitw->move( XDelta, YDelta*labelNumber );
	oneitw->setChecked( m_oneInstrumentTrackWindow );
	connect( oneitw, SIGNAL( toggled( bool ) ),
				this, SLOT( toggleOneInstrumentTrackWindow( bool ) ) );

	LedCheckBox * hqaudio = new LedCheckBox(
				tr( "HQ-mode for output audio-device" ),
								misc_tw );
	labelNumber++;
	hqaudio->move( XDelta, YDelta*labelNumber );
	hqaudio->setChecked( m_hqAudioDev );
	connect( hqaudio, SIGNAL( toggled( bool ) ),
				this, SLOT( toggleHQAudioDev( bool ) ) );

	LedCheckBox * compacttracks = new LedCheckBox(
				tr( "Compact track buttons" ),
								misc_tw );
	labelNumber++;
	compacttracks->move( XDelta, YDelta*labelNumber );
	compacttracks->setChecked( m_compactTrackButtons );
	connect( compacttracks, SIGNAL( toggled( bool ) ),
				this, SLOT( toggleCompactTrackButtons( bool ) ) );


	LedCheckBox * syncVST = new LedCheckBox(
				tr( "Sync VST plugins to host playback" ),
								misc_tw );
	labelNumber++;
	syncVST->move( XDelta, YDelta*labelNumber );
	syncVST->setChecked( m_syncVSTPlugins );
	connect( syncVST, SIGNAL( toggled( bool ) ),
				this, SLOT( toggleSyncVSTPlugins( bool ) ) );

	LedCheckBox * noteLabels = new LedCheckBox(
				tr( "Enable note labels in piano roll" ),
								misc_tw );
	labelNumber++;
	noteLabels->move( XDelta, YDelta*labelNumber );
	noteLabels->setChecked( m_printNoteLabels );
	connect( noteLabels, SIGNAL( toggled( bool ) ),
				this, SLOT( toggleNoteLabels( bool ) ) );

	LedCheckBox * displayWaveform = new LedCheckBox(
				tr( "Enable waveform display by default" ),
								misc_tw );
	labelNumber++;
	displayWaveform->move( XDelta, YDelta*labelNumber );
	displayWaveform->setChecked( m_displayWaveform );
	connect( displayWaveform, SIGNAL( toggled( bool ) ),
				this, SLOT( toggleDisplayWaveform( bool ) ) );

	LedCheckBox * disableAutoquit = new LedCheckBox(
				tr( "Keep effects running even without input" ),
								misc_tw );
	labelNumber++;
	disableAutoquit->move( XDelta, YDelta*labelNumber );
	disableAutoquit->setChecked( m_disableAutoQuit );
	connect( disableAutoquit, SIGNAL( toggled( bool ) ),
				this, SLOT( toggleDisableAutoquit( bool ) ) );

	LedCheckBox * disableBackup = new LedCheckBox(
				tr( "Create backup file when saving a project" ),
								misc_tw );
	labelNumber++;
	disableBackup->move( XDelta, YDelta*labelNumber );
	disableBackup->setChecked( m_disableBackup );
	connect( disableBackup, SIGNAL( toggled( bool ) ),
				this, SLOT( toggleDisableBackup( bool ) ) );

	misc_tw->setFixedHeight( YDelta*labelNumber + HeaderSize );

	TabWidget * lang_tw = new TabWidget( tr( "LANGUAGE" ), general );
	lang_tw->setFixedHeight( 48 );
	QComboBox * changeLang = new QComboBox( lang_tw );
	changeLang->move( XDelta, YDelta );

	QDir dir( ConfigManager::inst()->localeDir() );
	QStringList fileNames = dir.entryList( QStringList( "*.qm" ) );
	for( int i = 0; i < fileNames.size(); ++i )
	{
		// get locale extracted by filename
		fileNames[i].truncate( fileNames[i].lastIndexOf( '.' ) );
		m_languages.append( fileNames[i] );
		QString lang = QLocale( m_languages.last() ).nativeLanguageName();
		changeLang->addItem( lang );
	}
	connect( changeLang, SIGNAL( currentIndexChanged( int ) ),
							this, SLOT( setLanguage( int ) ) );

	//If language unset, fallback to system language when available
	if( m_lang == "" )
	{
		QString tmp = QLocale::system().name().left( 2 );
		if( m_languages.contains( tmp ) )
		{
			m_lang = tmp;
		}
		else
		{
			m_lang = "en";
		}
	}

	for( int i = 0; i < changeLang->count(); ++i )
	{
		if( m_lang == m_languages.at( i ) )
		{
			changeLang->setCurrentIndex( i );
			break;
		}
	}

	gen_layout->addWidget( bufsize_tw );
	gen_layout->addSpacing( 10 );
	gen_layout->addWidget( misc_tw );
	gen_layout->addSpacing( 10 );
	gen_layout->addWidget( lang_tw );
	gen_layout->addStretch();



	QWidget * paths = new QWidget( ws );
	int pathsHeight = 370;
#ifdef LMMS_HAVE_STK
	pathsHeight += 55;
#endif
#ifdef LMMS_HAVE_FLUIDSYNTH
	pathsHeight += 55;
#endif
	paths->setFixedSize( 360, pathsHeight );
	QVBoxLayout * dir_layout = new QVBoxLayout( paths );
	dir_layout->setSpacing( 0 );
	dir_layout->setMargin( 0 );
	labelWidget( paths, tr( "Paths" ) );
	QLabel * title = new QLabel( tr( "Directories" ), paths );
	QFont f = title->font();
	f.setBold( true );
	title->setFont( pointSize<12>( f ) );


	QScrollArea *pathScroll = new QScrollArea( paths );

	QWidget *pathSelectors = new QWidget( ws );
	QVBoxLayout *pathSelectorLayout = new QVBoxLayout;
	pathScroll->setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOn );
	pathScroll->setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
	pathScroll->resize( 362, pathsHeight - 50  );
	pathScroll->move( 0, 30 );
	pathSelectors->resize( 360, pathsHeight - 50 );

	const int txtLength = 285;
	const int btnStart = 305;


	// working-dir
	TabWidget * lmms_wd_tw = new TabWidget( tr(
					"LMMS working directory" ).toUpper(),
								pathSelectors );
	lmms_wd_tw->setFixedHeight( 48 );

	m_wdLineEdit = new QLineEdit( m_workingDir, lmms_wd_tw );
	m_wdLineEdit->setGeometry( 10, 20, txtLength, 16 );
	connect( m_wdLineEdit, SIGNAL( textChanged( const QString & ) ), this,
				SLOT( setWorkingDir( const QString & ) ) );

	QPushButton * workingdir_select_btn = new QPushButton(
				embed::getIconPixmap( "project_open", 16, 16 ),
							"", lmms_wd_tw );
	workingdir_select_btn->setFixedSize( 24, 24 );
	workingdir_select_btn->move( btnStart, 16 );
	connect( workingdir_select_btn, SIGNAL( clicked() ), this,
						SLOT( openWorkingDir() ) );


	// artwork-dir
	TabWidget * artwork_tw = new TabWidget( tr(
					"Themes directory" ).toUpper(),
								pathSelectors );
	artwork_tw->setFixedHeight( 48 );

	m_adLineEdit = new QLineEdit( m_artworkDir, artwork_tw );
	m_adLineEdit->setGeometry( 10, 20, txtLength, 16 );
	connect( m_adLineEdit, SIGNAL( textChanged( const QString & ) ), this,
				SLOT( setArtworkDir( const QString & ) ) );

	QPushButton * artworkdir_select_btn = new QPushButton(
				embed::getIconPixmap( "project_open", 16, 16 ),
							"", artwork_tw );
	artworkdir_select_btn->setFixedSize( 24, 24 );
	artworkdir_select_btn->move( btnStart, 16 );
	connect( artworkdir_select_btn, SIGNAL( clicked() ), this,
						SLOT( openArtworkDir() ) );



	// background artwork file
	TabWidget * backgroundArtwork_tw = new TabWidget( tr(
			"Background artwork" ).toUpper(), paths );
	backgroundArtwork_tw->setFixedHeight( 48 );

	m_baLineEdit = new QLineEdit( m_backgroundArtwork, 
			backgroundArtwork_tw );
	m_baLineEdit->setGeometry( 10, 20, txtLength, 16 );
	connect( m_baLineEdit, SIGNAL( textChanged( const QString & ) ), this,
			SLOT( setBackgroundArtwork( const QString & ) ) );

	QPushButton * backgroundartworkdir_select_btn = new QPushButton(
			embed::getIconPixmap( "project_open", 16, 16 ),
			"", backgroundArtwork_tw );
	backgroundartworkdir_select_btn->setFixedSize( 24, 24 );
	backgroundartworkdir_select_btn->move( btnStart, 16 );
	connect( backgroundartworkdir_select_btn, SIGNAL( clicked() ), this,
					SLOT( openBackgroundArtwork() ) );





	// FL Studio-dir
	TabWidget * fl_tw = new TabWidget( tr(
				"FL Studio installation directory" ).toUpper(),
								paths );
	fl_tw->setFixedHeight( 48 );

	m_fdLineEdit = new QLineEdit( m_flDir, fl_tw );
	m_fdLineEdit->setGeometry( 10, 20, txtLength, 16 );
	connect( m_fdLineEdit, SIGNAL( textChanged( const QString & ) ), this,
					SLOT( setFLDir( const QString & ) ) );

	QPushButton * fldir_select_btn = new QPushButton(
				embed::getIconPixmap( "project_open", 16, 16 ),
								"", fl_tw );
	fldir_select_btn->setFixedSize( 24, 24 );
	fldir_select_btn->move( btnStart, 16 );
	connect( fldir_select_btn, SIGNAL( clicked() ), this,
						SLOT( openFLDir() ) );

	// vst-dir
	TabWidget * vst_tw = new TabWidget( tr(
					"VST-plugin directory" ).toUpper(),
								pathSelectors );
	vst_tw->setFixedHeight( 48 );

	m_vdLineEdit = new QLineEdit( m_vstDir, vst_tw );
	m_vdLineEdit->setGeometry( 10, 20, txtLength, 16 );
	connect( m_vdLineEdit, SIGNAL( textChanged( const QString & ) ), this,
					SLOT( setVSTDir( const QString & ) ) );

	QPushButton * vstdir_select_btn = new QPushButton(
				embed::getIconPixmap( "project_open", 16, 16 ),
								"", vst_tw );
	vstdir_select_btn->setFixedSize( 24, 24 );
	vstdir_select_btn->move( btnStart, 16 );
	connect( vstdir_select_btn, SIGNAL( clicked() ), this,
						SLOT( openVSTDir() ) );

	// gig-dir
	TabWidget * gig_tw = new TabWidget( tr(
					"GIG directory" ).toUpper(),
								pathSelectors );
	gig_tw->setFixedHeight( 48 );

	m_gigLineEdit = new QLineEdit( m_gigDir, gig_tw );
	m_gigLineEdit->setGeometry( 10, 20, txtLength, 16 );
	connect( m_gigLineEdit, SIGNAL( textChanged( const QString & ) ), this,
					SLOT( setGIGDir( const QString & ) ) );

	QPushButton * gigdir_select_btn = new QPushButton(
				embed::getIconPixmap( "project_open", 16, 16 ),
								"", gig_tw );
	gigdir_select_btn->setFixedSize( 24, 24 );
	gigdir_select_btn->move( btnStart, 16 );
	connect( gigdir_select_btn, SIGNAL( clicked() ), this,
						SLOT( openGIGDir() ) );

	// sf2-dir
	TabWidget * sf2_tw = new TabWidget( tr(
					"SF2 directory" ).toUpper(),
								pathSelectors );
	sf2_tw->setFixedHeight( 48 );

	m_sf2LineEdit = new QLineEdit( m_sf2Dir, sf2_tw );
	m_sf2LineEdit->setGeometry( 10, 20, txtLength, 16 );
	connect( m_sf2LineEdit, SIGNAL( textChanged( const QString & ) ), this,
					SLOT( setSF2Dir( const QString & ) ) );

	QPushButton * sf2dir_select_btn = new QPushButton(
				embed::getIconPixmap( "project_open", 16, 16 ),
								"", sf2_tw );
	sf2dir_select_btn->setFixedSize( 24, 24 );
	sf2dir_select_btn->move( btnStart, 16 );
	connect( sf2dir_select_btn, SIGNAL( clicked() ), this,
						SLOT( openSF2Dir() ) );



	// LADSPA-dir
	TabWidget * lad_tw = new TabWidget( tr(
			"LADSPA plugin directories" ).toUpper(),
							paths );
	lad_tw->setFixedHeight( 48 );

	m_ladLineEdit = new QLineEdit( m_ladDir, lad_tw );
	m_ladLineEdit->setGeometry( 10, 20, txtLength, 16 );
	connect( m_ladLineEdit, SIGNAL( textChanged( const QString & ) ), this,
		 		SLOT( setLADSPADir( const QString & ) ) );

	QPushButton * laddir_select_btn = new QPushButton(
				embed::getIconPixmap( "add_folder", 16, 16 ),
								"", lad_tw );
	laddir_select_btn->setFixedSize( 24, 24 );
	laddir_select_btn->move( btnStart, 16 );
	connect( laddir_select_btn, SIGNAL( clicked() ), this,
				 		SLOT( openLADSPADir() ) );


#ifdef LMMS_HAVE_STK
	// STK-dir
	TabWidget * stk_tw = new TabWidget( tr(
			"STK rawwave directory" ).toUpper(),
							paths );
	stk_tw->setFixedHeight( 48 );

	m_stkLineEdit = new QLineEdit( m_stkDir, stk_tw );
	m_stkLineEdit->setGeometry( 10, 20, txtLength, 16 );
	connect( m_stkLineEdit, SIGNAL( textChanged( const QString & ) ), this,
		 SLOT( setSTKDir( const QString & ) ) );

	QPushButton * stkdir_select_btn = new QPushButton(
			embed::getIconPixmap( "project_open", 16, 16 ),
								"", stk_tw );
	stkdir_select_btn->setFixedSize( 24, 24 );
	stkdir_select_btn->move( btnStart, 16 );
	connect( stkdir_select_btn, SIGNAL( clicked() ), this,
		 SLOT( openSTKDir() ) );
#endif

#ifdef LMMS_HAVE_FLUIDSYNTH
	// Soundfont
	TabWidget * sf_tw = new TabWidget( tr(
			"Default Soundfont File" ).toUpper(), paths );
	sf_tw->setFixedHeight( 48 );

	m_sfLineEdit = new QLineEdit( m_defaultSoundfont, sf_tw );
	m_sfLineEdit->setGeometry( 10, 20, txtLength, 16 );
	connect( m_sfLineEdit, SIGNAL( textChanged( const QString & ) ), this,
		 		SLOT( setDefaultSoundfont( const QString & ) ) );

	QPushButton * sf_select_btn = new QPushButton(
				embed::getIconPixmap( "project_open", 16, 16 ),
								"", sf_tw );
	sf_select_btn->setFixedSize( 24, 24 );
	sf_select_btn->move( btnStart, 16 );
	connect( sf_select_btn, SIGNAL( clicked() ), this,
				 		SLOT( openDefaultSoundfont() ) );
#endif	

	pathSelectors->setLayout( pathSelectorLayout );

	pathSelectorLayout->addWidget( lmms_wd_tw );
	pathSelectorLayout->addSpacing( 10 );
	pathSelectorLayout->addWidget( gig_tw );
	pathSelectorLayout->addSpacing( 10 );
	pathSelectorLayout->addWidget( sf2_tw );
	pathSelectorLayout->addSpacing( 10 );
	pathSelectorLayout->addWidget( vst_tw );
	pathSelectorLayout->addSpacing( 10 );
	pathSelectorLayout->addWidget( lad_tw );
#ifdef LMMS_HAVE_STK
	pathSelectorLayout->addSpacing( 10 );
	pathSelectorLayout->addWidget( stk_tw );
#endif	
#ifdef LMMS_HAVE_FLUIDSYNTH
	pathSelectorLayout->addSpacing( 10 );
	pathSelectorLayout->addWidget( sf_tw );
#endif	
	pathSelectorLayout->addWidget( fl_tw );
	pathSelectorLayout->addSpacing( 10 );
	pathSelectorLayout->addWidget( artwork_tw );
	pathSelectorLayout->addSpacing( 10 );
	pathSelectorLayout->addStretch();
	pathSelectorLayout->addWidget( backgroundArtwork_tw );
	pathSelectorLayout->addSpacing( 10 );

	dir_layout->addWidget( pathSelectors );

	pathScroll->setWidget( pathSelectors );
	pathScroll->setWidgetResizable( true );



	QWidget * performance = new QWidget( ws );
	performance->setFixedSize( 360, 240 );
	QVBoxLayout * perf_layout = new QVBoxLayout( performance );
	perf_layout->setSpacing( 0 );
	perf_layout->setMargin( 0 );
	labelWidget( performance, tr( "Performance settings" ) );

	TabWidget * ui_fx_tw = new TabWidget( tr( "UI effects vs. "
						"performance" ).toUpper(),
								performance );
	ui_fx_tw->setFixedHeight( 80 );

	LedCheckBox * smoothScroll = new LedCheckBox(
			tr( "Smooth scroll in Song Editor" ), ui_fx_tw );
	smoothScroll->move( 10, 20 );
	smoothScroll->setChecked( m_smoothScroll );
	connect( smoothScroll, SIGNAL( toggled( bool ) ),
				this, SLOT( toggleSmoothScroll( bool ) ) );


	LedCheckBox * autoSave = new LedCheckBox(
			tr( "Enable auto save feature" ), ui_fx_tw );
	autoSave->move( 10, 40 );
	autoSave->setChecked( m_enableAutoSave );
	connect( autoSave, SIGNAL( toggled( bool ) ),
				this, SLOT( toggleAutoSave( bool ) ) );


	LedCheckBox * animAFP = new LedCheckBox(
				tr( "Show playback cursor in AudioFileProcessor" ),
								ui_fx_tw );
	animAFP->move( 10, 60 );
	animAFP->setChecked( m_animateAFP );
	connect( animAFP, SIGNAL( toggled( bool ) ),
				this, SLOT( toggleAnimateAFP( bool ) ) );



	perf_layout->addWidget( ui_fx_tw );
	perf_layout->addStretch();



	QWidget * audio = new QWidget( ws );
	audio->setFixedSize( 360, 200 );
	QVBoxLayout * audio_layout = new QVBoxLayout( audio );
	audio_layout->setSpacing( 0 );
	audio_layout->setMargin( 0 );
	labelWidget( audio, tr( "Audio settings" ) );

	TabWidget * audioiface_tw = new TabWidget( tr( "AUDIO INTERFACE" ),
									audio );
	audioiface_tw->setFixedHeight( 60 );

	m_audioInterfaces = new QComboBox( audioiface_tw );
	m_audioInterfaces->setGeometry( 10, 20, 240, 22 );


	QPushButton * audio_help_btn = new QPushButton(
			embed::getIconPixmap( "help" ), "", audioiface_tw );
	audio_help_btn->setGeometry( 320, 20, 28, 28 );
	connect( audio_help_btn, SIGNAL( clicked() ), this,
						SLOT( displayAudioHelp() ) );


	// create ifaces-settings-widget
	QWidget * asw = new QWidget( audio );
	asw->setFixedHeight( 60 );

	QHBoxLayout * asw_layout = new QHBoxLayout( asw );
	asw_layout->setSpacing( 0 );
	asw_layout->setMargin( 0 );
	//asw_layout->setAutoAdd( true );

#ifdef LMMS_HAVE_JACK
	m_audioIfaceSetupWidgets[AudioJack::name()] =
					new AudioJack::setupWidget( asw );
#endif

#ifdef LMMS_HAVE_ALSA
	m_audioIfaceSetupWidgets[AudioAlsa::name()] =
					new AudioAlsaSetupWidget( asw );
#endif

#ifdef LMMS_HAVE_PULSEAUDIO
	m_audioIfaceSetupWidgets[AudioPulseAudio::name()] =
					new AudioPulseAudio::setupWidget( asw );
#endif

#ifdef LMMS_HAVE_PORTAUDIO
	m_audioIfaceSetupWidgets[AudioPortAudio::name()] =
					new AudioPortAudio::setupWidget( asw );
#endif

#ifdef LMMS_HAVE_SDL
	m_audioIfaceSetupWidgets[AudioSdl::name()] =
					new AudioSdl::setupWidget( asw );
#endif

#ifdef LMMS_HAVE_OSS
	m_audioIfaceSetupWidgets[AudioOss::name()] =
					new AudioOss::setupWidget( asw );
#endif
	m_audioIfaceSetupWidgets[AudioDummy::name()] =
					new AudioDummy::setupWidget( asw );


	for( AswMap::iterator it = m_audioIfaceSetupWidgets.begin();
				it != m_audioIfaceSetupWidgets.end(); ++it )
	{
		m_audioIfaceNames[tr( it.key().toLatin1())] = it.key();
	}
	for( trMap::iterator it = m_audioIfaceNames.begin();
				it != m_audioIfaceNames.end(); ++it )
	{
		QWidget * audioWidget = m_audioIfaceSetupWidgets[it.value()];
		audioWidget->hide();
		asw_layout->addWidget( audioWidget );
		m_audioInterfaces->addItem( it.key() );
	}

	QString audioDevName = 
		ConfigManager::inst()->value( "mixer", "audiodev" );
	if( audioDevName.length() == 0 )
	{
		audioDevName = Engine::mixer()->audioDevName();
		ConfigManager::inst()->setValue(
					"mixer", "audiodev", audioDevName );
	}
	m_audioInterfaces->
		setCurrentIndex( m_audioInterfaces->findText( audioDevName ) );
	m_audioIfaceSetupWidgets[audioDevName]->show();

	connect( m_audioInterfaces, SIGNAL( activated( const QString & ) ),
		this, SLOT( audioInterfaceChanged( const QString & ) ) );


	audio_layout->addWidget( audioiface_tw );
	audio_layout->addSpacing( 20 );
	audio_layout->addWidget( asw );
	audio_layout->addStretch();




	QWidget * midi = new QWidget( ws );
	QVBoxLayout * midi_layout = new QVBoxLayout( midi );
	midi_layout->setSpacing( 0 );
	midi_layout->setMargin( 0 );
	labelWidget( midi, tr( "MIDI settings" ) );

	TabWidget * midiiface_tw = new TabWidget( tr( "MIDI INTERFACE" ),
									midi );
	midiiface_tw->setFixedHeight( 60 );

	m_midiInterfaces = new QComboBox( midiiface_tw );
	m_midiInterfaces->setGeometry( 10, 20, 240, 22 );


	QPushButton * midi_help_btn = new QPushButton(
			embed::getIconPixmap( "help" ), "", midiiface_tw );
	midi_help_btn->setGeometry( 320, 20, 28, 28 );
	connect( midi_help_btn, SIGNAL( clicked() ), this,
						SLOT( displayMIDIHelp() ) );


	// create ifaces-settings-widget
	QWidget * msw = new QWidget( midi );
	msw->setFixedHeight( 60 );

	QHBoxLayout * msw_layout = new QHBoxLayout( msw );
	msw_layout->setSpacing( 0 );
	msw_layout->setMargin( 0 );
	//msw_layout->setAutoAdd( true );

#ifdef LMMS_HAVE_ALSA
	m_midiIfaceSetupWidgets[MidiAlsaSeq::name()] =
					MidiSetupWidget::create<MidiAlsaSeq>( msw );
	m_midiIfaceSetupWidgets[MidiAlsaRaw::name()] =
					MidiSetupWidget::create<MidiAlsaRaw>( msw );
#endif

#ifdef LMMS_HAVE_OSS
	m_midiIfaceSetupWidgets[MidiOss::name()] =
					MidiSetupWidget::create<MidiOss>( msw );
#endif

#ifdef LMMS_BUILD_WIN32
	m_midiIfaceSetupWidgets[MidiWinMM::name()] =
					MidiSetupWidget::create<MidiWinMM>( msw );
#endif

#ifdef LMMS_BUILD_APPLE
    m_midiIfaceSetupWidgets[MidiApple::name()] =
                    MidiSetupWidget::create<MidiApple>( msw );
#endif

	m_midiIfaceSetupWidgets[MidiDummy::name()] =
					MidiSetupWidget::create<MidiDummy>( msw );


	for( MswMap::iterator it = m_midiIfaceSetupWidgets.begin();
				it != m_midiIfaceSetupWidgets.end(); ++it )
	{
		m_midiIfaceNames[tr( it.key().toLatin1())] = it.key();
	}
	for( trMap::iterator it = m_midiIfaceNames.begin();
				it != m_midiIfaceNames.end(); ++it )
	{
		QWidget * midiWidget = m_midiIfaceSetupWidgets[it.value()];
		midiWidget->hide();
		msw_layout->addWidget( midiWidget );
		m_midiInterfaces->addItem( it.key() );
	}

	QString midiDevName = 
		ConfigManager::inst()->value( "mixer", "mididev" );
	if( midiDevName.length() == 0 )
	{
		midiDevName = Engine::mixer()->midiClientName();
		ConfigManager::inst()->setValue(
					"mixer", "mididev", midiDevName );
	}
	m_midiInterfaces->setCurrentIndex( 
		m_midiInterfaces->findText( midiDevName ) );
	m_midiIfaceSetupWidgets[midiDevName]->show();

	connect( m_midiInterfaces, SIGNAL( activated( const QString & ) ),
		this, SLOT( midiInterfaceChanged( const QString & ) ) );


	midi_layout->addWidget( midiiface_tw );
	midi_layout->addSpacing( 20 );
	midi_layout->addWidget( msw );
	midi_layout->addStretch();


	m_tabBar->addTab( general, tr( "General settings" ), 0, false, true 
			)->setIcon( embed::getIconPixmap( "setup_general" ) );
	m_tabBar->addTab( paths, tr( "Paths" ), 1, false, true 
			)->setIcon( embed::getIconPixmap(
							"setup_directories" ) );
	m_tabBar->addTab( performance, tr( "Performance settings" ), 2, false,
				true )->setIcon( embed::getIconPixmap(
							"setup_performance" ) );
	m_tabBar->addTab( audio, tr( "Audio settings" ), 3, false, true
			)->setIcon( embed::getIconPixmap( "setup_audio" ) );
	m_tabBar->addTab( midi, tr( "MIDI settings" ), 4, true, true
			)->setIcon( embed::getIconPixmap( "setup_midi" ) );


	m_tabBar->setActiveTab( _tab_to_open );

	hlayout->addWidget( m_tabBar );
	hlayout->addSpacing( 10 );
	hlayout->addWidget( ws );
	hlayout->addSpacing( 10 );
	hlayout->addStretch();

	QWidget * buttons = new QWidget( this );
	QHBoxLayout * btn_layout = new QHBoxLayout( buttons );
	btn_layout->setSpacing( 0 );
	btn_layout->setMargin( 0 );
	QPushButton * ok_btn = new QPushButton( embed::getIconPixmap( "apply" ),
						tr( "OK" ), buttons );
	connect( ok_btn, SIGNAL( clicked() ), this, SLOT( accept() ) );

	QPushButton * cancel_btn = new QPushButton( embed::getIconPixmap(
								"cancel" ),
							tr( "Cancel" ),
							buttons );
	connect( cancel_btn, SIGNAL( clicked() ), this, SLOT( reject() ) );

	btn_layout->addStretch();
	btn_layout->addSpacing( 10 );
	btn_layout->addWidget( ok_btn );
	btn_layout->addSpacing( 10 );
	btn_layout->addWidget( cancel_btn );
	btn_layout->addSpacing( 10 );

	vlayout->addWidget( settings );
	vlayout->addSpacing( 10 );
	vlayout->addWidget( buttons );
	vlayout->addSpacing( 10 );
	vlayout->addStretch();

	show();


}
int main(int argc, char **argv) {
    KAboutData about(QByteArray("ktechlab"), QByteArray("KTechLab Icon Tester"), ki18n("KTechLab Icon Tester"), VERSION, ki18n(description),
                KAboutData::License_GPL, ki18n("(C) 2003-2009, The KTechLab developers"),
                ki18n(""), "http://ktechlab.org", "*****@*****.**" );

    KCmdLineArgs::init(argc, argv, &about);
    KApplication testLoadedIconsApp;
    KMainWindow *mainWnd = new KMainWindow;
    QScrollArea *mainWidget = new QScrollArea;
    QWidget *tableWidget = new QWidget;
    mainWidget->setWidget(tableWidget);
    mainWidget->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
    mainWidget->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
    mainWidget->setWidgetResizable(true);
    QGridLayout *mainLayout = new QGridLayout;
    tableWidget->setLayout(mainLayout);
    mainWnd->setCentralWidget(mainWidget);

    const int iconCount = sizeof(iconNames)/sizeof(iconNames[0]);
    for (int iconNr = 0; iconNr < iconCount; ++iconNr) {
        addIcon(mainLayout, iconNames[iconNr]);
    }
    // TODO add assertion if all icons have been properly loaded
    /*
    addIcon(mainLayout, "asd");
    addIcon(mainLayout, "rotate_cw");
    addIcon(mainLayout, "rotate_ccw");
    addIcon(mainLayout, "text");
    addIcon(mainLayout, "rotate");
    addIcon(mainLayout, "player_play");
    addIcon(mainLayout, "player_pause");
    addIcon(mainLayout, "stop");
    addIcon(mainLayout, "reload");
    addIcon(mainLayout, "ktechlab_circuit");
    addIcon(mainLayout, "fork");
    addIcon(mainLayout, "convert_to_microbe");
    addIcon(mainLayout, "convert_to_assembly");
    addIcon(mainLayout, "convert_to_hex");
    addIcon(mainLayout, "convert_to_pic");
    addIcon(mainLayout, "down");
    addIcon(mainLayout, "button_cancel");
    addIcon(mainLayout, "folder");
    addIcon(mainLayout, "template-source");
    addIcon(mainLayout, "source_c");
    addIcon(mainLayout, "ktechlab_circuit");
    addIcon(mainLayout, "ktechlab_flowcode");
    addIcon(mainLayout, "exec");
    addIcon(mainLayout, "oscilloscope");
    */
    /*  {
        KIcon testIcon("foo");
        QPixmap testPixmap = testIcon.pixmap(64, 64);
        QLabel *ql = new QLabel;
        ql->setPixmap(testPixmap);
        ql->setIconText("label text");
        mainLayout->addWidget(ql, 1, 1);

        QLabel *qt = new QLabel;
        qt->setText("asd");
        mainLayout->addWidget(qt, 1, 2);
    } */

    mainWnd->show();
    return testLoadedIconsApp.exec();
}
Example #27
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 #28
0
void XmlSettingsDialog::ParseEntity (const QDomElement& entity, QWidget *baseWidget)
{
	QDomElement item = entity.firstChildElement ("item");
	while (!item.isNull ())
	{
		ParseItem (item, baseWidget);
		item = item.nextSiblingElement ("item");
	}

	QDomElement gbox = entity.firstChildElement ("groupbox");
	while (!gbox.isNull ())
	{
		QGroupBox *box = new QGroupBox (GetLabel (gbox));
		QGridLayout *groupLayout = new QGridLayout ();
		groupLayout->setContentsMargins (2, 2, 2, 2);
		box->setLayout (groupLayout);
		box->setSizePolicy (QSizePolicy::Expanding, QSizePolicy::Expanding);
		ParseEntity (gbox, box);

		QGridLayout *lay = qobject_cast<QGridLayout*> (baseWidget->layout ());
		lay->addWidget (box, lay->rowCount (), 0);

		gbox = gbox.nextSiblingElement ("groupbox");

		QSpacerItem *verticalSpacer = new QSpacerItem (10, 20, QSizePolicy::Minimum, QSizePolicy::Expanding);
		groupLayout->addItem (verticalSpacer, groupLayout->rowCount (), 0);
	}

	QDomElement scroll = entity.firstChildElement ("scrollarea");
	while (!scroll.isNull ())
	{
		QScrollArea *area = new QScrollArea ();
		if (scroll.hasAttribute ("horizontalScroll"))
		{
			QString attr = scroll.attribute ("horizontalScroll");
			if (attr == "on")
				area->setHorizontalScrollBarPolicy (Qt::ScrollBarAlwaysOn);
			else if (attr == "off")
				area->setHorizontalScrollBarPolicy (Qt::ScrollBarAlwaysOff);
		}
		if (scroll.hasAttribute ("verticalScroll"))
		{
			QString attr = scroll.attribute ("verticalScroll");
			if (attr == "on")
				area->setVerticalScrollBarPolicy (Qt::ScrollBarAlwaysOn);
			else if (attr == "off")
				area->setVerticalScrollBarPolicy (Qt::ScrollBarAlwaysOff);
		}

		QFrame *areaWidget = new QFrame;
		QGridLayout *areaLayout = new QGridLayout;
		areaWidget->setLayout (areaLayout);
		ParseEntity (scroll, areaWidget);
		area->setWidget (areaWidget);
		areaWidget->show ();

		QGridLayout *lay = qobject_cast<QGridLayout*> (baseWidget->layout ());
		lay->addWidget (area, lay->rowCount (), 0, 1, 2);

		scroll = scroll.nextSiblingElement ("scrollarea");
		QSpacerItem *verticalSpacer = new QSpacerItem (10, 20, QSizePolicy::Minimum, QSizePolicy::Expanding);
		lay->addItem (verticalSpacer, lay->rowCount (), 0, 1, 1);
	}

	QDomElement tab = entity.firstChildElement ("tab");
	if (!tab.isNull ())
	{
		QTabWidget *tabs = new QTabWidget;
		QGridLayout *lay = qobject_cast<QGridLayout*> (baseWidget->layout ());
		lay->addWidget (tabs, lay->rowCount (), 0, 1, 2);
		while (!tab.isNull ())
		{
			QWidget *page = new QWidget;
			QGridLayout *widgetLay = new QGridLayout;
			widgetLay->setContentsMargins (0, 0, 0, 0);
			page->setLayout (widgetLay);
			page->setSizePolicy (QSizePolicy::Expanding, QSizePolicy::Expanding);
			tabs->addTab (page, GetLabel (tab));
			ParseEntity (tab, page);
			tab = tab.nextSiblingElement ("tab");
			QSpacerItem *verticalSpacer = new QSpacerItem (10, 20, QSizePolicy::Minimum, QSizePolicy::Expanding);
			widgetLay->addItem (verticalSpacer, widgetLay->rowCount (), 0, 1, 1);
		}
	}
}
Example #29
0
AlbumInfoWidget::AlbumInfoWidget( const Tomahawk::album_ptr& album, QWidget* parent )
    : QWidget( parent )
    , ui( new Ui::AlbumInfoWidget )
{
    QWidget* widget = new QWidget;
    ui->setupUi( widget );

    m_pixmap = TomahawkUtils::defaultPixmap( TomahawkUtils::DefaultAlbumCover, TomahawkUtils::Original, QSize( 48, 48 ) );
    ui->cover->setPixmap( TomahawkUtils::defaultPixmap( TomahawkUtils::DefaultAlbumCover, TomahawkUtils::Grid, ui->cover->size() ) );
    ui->cover->setShowText( false );

    ui->lineAbove->setStyleSheet( QString( "QFrame { border: 1px solid %1; }" ).arg( TomahawkStyle::HEADER_BACKGROUND.name() ) );
    ui->lineBelow->setStyleSheet( QString( "QFrame { border: 1px solid black; }" ) );

    {
        m_tracksModel = new TreeModel( ui->tracks );
        m_tracksModel->setMode( Mixed );

        AlbumItemDelegate* del = new AlbumItemDelegate( ui->tracks, ui->tracks->proxyModel() );
        ui->tracks->setPlaylistItemDelegate( del );
        ui->tracks->setEmptyTip( tr( "Sorry, we could not find any tracks for this album!" ) );
        ui->tracks->proxyModel()->setStyle( PlayableProxyModel::Large );
        ui->tracks->setAutoResize( true );
        ui->tracks->setPlayableModel( m_tracksModel );
        ui->tracks->setAlternatingRowColors( false );

        QPalette p = ui->tracks->palette();
        p.setColor( QPalette::Text, TomahawkStyle::PAGE_TRACKLIST_TRACK_SOLVED );
        p.setColor( QPalette::BrightText, TomahawkStyle::PAGE_TRACKLIST_TRACK_UNRESOLVED );
        p.setColor( QPalette::Foreground, TomahawkStyle::PAGE_TRACKLIST_NUMBER );
        p.setColor( QPalette::Highlight, TomahawkStyle::PAGE_TRACKLIST_HIGHLIGHT );
        p.setColor( QPalette::HighlightedText, TomahawkStyle::PAGE_TRACKLIST_HIGHLIGHT_TEXT );

        ui->tracks->setPalette( p );

        TomahawkStyle::styleScrollBar( ui->tracks->horizontalScrollBar() );
        TomahawkStyle::stylePageFrame( ui->tracks );
        TomahawkStyle::stylePageFrame( ui->trackFrame );
    }

    {
        m_albumsModel = new PlayableModel( ui->albums );
        ui->albums->setPlayableModel( m_albumsModel );
        ui->albums->setEmptyTip( tr( "Sorry, we could not find any other albums for this artist!" ) );

        /*    ui->albums->setAutoFitItems( true );
         *    ui->albums->setWrapping( false );
         *    ui->albums->setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
         *    ui->albums->setHorizontalScrollBarPolicy( Qt::ScrollBarAsNeeded );*/
        ui->albums->delegate()->setItemSize( QSize( 170, 170 ) );
        ui->albums->proxyModel()->setHideDupeItems( true );

        TomahawkStyle::styleScrollBar( ui->albums->verticalScrollBar() );
        TomahawkStyle::stylePageFrame( ui->albums );
        TomahawkStyle::stylePageFrame( ui->albumFrame );
    }

    {
        QFont f = ui->biography->font();
        f.setFamily( "Titillium Web" );

        QPalette p = ui->biography->palette();
        p.setColor( QPalette::Text, TomahawkStyle::HEADER_TEXT );

        ui->biography->setFont( f );
        ui->biography->setPalette( p );
        ui->biography->setOpenLinks( false );
        ui->biography->setOpenExternalLinks( true );

        ui->biography->document()->setDefaultStyleSheet( QString( "a { text-decoration: none; font-weight: bold; color: %1; }" ).arg( TomahawkStyle::HEADER_LINK.name() ) );
        TomahawkStyle::stylePageFrame( ui->biography );
        TomahawkStyle::styleScrollBar( ui->biography->verticalScrollBar() );

//        connect( ui->biography, SIGNAL( anchorClicked( QUrl ) ), SLOT( onBiographyLinkClicked( QUrl ) ) );
    }

    {
        QFont f = ui->albumLabel->font();
        f.setFamily( "Titillium Web" );

        QPalette p = ui->albumLabel->palette();
        p.setColor( QPalette::Foreground, TomahawkStyle::HEADER_LABEL );

        ui->albumLabel->setFont( f );
        ui->albumLabel->setPalette( p );
    }

    {
        ui->artistLabel->setContentsMargins( 6, 2, 6, 2 );
        ui->artistLabel->setElideMode( Qt::ElideMiddle );
        ui->artistLabel->setType( QueryLabel::Artist );
        connect( ui->artistLabel, SIGNAL( clickedArtist() ), SLOT( onArtistClicked() ) );

        QFont f = ui->artistLabel->font();
        f.setFamily( "Titillium Web" );

        QPalette p = ui->artistLabel->palette();
        p.setColor( QPalette::Foreground, TomahawkStyle::HEADER_TEXT );

        ui->artistLabel->setFont( f );
        ui->artistLabel->setPalette( p );
    }

    {
        QFont f = ui->label->font();
        f.setFamily( "Pathway Gothic One" );

        QPalette p = ui->label->palette();
        p.setColor( QPalette::Foreground, TomahawkStyle::PAGE_CAPTION );

        ui->label->setFont( f );
        ui->label_2->setFont( f );
        ui->label->setPalette( p );
        ui->label_2->setPalette( p );
    }

    {
        QScrollArea* area = new QScrollArea();
        area->setWidgetResizable( true );
        area->setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOn );
        area->setWidget( widget );

        QPalette pal = palette();
        pal.setBrush( backgroundRole(), TomahawkStyle::HEADER_BACKGROUND );
        area->setPalette( pal );
        area->setAutoFillBackground( true );
        area->setFrameShape( QFrame::NoFrame );
        area->setAttribute( Qt::WA_MacShowFocusRect, 0 );

        QVBoxLayout* layout = new QVBoxLayout();
        layout->addWidget( area );
        setLayout( layout );
        TomahawkUtils::unmarginLayout( layout );
    }

    {
        QPalette pal = palette();
        pal.setBrush( backgroundRole(), TomahawkStyle::PAGE_BACKGROUND );
        ui->widget->setPalette( pal );
        ui->widget->setAutoFillBackground( true );
    }

    MetaPlaylistInterface* mpl = new MetaPlaylistInterface();
    mpl->addChildInterface( ui->tracks->playlistInterface() );
    mpl->addChildInterface( ui->albums->playlistInterface() );
    m_playlistInterface = playlistinterface_ptr( mpl );

    load( album );
}
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)));
}