// ------------------
// HintProposalWidget
// ------------------
FunctionHintProposalWidget::FunctionHintProposalWidget()
    : d(new FunctionHintProposalWidgetPrivate)
{
    QToolButton *downArrow = new QToolButton;
    downArrow->setArrowType(Qt::DownArrow);
    downArrow->setFixedSize(16, 16);
    downArrow->setAutoRaise(true);

    QToolButton *upArrow = new QToolButton;
    upArrow->setArrowType(Qt::UpArrow);
    upArrow->setFixedSize(16, 16);
    upArrow->setAutoRaise(true);

    QHBoxLayout *pagerLayout = new QHBoxLayout(d->m_pager);
    pagerLayout->setMargin(0);
    pagerLayout->setSpacing(0);
    pagerLayout->addWidget(upArrow);
    pagerLayout->addWidget(d->m_numberLabel);
    pagerLayout->addWidget(downArrow);

    QHBoxLayout *popupLayout = new QHBoxLayout(d->m_popupFrame);
    popupLayout->setMargin(0);
    popupLayout->setSpacing(0);
    popupLayout->addWidget(d->m_pager);
    popupLayout->addWidget(d->m_hintLabel);

    connect(upArrow, SIGNAL(clicked()), SLOT(previousPage()));
    connect(downArrow, SIGNAL(clicked()), SLOT(nextPage()));

    qApp->installEventFilter(this);

    setFocusPolicy(Qt::NoFocus);
}
Exemplo n.º 2
0
void FramelessDlg::InitTitleBar()
{
	QVBoxLayout* layout = qobject_cast<QVBoxLayout*>(this->layout());

	m_closeBtn = new QToolButton(this);
	QToolButton* minBtn = new QToolButton(this);
	QToolButton* menuBtn = new QToolButton(this);

	m_subTitle = new QLabel(this);
	m_subTitle->setAlignment(Qt::AlignRight | Qt::AlignVCenter);

	m_closeBtn->setObjectName("closeBtn");
	minBtn->setObjectName("minBtn");
	menuBtn->setObjectName("menuBtn");
	m_subTitle->setObjectName("subTitle");

	menuBtn->setPopupMode(QToolButton::InstantPopup);
	m_menu = new QMenu(this);
	menuBtn->setMenu(m_menu);

	m_closeBtn->setFixedSize(27, 22);
	minBtn->setFixedSize(27, 22);
	menuBtn->setFixedSize(27, 22);
	m_subTitle->setFixedSize(400, 25);

	connect(m_closeBtn, SIGNAL(clicked()), this, SLOT(reject()));
	connect(m_closeBtn, SIGNAL(clicked()), this, SLOT(close()));
	connect(minBtn, SIGNAL(clicked()), this, SLOT(showMinimized()));

	QFrame* tb = new QFrame(this);
	tb->setObjectName("titleBar");
	QHBoxLayout* tbLayout = new QHBoxLayout;
	m_title = new QLabel(this);
	m_title->setObjectName("label_title");
	m_title->setFixedSize(300, 25);

	tbLayout->addWidget(m_title);
	tbLayout->addSpacerItem(new QSpacerItem(20, 40, QSizePolicy::Expanding, QSizePolicy::Fixed));

	if ( m_flag & SUB_TITLE )
		tbLayout->addWidget(m_subTitle);

	if ( m_flag & MENU_BUTTON )
		tbLayout->addWidget(menuBtn);

	if ( m_flag & MIN_BUTTON )
		tbLayout->addWidget(minBtn);

	if ( m_flag & CLOSE_BUTTON )
		tbLayout->addWidget(m_closeBtn);

	tb->setLayout(tbLayout);
	layout->addWidget(tb);
}
Exemplo n.º 3
0
void KgGeneral::createExtensionsTab()
{
    // ------------------------- atomic extensions ----------------------------------

    QWidget *tab = createTab(i18n("Atomic extensions"));
    QGridLayout *tabLayout = new QGridLayout(tab);
    tabLayout->setSpacing(6);
    tabLayout->setContentsMargins(11, 11, 11, 11);

    QWidget * vboxWidget2 = new QWidget(tab);
    tabLayout->addWidget(vboxWidget2);

    QVBoxLayout * vbox2 = new QVBoxLayout(vboxWidget2);

    QWidget * hboxWidget3 = new QWidget(vboxWidget2);
    vbox2->addWidget(hboxWidget3);

    QHBoxLayout * hbox3 = new QHBoxLayout(hboxWidget3);

    QLabel * atomLabel = new QLabel(i18n("Atomic extensions:"), hboxWidget3);
    hbox3->addWidget(atomLabel);

    int size = QFontMetrics(atomLabel->font()).height();

    QToolButton *addButton = new QToolButton(hboxWidget3);
    hbox3->addWidget(addButton);

    QPixmap icon = krLoader->loadIcon("list-add", KIconLoader::Desktop, size);
    addButton->setFixedSize(icon.width() + 4, icon.height() + 4);
    addButton->setIcon(QIcon(icon));
    connect(addButton, SIGNAL(clicked()), this, SLOT(slotAddExtension()));

    QToolButton *removeButton = new QToolButton(hboxWidget3);
    hbox3->addWidget(removeButton);

    icon = krLoader->loadIcon("list-remove", KIconLoader::Desktop, size);
    removeButton->setFixedSize(icon.width() + 4, icon.height() + 4);
    removeButton->setIcon(QIcon(icon));
    connect(removeButton, SIGNAL(clicked()), this, SLOT(slotRemoveExtension()));

    QStringList defaultAtomicExtensions;
    defaultAtomicExtensions += ".tar.gz";
    defaultAtomicExtensions += ".tar.bz2";
    defaultAtomicExtensions += ".tar.lzma";
    defaultAtomicExtensions += ".tar.xz";
    defaultAtomicExtensions += ".moc.cpp";

    listBox = createListBox("Look&Feel", "Atomic Extensions",
                            defaultAtomicExtensions, vboxWidget2, true, PAGE_EXTENSIONS);
    vbox2->addWidget(listBox);
}
Exemplo n.º 4
0
VESPERSBeamSelectorView::VESPERSBeamSelectorView(QWidget *parent)
	: QWidget(parent)
{
	currentBeam_ = 0;

	beams_ = new QButtonGroup;

	QToolButton *temp = new QToolButton;
	temp->setText("Pink");
	temp->setFixedSize(35, 22);
	temp->setCheckable(true);
	beams_->addButton(temp, 0);

	temp = new QToolButton;
	temp->setText("10%");
	temp->setFixedSize(35, 22);
	temp->setCheckable(true);
	beams_->addButton(temp, 1);

	temp = new QToolButton;
	temp->setText("1.6%");
	temp->setFixedSize(35, 22);
	temp->setCheckable(true);
	beams_->addButton(temp, 2);

	temp = new QToolButton;
	temp->setText("Si");
	temp->setFixedSize(35, 22);
	temp->setCheckable(true);
	beams_->addButton(temp, 3);

	connect(beams_, SIGNAL(buttonClicked(int)), this, SLOT(changeBeam(int)));
	connect(VESPERSBeamline::vespers(), SIGNAL(currentBeamChanged(VESPERS::Beam)), this, SLOT(onCurrentBeamChanged(VESPERS::Beam)));

	progressBar_ = new QProgressBar;
	progressBar_->hide();
	progressBar_->setRange(0, 100);

	QHBoxLayout *buttonsLayout = new QHBoxLayout;
	buttonsLayout->addWidget(beams_->button(0));
	buttonsLayout->addWidget(beams_->button(1));
	buttonsLayout->addWidget(beams_->button(2));
	buttonsLayout->addWidget(beams_->button(3));

	QVBoxLayout *beamSelectorLayout = new QVBoxLayout;
	beamSelectorLayout->addLayout(buttonsLayout);
	beamSelectorLayout->addWidget(progressBar_);

	setLayout(beamSelectorLayout);
}
Exemplo n.º 5
0
dtkSearchField::dtkSearchField(QWidget *parent) : QWidget(parent)
{
    QLineEdit *lineEdit = new QLineEdit(this);
    connect(lineEdit, SIGNAL(textChanged(QString)),
            this, SIGNAL(textChanged(QString)));
    connect(lineEdit, SIGNAL(editingFinished()),
            this, SIGNAL(editingFinished()));
    connect(lineEdit, SIGNAL(textChanged(QString)),
            this, SLOT(setText(QString)));

    QToolButton *clearButton = new QToolButton(this);
    QPixmap clearIcon(QString(":/Qocoa/qsearchfield_nonmac.png"));
    clearButton->setIcon(QIcon(clearIcon));
    clearButton->setIconSize(clearIcon.size());
    clearButton->setFixedSize(clearIcon.size());
    clearButton->setStyleSheet("border: none;");
    clearButton->hide();
    connect(clearButton, SIGNAL(clicked()), this, SLOT(clear()));

    d = new dtkSearchFieldPrivate(this, lineEdit, clearButton);

    lineEdit->setStyleSheet(QString("QLineEdit { padding-right: %1px; } ").arg(d->clearButtonPaddedWidth()));
    const int width = qMax(lineEdit->minimumSizeHint().width(), d->clearButtonPaddedWidth());
    const int height = qMax(lineEdit->minimumSizeHint().height(), d->clearButtonPaddedHeight());
    lineEdit->setMinimumSize(width, height);

    QVBoxLayout *layout = new QVBoxLayout(this);
    layout->setMargin(0);
    layout->addWidget(lineEdit);
}
void FreyaMessageDialog::AppendDecisionBtn(const QString &name, const FreyaBaseData &freyaData)
{
    QToolButton *decisionBtn = new QToolButton(this);
    decisionBtn->setObjectName("MsgDecBtn");
    decisionBtn->setText(name);
    decisionBtn->setFixedSize(80, 26);
    m_BtnHLay->addWidget(decisionBtn);
    connect(decisionBtn, SIGNAL(clicked()), this, SLOT(OnDecisionBtnClicked()));
    m_DecisionBtnMap.insert(decisionBtn, freyaData);
}
Exemplo n.º 7
0
PreviewDialog::PreviewDialog(QWidget *parent) : DragWidget(parent)
{
    m_borderImage = false;
    setAutoFillBackground(true);

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

    m_zoomLabel = new QLabel(this);

    setZoom(1);

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

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

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

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

    wheelFilter->setTarget(this);

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

    foreach (QWidget *childWidget, findChildren<QWidget*>()) {
        childWidget->installEventFilter(wheelFilter);
    }
Exemplo n.º 8
0
QT_BEGIN_NAMESPACE

static QToolButton *createToolButton(QWidget *parent, Qt::ArrowType at, const QString &name) {
    QToolButton *rc =  new QToolButton();
    rc->setAttribute(Qt::WA_NoChildEventsForParent, true);
    rc->setParent(parent);
    rc->setObjectName(name);
    rc->setArrowType(at);
    rc->setAutoRaise(true);
    rc->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
    rc->setFixedSize(QSize(15, 15));
    return rc;
}
Exemplo n.º 9
0
void GlobStore::addLocation()
{
    QAction* storeAction = new QAction(tr("&Store"), this);
    QToolButton *storeButton = new QToolButton;
    storeButton->setDefaultAction(storeAction);
    storeButton->setFixedSize(15, 25);
    storeAction->setIcon(QPixmap(filesave_xpm));
    connect(storeAction, SIGNAL(triggered()), storeSignalMapper, SLOT(map()));
    storeSignalMapper->setMapping(storeAction, widgetList.count());

    QAction* restoreAction = new QAction(tr("&Restore"), this);
    QToolButton *restoreButton = new QToolButton;
    restoreButton->setDefaultAction(restoreAction);
    restoreButton->setFixedSize(45, 25);
    restoreAction->setText(QString::number(widgetList.count() + 1));
    restoreButton->setStyleSheet("font: 18pt");
    restoreAction->setDisabled(true);
    restoreAction->setObjectName("-1");
    restoreAction->setProperty("index", widgetList.count() + 1);
    connect(restoreAction, SIGNAL(triggered()), this, SLOT(mapRestoreSignal()));

    QWidget* globWidget = new QWidget;
    QHBoxLayout* globLayout = new QHBoxLayout;
    globLayout->setSpacing(0);
    globLayout->setMargin(0);
    globLayout->addWidget(storeButton);
    globLayout->addWidget(restoreButton);
    globWidget->setLayout(globLayout);

    indivButtonLayout->itemAt(0)->layout()->itemAt(0)->layout()->addWidget(globWidget);

    if (widgetList.count()) {
        widgetList.last()->layout()->itemAt(1)->widget()->setEnabled(true);
    }
    widgetList.append(globWidget);
    modified = true;
}
Exemplo n.º 10
0
void PreferencesDialog::getToolButton(const QString& ic, const QString& text, int indexOfStackedWidget) {
    QToolButton *button = new QToolButton;
    button->setIcon(ApplicationData::icon(ic));
    button->setText(text);
    button->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
    button->setFixedSize(QSize(90, 64));
    button->setCheckable(true);
    if(indexOfStackedWidget == 0) button->setChecked(true);
    connect(button, &QToolButton::toggled, [ = ] (){
        pagesWidget_->setCurrentIndex(indexOfStackedWidget);
    });
    
    toolBarButtonGroup_->addButton(button);
    contentsWidget_->addWidget(button);
}
void FreyaMessageDialog::showEvent(QShowEvent *e)
{
    if(m_BtnHLay->count() == 0)
    {
        QToolButton *tempOKBtn = new QToolButton(this);
        tempOKBtn->setObjectName("MessageOKBtn");
        tempOKBtn->setFixedSize(80, 26);
        tempOKBtn->setText(tr("OK"));
        m_BtnHLay->addWidget(tempOKBtn);
        connect(tempOKBtn, SIGNAL(clicked()), this, SLOT(accept()));
    }
    resize(qMax(m_BtnHLay->minimumSize().width(), m_ContentLab->width()) + 20,
           m_ContentLab->height() + 60);
    FreyaBackWindow::showEvent(e);
}
Exemplo n.º 12
0
void SugarDialog::setupUi()
{
    m_signalMapper = new QSignalMapper(this);
    connect(m_signalMapper, SIGNAL(mapped(int)), SLOT(setValue(int)));

    QToolButton* withoutSugarButton = new QToolButton;
    withoutSugarButton->setFixedSize(100, 100);
    withoutSugarButton->setText(tr("Without Sugar"));
    connect(withoutSugarButton, SIGNAL(clicked()), m_signalMapper, SLOT(map()));

    QToolButton* lessSugarButton = new QToolButton;
    lessSugarButton->setFixedSize(100, 100);
    lessSugarButton->setText(tr("Little Sugar"));
    connect(lessSugarButton, SIGNAL(clicked()), m_signalMapper, SLOT(map()));

    QToolButton* normalSugarButton = new QToolButton;
    normalSugarButton->setFixedSize(100, 100);
    normalSugarButton->setText(tr("Normal Sugar"));
    connect(normalSugarButton, SIGNAL(clicked()), m_signalMapper, SLOT(map()));

    QToolButton* moreSugarButton = new QToolButton;
    moreSugarButton->setFixedSize(100, 100);
    moreSugarButton->setText(tr("Much Sugar"));
    connect(moreSugarButton, SIGNAL(clicked()), m_signalMapper, SLOT(map()));

    m_signalMapper->setMapping(withoutSugarButton, Model::Sugar::WithoutSugar);
    m_signalMapper->setMapping(lessSugarButton, Model::Sugar::LessSugar);
    m_signalMapper->setMapping(normalSugarButton, Model::Sugar::NormalSugar);
    m_signalMapper->setMapping(moreSugarButton, Model::Sugar::MoreSugar);

    QHBoxLayout* layout = new QHBoxLayout(this);
    layout->addWidget(withoutSugarButton);
    layout->addWidget(lessSugarButton);
    layout->addWidget(normalSugarButton);
    layout->addWidget(moreSugarButton);
}
Exemplo n.º 13
0
void Widget::showNextThumbnails()
{
    int viewersize = viewer.size();
    if (thumbnailIndex >= viewersize) {
        thumbnailIndex = 0;
    } else {
        if ((thumbnailIndex + 5) >= viewersize)
            thumbnailIndex = 0;
        else
            thumbnailIndex += 5;
    }

    currentImages = viewer.getImageList(thumbnailIndex, 5);

    QPixmap pixmap;
    QToolButton *button;
    const Image *image;

    QLayoutItem *child;
    while ((child = ui->frameThumnailArea->layout()->takeAt(0)) != 0) {
        delete child->widget();
    }

    for (int j = 0; j < currentImages.size(); ++j) {
        image = currentImages.at(j);
        pixmap = image->getThumbnailPixmap();
        button = new QToolButton;
        button->setFixedSize(pixmap.size());
        button->setAccessibleName(QString::number(j));
        button->setAccessibleDescription(image->getPathString());
        button->setIcon(pixmap);
        button->setIconSize(pixmap.size());
        button->setAutoRaise(true);

        connect(button, SIGNAL(clicked()),&signalMapper, SLOT(map()));
        signalMapper.setMapping(static_cast<QObject *>(button), static_cast<QObject *>(button));

        ui->frameThumnailArea->layout()->addWidget(button);
    }

    currentIndex = 0;
    image = currentImages.at(currentIndex);
    QString path = image->getPathString();
    pixmap = QPixmap(path).scaled(400, 300, Qt::KeepAspectRatio);
    currentImage->setPixmap(pixmap);
}
Exemplo n.º 14
0
QToolButton * FilterItemWidget::createDeleteButton()
{
    QToolButton * deleteBtn = new QToolButton;
    deleteBtn->setFixedSize(16,16);
    deleteBtn->setStyleSheet("QToolButton { "
                               "border: none; "
                               "padding: 0px; "
                               "background: url(:/icons/close) center center no-repeat;"
                               "}"
                               "QToolButton:hover {"
                               "background: url(:/icons/close_hover) center center no-repeat;"
                               "}"
                               "QToolButton:pressed {"
                               "background: url(:/icons/close_pressed) center center no-repeat;"
                               "}");
    deleteBtn->setToolButtonStyle(Qt::ToolButtonIconOnly);
    deleteBtn->setToolTip(tr("Remove criterion"));
    return deleteBtn;
}
QToolButton* MenuToolWidget::newToolButton(const QPixmap& icon, QString strToolTip)
{
    QToolButton* toolButton = new QToolButton(this);
    toolButton->setAutoRaise(true);
    toolButton->setIconSize( QSize(55,55) );
    toolButton->setFixedSize(55, 55);
    toolButton->setIcon(icon);
    toolButton->setStyleSheet("background:transparent;");
   // toolButton->setMask(icon.createHeuristicMask());
    toolButton->setToolTip(strToolTip);
//    toolButton->setStyleSheet("QToolButton{min-height:20;border-style:solid;border-top-left-radius:2px;"
//                              "border-top-right-radius:2px;""border:2px groove gray;border-radius:10px;padding:2px 4px;"
//                              "background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop:0 rgb(226,236,241), "
//                              "stop: 0.2 rgb(233,242,247),stop: 0.7 rgb(176,208,225),"
//                              "stop: 0.8 rgb(176,208,225),"
//                              "stop: 1 rgb(192,216,232));}");

    return toolButton;
}
SelectionView::SelectionView(Gui::Document* pcDocument, QWidget *parent)
  : DockWindow(pcDocument,parent)
{
    setWindowTitle( tr( "Property View" ) );

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

    QLineEdit* searchBox = new QLineEdit(this);
#if QT_VERSION >= 0x040700
    searchBox->setPlaceholderText( tr( "Search" ) );
#endif
    searchBox->setToolTip( tr( "Searches object labels" ) );
    pLayout->addWidget( searchBox );
    QHBoxLayout* llayout = new QHBoxLayout(searchBox);
    QToolButton* clearButton = new QToolButton(searchBox);
    clearButton->setFixedSize(18, 21);
    clearButton->setCursor(Qt::ArrowCursor);
    clearButton->setStyleSheet(QString::fromAscii("QToolButton {margin-bottom:6px}"));
    clearButton->setIcon(BitmapFactory().pixmap(":/icons/edit-cleartext.svg"));
    clearButton->setToolTip( tr( "Clears the search field" ) );
    llayout->addWidget(clearButton,0,Qt::AlignRight);

    selectionView = new QListWidget(this);
    selectionView->setContextMenuPolicy(Qt::CustomContextMenu);
    pLayout->addWidget( selectionView );
    resize( 200, 200 );

    QObject::connect(clearButton, SIGNAL(clicked()), searchBox, SLOT(clear()));
    QObject::connect(searchBox, SIGNAL(textChanged(QString)), this, SLOT(search(QString)));
    QObject::connect(selectionView, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(select(QListWidgetItem*)));
    QObject::connect(selectionView, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(onItemContextMenu(QPoint)));
    
    Gui::Selection().Attach(this);
}
Exemplo n.º 17
0
    LecteurAudio::LecteurAudio(QWidget *parent)
        : QDockWidget(parent)
    {
		// Initialisation de la variable globale
		G_lecteurAudio = this;

		// Initialisation de l'etat du lecteur
		etatActuel = arret;
		enBoucle = false;
		lectureUnique = false;
		repriseDeLecture = false;
		listeChemins.clear();
		titreCourant = 0;
		fluxAudio = 0;

		// Titre du dockWidget
		setWindowTitle(tr("Musiques d'ambiance"));
		// Parametrage du dockWidget
        setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
		setFeatures(QDockWidget::AllDockWidgetFeatures);
		// On fixe la largeur du dockWidget
		setMinimumWidth(255);
		
		// Creation du widget principal
		widgetPrincipal = new QWidget();
		// Creation du widget destine aux joueurs
		widgetAffichage = new QWidget();
		// Creation du widget destine aux MJ
		widgetCommande = new QWidget();
		// Creation du layout principal
		layoutPrincipal = new QVBoxLayout(widgetPrincipal);
		layoutPrincipal->setMargin(0);

		// Creation d'un widget separateur
		QWidget *separateur1 = new QWidget();
		separateur1->setFixedHeight(2);
		layoutPrincipal->addWidget(separateur1);

		// Ajout des widgets d'affichage et de commande
		layoutPrincipal->addWidget(widgetAffichage);
		layoutPrincipal->addWidget(widgetCommande);

		// Creation du layout d'affichage
		QHBoxLayout *layoutAffichage = new QHBoxLayout(widgetAffichage);
		layoutAffichage->setMargin(0);
		// Creation de l'afficheur de titres
		afficheurTitre = new QLineEdit();
		afficheurTitre->setReadOnly(true);
		// Ajout de l'afficheur de titres au widget d'affichage
		layoutAffichage->addWidget(afficheurTitre);
		
		// Si l'utilisateur local est un joueur on rajoute un bouton pour qu'il puisse choisir le repertoire
		// ou se trouve les musiques qui vont etre jouees
		if (G_joueur)
		{
			QAction *actionChangerDossier = new QAction(QIcon(":/icones/dossier.png"), tr("Choisir le répertoire où sont stockées les musiques"), widgetAffichage);
			QToolButton *boutonChangerDossier = new QToolButton(widgetAffichage);
			boutonChangerDossier->setDefaultAction(actionChangerDossier);
			boutonChangerDossier->setFixedSize(20, 20);
			// Ajout du bouton au widget d'affichage
			layoutAffichage->addWidget(boutonChangerDossier);
			// Connexion de l'action a l'ouverture d'un selecteur de repertoire
			QObject::connect(actionChangerDossier, SIGNAL(triggered(bool)), this, SLOT(joueurChangerDossier()));
		}

		// Creation du selecteur de volume
		niveauVolume = new QSlider(Qt::Horizontal);
		niveauVolume->setStyle(new QPlastiqueStyle());
		niveauVolume->setFixedWidth(50);
		niveauVolume->setToolTip(tr("Volume"));
		niveauVolume->setRange(0, 255);
		// Si la variable d'initialisation est utilisable, on initialise le volume
		if (G_initialisation.initialisee)
			niveauVolume->setValue(G_initialisation.niveauVolume);
		// Sinon on met une valeur par defaut
		else
			niveauVolume->setValue(100);
		
		// Ajout du selecteur de volume au widget d'affichage
		layoutAffichage->addWidget(niveauVolume);

		// Remplissage du widget de commande
		QVBoxLayout *layoutCommande = new QVBoxLayout(widgetCommande);
		layoutCommande->setMargin(0);
		// Creation du layout de temps
		QHBoxLayout *layoutTemps = new QHBoxLayout();
		layoutTemps->setMargin(0);
		// Creation du selecteur de temps
		positionTemps = new QSlider(Qt::Horizontal);
		positionTemps->setStyle(new QCleanlooksStyle());
		positionTemps->setRange(0, 0);
		// Creation de l'afficheur de temps
		afficheurTemps = new QLCDNumber();
		afficheurTemps->setNumDigits(5);
		afficheurTemps->setSegmentStyle(QLCDNumber::Flat);
		afficheurTemps->display("0:00");
		afficheurTemps->setFixedWidth(40);
		// Ajout des widgets dans le layout
		layoutTemps->addWidget(positionTemps);
		layoutTemps->addWidget(afficheurTemps);
		// Ajout du layout de temps au layout de commande
		layoutCommande->addLayout(layoutTemps);
		// Creation du layout des boutons
		QHBoxLayout *layoutBoutons = new QHBoxLayout();
		layoutBoutons->setMargin(0);
		layoutBoutons->setSpacing(0);
		// Creation des actions
		actionLecture 	= new QAction(QIcon(":/icones/lecture.png"), tr("Lecture"), widgetCommande);
		actionPause 	= new QAction(QIcon(":/icones/pause.png"), tr("Pause"), widgetCommande);
		actionStop	 	= new QAction(QIcon(":/icones/stop.png"), tr("Stop"), widgetCommande);
		actionBoucle	= new QAction(QIcon(":/icones/boucle.png"), tr("Lecture en boucle"), widgetCommande);
		actionUnique	= new QAction(QIcon(":/icones/lecture unique.png"), tr("Lecture unique"), widgetCommande);
		actionAjouter 	= new QAction(tr("Ajouter"), widgetCommande);
		actionSupprimer	= new QAction(tr("Supprimer"), widgetCommande);
		// Modification des toolTip
		actionAjouter->setToolTip(tr("Ajouter un titre à la liste"));
		actionSupprimer->setToolTip(tr("Supprimer le titre sélectionné"));
		// Les actions lecture, pause et boucle sont checkables
		actionLecture->setCheckable(true);
		actionPause->setCheckable(true);
		actionBoucle->setCheckable(true);
		actionUnique->setCheckable(true);
		// Creation des boutons
		QToolButton *boutonLecture		= new QToolButton(widgetCommande);
		QToolButton *boutonPause		= new QToolButton(widgetCommande);
		QToolButton *boutonStop			= new QToolButton(widgetCommande);
		QToolButton *boutonBoucle		= new QToolButton(widgetCommande);
		QToolButton *boutonUnique		= new QToolButton(widgetCommande);
		QToolButton *boutonAjouter		= new QToolButton(widgetCommande);
		QToolButton *boutonSupprimer	= new QToolButton(widgetCommande);
		// Association des actions aux boutons
		boutonLecture	->setDefaultAction(actionLecture);
		boutonPause		->setDefaultAction(actionPause);
		boutonStop		->setDefaultAction(actionStop);
		boutonBoucle	->setDefaultAction(actionBoucle);
		boutonUnique	->setDefaultAction(actionUnique);
		boutonAjouter	->setDefaultAction(actionAjouter);
		boutonSupprimer	->setDefaultAction(actionSupprimer);
		// Boutons de commande en mode AutoRaise, plus lisible
		boutonLecture	->setAutoRaise(true);
		boutonPause		->setAutoRaise(true);
		boutonStop		->setAutoRaise(true);
		boutonBoucle	->setAutoRaise(true);
		boutonUnique	->setAutoRaise(true);
		// On fixe la taille des boutons
		boutonLecture	->setFixedSize(20, 20);
		boutonPause		->setFixedSize(20, 20);
		boutonStop		->setFixedSize(20, 20);
		boutonBoucle	->setFixedSize(20, 20);
		boutonUnique	->setFixedSize(20, 20);
		boutonAjouter	->setFixedSize(70, 20);
		boutonSupprimer	->setFixedSize(70, 20);
		// Creation d'un widget separateur
		QWidget *separateur2 = new QWidget();
		// Ajout des boutons au layout
		layoutBoutons->addWidget(boutonLecture);
		layoutBoutons->addWidget(boutonPause);
		layoutBoutons->addWidget(boutonStop);
		layoutBoutons->addWidget(boutonBoucle);
		layoutBoutons->addWidget(boutonUnique);
		layoutBoutons->addWidget(separateur2);
		layoutBoutons->addWidget(boutonAjouter);
		layoutBoutons->addWidget(boutonSupprimer);
		// Ajout du layout des boutons au layout de commande
		layoutCommande->addLayout(layoutBoutons);
		// Creation de la liste de titres
		listeTitres = new QListWidget();
		listeTitres->setSelectionMode(QAbstractItemView::SingleSelection);
		// Ajout de la liste au widget de commande
		layoutCommande->addWidget(listeTitres);

		// Connexion des actions des boutons avec les fonctions appropriees
		QObject::connect(actionLecture, SIGNAL(triggered(bool)), this, SLOT(appuiLecture(bool)));
		QObject::connect(actionPause, SIGNAL(triggered(bool)), this, SLOT(appuiPause(bool)));
		QObject::connect(actionStop, SIGNAL(triggered(bool)), this, SLOT(appuiStop(bool)));
		QObject::connect(actionBoucle, SIGNAL(triggered(bool)), this, SLOT(appuiBoucle(bool)));
		QObject::connect(actionUnique, SIGNAL(triggered(bool)), this, SLOT(appuiUnique(bool)));
		QObject::connect(actionAjouter, SIGNAL(triggered(bool)), this, SLOT(ajouterTitre()));
		QObject::connect(actionSupprimer, SIGNAL(triggered(bool)), this, SLOT(supprimerTitre()));
		// Connexion des slider (volume et temps) avec les fonctions appropriees
		QObject::connect(niveauVolume, SIGNAL(sliderMoved(int)), this, SLOT(changementVolume(int)));
		QObject::connect(positionTemps, SIGNAL(sliderReleased()), this, SLOT(changementTempsLecture()));
		QObject::connect(positionTemps, SIGNAL(sliderMoved(int)), this, SLOT(changementTempsAffichage(int)));
		// Connexion du double-clic sur la liste vers le changement de titre en cours
		QObject::connect(listeTitres, SIGNAL(itemDoubleClicked(QListWidgetItem *)), this, SLOT(changementTitre(QListWidgetItem *)));
		// Connexion du traitement de fin de lecture du titre
		QObject::connect(this, SIGNAL(finDeTitreSignal()), this, SLOT(finDeTitreSlot()));

		// Au demarrage seul le bouton Ajouter et le reglage du volume sont actifs
		actionLecture->setEnabled(false);
		actionPause->setEnabled(false);
		actionStop->setEnabled(false);
		actionBoucle->setEnabled(false);
		actionUnique->setEnabled(false);
		actionSupprimer->setEnabled(false);
		positionTemps->setEnabled(false);

		// On autorise ou pas l'affichage du tableau de commande selon la nature de l'utilisateur (MJ ou joueur)
		autoriserOuIntedireCommandes();

		// Insertion du widget principal dans le dockWidget
		setWidget(widgetPrincipal);
	}
Exemplo n.º 18
0
MainWindow::MainWindow(AmViewerState *state) : _state(state) {
    _state->recon_tree = NULL;
    _state->amEvent = NULL;
    _state->show_dBm = false;
    _state->filtered = true;
    _state->sumpols = false;
    _state->resetSearch(); // couldn't hurt?

    setWindowTitle("AmViewer");

    // creat dialogs
    _searchWindow = new SearchWindow(this,_state);
    _visWindow = new VisWindow(this,_state);
    _fovWindow = new FovWindow(this,_state);
    _filterWindow = NULL;
    _infoWindow = NULL;

    QWidget *centralWidget = new QWidget();
    setCentralWidget(centralWidget);
    QVBoxLayout *bigLayout = new QVBoxLayout(centralWidget);

    // File menu
    QAction *quitMenu = new QAction("&Exit",this);
    quitMenu->setShortcut(tr("Ctrl+Q"));
    connect(quitMenu,SIGNAL(triggered()),qApp,SLOT(quit()));

    QAction *openMenu = new QAction("&Open ROOT file...",this);
    openMenu->setShortcut(tr("Ctrl+O"));
    connect(openMenu,SIGNAL(triggered()),this,SLOT(openFile()));

    _saveMenu = new QAction("&Save event candidates...",this);
    connect(_saveMenu,SIGNAL(triggered()),this,SLOT(saveFile()));

    QMenu *fileDrop;
    fileDrop = menuBar()->addMenu("&File");
    fileDrop->addAction(openMenu);
    fileDrop->addAction(_saveMenu);
    fileDrop->addAction(quitMenu);

    _saveMenu->setEnabled(false);

    // View menu
    _unitsMenu = new QAction("&Display dBm",this);
    _unitsMenu->setCheckable(true);
    _unitsMenu->setChecked(false);
    connect(_unitsMenu,SIGNAL(triggered()),this,SLOT(applyUnits()));

    // Filter dialog
    _filterMenu = new QAction("&Filter Settings",this);
    connect(_filterMenu,SIGNAL(triggered()),this,SLOT(openFilter()));

    // Polarization checkbox
    _polMenu = new QAction("&Sum Polarizations",this);
    _polMenu->setCheckable(true);
    _polMenu->setChecked(false);
    _polMenu->setEnabled(false);
    connect(_polMenu,SIGNAL(triggered()),this,SLOT(applySumPol()));

    QMenu *viewDrop;
    viewDrop = menuBar()->addMenu("&View");
    viewDrop->addAction(_unitsMenu);
    viewDrop->addAction(_polMenu);
    viewDrop->addAction(_filterMenu);
    _filterMenu->setEnabled(false);

    // Analysis menu
    QAction *infoMenu = new QAction("&Event Info",this);
    connect(infoMenu,SIGNAL(triggered()),this,SLOT(openInfo()));

    _analysisDrop = menuBar()->addMenu("&Analysis");
    _analysisDrop->addAction(infoMenu);

    QAction *searchMenu = new QAction("&Search Parameters",this);
    connect(searchMenu,SIGNAL(triggered()),this,SLOT(openSearch()));

    _analysisDrop->addAction(searchMenu);
    _analysisDrop->setEnabled(false);

    QAction *visMenu = new QAction("&Event Visualization",this);
    connect(visMenu,SIGNAL(triggered()),this,SLOT(openVis()));
    _analysisDrop->addAction(visMenu);

    QAction*fovMenu = new QAction("&AMBER Field of View",this);
    connect(fovMenu,SIGNAL(triggered()),this,SLOT(openFov()));
    _analysisDrop->addAction(fovMenu);

    // Set up layout for event browser, pixel windows, graphs
    QHBoxLayout *hbox = new QHBoxLayout();
    bigLayout->addLayout(hbox);

    // Event list stuff
    _eventList = new QTreeWidget(this);
    _eventList->setColumnCount(2);
    _eventList->setColumnHidden(1,true); //'true' valid in C++?

    QTreeWidgetItem *_source0 = new QTreeWidgetItem(_eventList);
    _source0->setText(0,"Source:0 (LTRIG)");

    QTreeWidgetItem *_source1 = new QTreeWidgetItem(_eventList);
    _source1->setText(0,"Source:1 (PPS)");

    QTreeWidgetItem *_source2 = new QTreeWidgetItem(_eventList);
    _source2->setText(0,"Source:2 (Auger)");

    _eventList->setHeaderLabel("Events");

    hbox->addWidget(_eventList);

    // Some gross stuff concerning the clickable horns
    _hornDisplay = new HornDisplay(this,1);

    CenterHorns *centerLegend = new CenterHorns("center",true);
    QGraphicsProxyWidget *centerLegendProxy = new QGraphicsProxyWidget();
    centerLegendProxy->setWidget(centerLegend->widget);

    _hornDisplay->hornScene->addItem(centerLegendProxy);

    centerLegendProxy->rotate(45);
    centerLegendProxy->setPos(0,-50);
    centerLegendProxy->setZValue(0.0);

    AmHorn *ppsHorn[4];

    int i;
    stringstream out;

    QToolButton *b;

    for(i=0; i<4; i++) {
        b = new QToolButton();
        b->setFixedSize(25,25);
        out.str("");
        out << (i+1);
        ppsHorn[i] = new AmHorn(b,"PPS" + out.str());
        ppsHorn[i]->proxyWidget = new QGraphicsProxyWidget();
        ppsHorn[i]->proxyWidget->setWidget(ppsHorn[i]->_button);
        _hornDisplay->hornScene->addItem(ppsHorn[i]->proxyWidget);
        ppsHorn[i]->proxyWidget->setPos(25*i-145,375);

        // probably stupid, delete
        //ppsHorn[i]->trigger_color = "blue";
        //ppsHorn[i]->updateStyle();

        //delete b;
    }

    QGraphicsSimpleTextItem *item;

    for(i=0; i<4; i++) {
        item = new QGraphicsSimpleTextItem();
        _hornDisplay->hornScene->addItem(item);
        if(i==0) {
            item->setText("CH");
            item->setPos(-7,-31);
            item->setZValue(1.0);
        }
        if(i==1) {
            item->setText("CV");
            item->setPos(-7,5);
            item->setZValue(1.0);
        }
        if(i==2) {
            item->setText("KH");
            item->setPos(-24,-15);
            item->setZValue(1.0);
        }
        if(i==3) {
            item->setText("KV");
            item->setPos(12,-15);
            item->setZValue(1.0);
        }
        //delete item;
    }

    // CRUFT ALERT
    // THIS WHOLE NEXT LOOP IS HIGHLY SUSPECT, I DOUBT IT DOES ANYTHING
    QString qstr;
    for(i=0; i<16; i++) {
        out.str("");
        out << (i+1);
        qstr = QString::fromStdString(out.str());
        item = new QGraphicsSimpleTextItem(qstr);
        _hornDisplay->hornScene->addItem(item);
        if(i==0)
            item->setPos(-2.5,75.0);
        else if(i==1)
            item->setPos(-105.0,177.5);
        else if(i==2)
            item->setPos(-2.5,280.0);
        else if(i==3)
            item->setPos(102.5,177.5);
        else if(i==4)
            item->setPos(-70.0,55.0);
        else if(i==5)
            item->setPos(-95.0,80.0);
        else if(i==6)
            item->setPos(-120.0,105.0);
        else if(i==7)
            item->setPos(-125.0,250.0);
        else if(i==8)
            item->setPos(-100.0,275.5);
        else if(i==9)
            item->setPos(-75.0,300.0);
        else if(i==10)
            item->setPos(60.0,300.0);
        else if(i==11)
            item->setPos(85.0,275.0);
        else if(i==12)
            item->setPos(110.0,250.0);
        else if(i==13)
            item->setPos(120.0,110.0);
        else if(i==14)
            item->setPos(95.0,85.0);
        else if(i==15)
            item->setPos(70.0,60.0);
    }

    QVBoxLayout *evVbox = new QVBoxLayout();
    hbox->addLayout(evVbox);

    QGridLayout *evInfoGrid = new QGridLayout();
    evVbox->addLayout(evInfoGrid);

    _evIdLabel = new QLabel("");
    _evSourceLabel = new QLabel("");
    _evSecLabel = new QLabel("");
    _evNsLabel = new QLabel("");
    _evInfoLabel = new QLabel("");

    evInfoGrid->addWidget(_evIdLabel,0,0);
    evInfoGrid->addWidget(_evSourceLabel,0,1);
    evInfoGrid->addWidget(_evSecLabel,1,0);
    evInfoGrid->addWidget(_evNsLabel,1,1);
    evInfoGrid->addWidget(_evInfoLabel,2,0);

    evVbox->addWidget(_hornDisplay);

    QVBoxLayout *pixelVbox = new QVBoxLayout();
    hbox->addLayout(pixelVbox);

    for(i=0; i<4; i++) {
        pixelWindow[i] = new PixelWindow(this,i);
        pixelWindow[i]->setMinimumHeight(100);
        pixelWindow[i]->setMinimumWidth(300);
        pixelVbox->addWidget(pixelWindow[i]);
    }

    for(i=0; i<28; i++) {
        _hornDisplay->channel[i]->setHornClickFunction(this);
        connect(_hornDisplay->channel[i]->_button,SIGNAL(clicked()),_hornDisplay->channel[i],SLOT(hornClick()));
    }

    for(i=0; i<4; i++) {
        //ppsHorn[i]->setHornClickFunction(clickHornSetPixel);
        ppsHorn[i]->setHornClickFunction(this);
        connect(ppsHorn[i]->_button,SIGNAL(clicked()),ppsHorn[i],SLOT(hornClick()));
    }
}
toPLSQLEditor::toPLSQLEditor(QWidget *main, toConnection &connection)
        : toToolWidget(PLSQLEditorTool, "plsqleditor.html", main, connection, "toPLSQLEditor")
{
    createActions();
    QToolBar *toolbar = toAllocBar(this, tr("PLSQLEditor"));
    layout()->addWidget(toolbar);

    toolbar->addAction(refreshAct);

    toolbar->addSeparator();

    Schema = new QComboBox(toolbar);
    Schema->setObjectName("PLSQLEditorSchemaCombo");
    toolbar->addWidget(Schema);
    connect(Schema,
            SIGNAL(activated(int)),
            this,
            SLOT(changeSchema(int)));

    toolbar->addSeparator();

    toolbar->addAction(newSheetAct);
    toolbar->addAction(compileAct);
    toolbar->addAction(compileWarnAct);
    // only show static check button when static checker is specified
    if (!toConfigurationSingle::Instance().staticChecker().isEmpty())
    {
        toolbar->addAction(checkCodeAct);
    }

    toolbar->addSeparator();

    toolbar->addAction(nextErrorAct);
    toolbar->addAction(previousErrorAct);
    toolbar->addAction(describeAct);

    toolbar->addWidget(new toSpacer());

    splitter = new QSplitter(Qt::Horizontal, this);
    layout()->addWidget(splitter);

    Objects = new QTreeView(splitter);
    CodeModel = new toCodeModel(Objects);
    Objects->setModel(CodeModel);
    QString selected = Schema->currentText();
    if (!selected.isEmpty())
        CodeModel->refresh(connection, selected);
    // even better (?) for reopening the tabs
//     connect(Objects->selectionModel(),
//             SIGNAL(currentChanged(const QModelIndex &, const QModelIndex &)),
//             this,
//             SLOT(changePackage(const QModelIndex &, const QModelIndex &)));
    connect(Objects, SIGNAL(doubleClicked(const QModelIndex &)),
            this, SLOT(changePackage(const QModelIndex &)));

    splitter->addWidget(Objects);

    Editors = new QTabWidget(this);
#if QT_VERSION >= 0x040500
    Editors->setTabsClosable(true);
    connect(Editors, SIGNAL(tabCloseRequested(int)),
            this, SLOT(closeEditor(int)));
#endif
    splitter->addWidget(Editors);
    Editors->setTabPosition(QTabWidget::North);

    QToolButton *closeButton = new toPopupButton(Editors);
    closeButton->setIcon(QPixmap(const_cast<const char**>(close_xpm)));
    closeButton->setFixedSize(20, 18);
    // HACK: disable closing the editor tabs with the global shortcut.
    // it raises: "QAction::eventFilter: Ambiguous shortcut overload: Ctrl+W"
    // on some systems. But it rejects to close unfinished.unsaved work.
    // - <*****@*****.**>
    closeButton->setShortcut(QKeySequence::Close);
    connect(closeButton, SIGNAL(clicked()), this, SLOT(closeEditor()));

    Editors->setCornerWidget(closeButton);

    setFocusProxy(Editors);
    newSheet();

    ToolMenu = NULL;
    connect(toMainWidget()->workspace(), SIGNAL(subWindowActivated(QMdiSubWindow *)),
            this, SLOT(windowActivated(QMdiSubWindow *)));

    QSettings s;
    s.beginGroup("toPLSQLEditor");
    splitter->restoreState(s.value("splitter").toByteArray());
    s.endGroup();

    conn = &connection;

    refresh();
}
Exemplo n.º 20
0
GlobStore::GlobStore(QWidget *parent)
            : QWidget(parent)
{
    int l1;

    midiControl = new MidiControl(this);
    midiControl->ID = -2;
    midiControl->parentDockID = -2;

    activeStore = 0;
    currentRequest = 0;
    switchAtBeat = 0;

    storeSignalMapper = new QSignalMapper(this);
    connect(storeSignalMapper, SIGNAL(mapped(int)),
             this, SLOT(storeAll(int)));

    timeModeBox = new QComboBox;
    timeModeBox->addItem(tr("End of"));
    timeModeBox->addItem(tr("After"));
    connect(timeModeBox, SIGNAL(activated(int)),
             this, SLOT(updateTimeModeBox(int)));

    switchAtBeatBox = new QComboBox;
    for (l1 = 0; l1 < 16; l1++) {
        switchAtBeatBox->addItem(QString::number(l1 + 1)+" beats");
    }
    switchAtBeatBox->hide();
    connect(switchAtBeatBox, SIGNAL(activated(int)),
             this, SLOT(updateSwitchAtBeat(int)));

    timeModuleBox = new QComboBox;
    timeModuleBox->setCurrentIndex(0);
    connect(timeModuleBox, SIGNAL(activated(int)),
             this, SLOT(updateTimeModule(int)));

    QWidget *indicatorBox = new QWidget;
    QHBoxLayout *indicatorLayout = new QHBoxLayout;
    indicator = new Indicator(20, ' ');
    indicatorBox->setMinimumHeight(30);
    indicatorBox->setMinimumWidth(30);
    indicatorLayout->addWidget(indicator);
    indicatorLayout->setMargin(2);
    indicatorLayout->setSpacing(1);
    indicatorBox->setLayout(indicatorLayout);

    QHBoxLayout *timeModeLayout = new QHBoxLayout;
    timeModeLayout->addWidget(timeModeBox);
    timeModeLayout->addWidget(timeModuleBox);
    timeModeLayout->addWidget(switchAtBeatBox);
    timeModeLayout->addWidget(indicatorBox);
    timeModeLayout->setSpacing(0);
    timeModeLayout->addStretch();

    QHBoxLayout *upperRowLayout = new QHBoxLayout;
    upperRowLayout->addLayout(timeModeLayout);
    upperRowLayout->addStretch();

    QAction* removeStoreAction = new QAction(tr("&Remove"), this);
    QToolButton *removeStoreButton = new QToolButton;
    removeStoreButton->setDefaultAction(removeStoreAction);
    removeStoreButton->setFixedSize(60, 20);
    removeStoreButton->setArrowType (Qt::ArrowType(1));
    connect(removeStoreAction, SIGNAL(triggered()), this, SLOT(removeLocation()));

    QToolButton *toolButton = new QToolButton;
    toolButton->setText("Global");
    toolButton->setMinimumSize(QSize(56,32));
    midiControl->addMidiLearnMenu("GlobRestore", toolButton, 0);
    
    QFrame *topRow = new QFrame;
    QVBoxLayout *topRowLayout = new QVBoxLayout;
    topRowLayout->addWidget(toolButton);
    topRowLayout->addStretch();
    topRowLayout->setSpacing(0);
    topRowLayout->setMargin(0);
    topRow->setFrameStyle(QFrame::StyledPanel);
    topRow->setMinimumSize(QSize(48,48));;
    topRow->setLayout(topRowLayout);

    QVBoxLayout *buttonLayout = new QVBoxLayout;
    buttonLayout->addWidget(topRow);

    QVBoxLayout *columnLayout = new QVBoxLayout;
    columnLayout->addLayout(buttonLayout);
    columnLayout->addWidget(removeStoreButton);
    columnLayout->addStretch(1);

    indivButtonLayout = new QHBoxLayout;
    indivButtonLayout->setSpacing(0);
    indivButtonLayout->setMargin(0);
    indivButtonLayout->addLayout(columnLayout);
    indivButtonLayout->setSizeConstraint(QLayout::SetFixedSize);

    QHBoxLayout *secondRowLayout = new QHBoxLayout;
    secondRowLayout->addLayout(indivButtonLayout);
    secondRowLayout->addStretch(1);

    QVBoxLayout *centLayout = new QVBoxLayout;
    centLayout->addLayout(upperRowLayout);
    centLayout->addLayout(secondRowLayout);
    centLayout->addStretch(1);

    addLocation();

    setLayout(centLayout);
    schedRestoreVal = 0;
    schedRestore = false;
    dispReqIx = 0;
    dispReqSelected = 0;
    needsGUIUpdate = false;
    modified = false;
}
Exemplo n.º 21
0
void TimeLine::initUI()
{
    Q_ASSERT( editor() != nullptr );

    setWindowTitle( "Timeline" );

    QWidget* timeLineContent = new QWidget( this );

    connect( editor(), &Editor::currentFrameChanged, this, &TimeLine::updateFrame );

    mLayerList = new TimeLineCells( this, editor(), TIMELINE_CELL_TYPE::Layers );
    mTracks = new TimeLineCells( this, editor(), TIMELINE_CELL_TYPE::Tracks );

    connect( mLayerList, &TimeLineCells::mouseMovedY, mLayerList, &TimeLineCells::setMouseMoveY );
    connect( mLayerList, &TimeLineCells::mouseMovedY, mTracks,    &TimeLineCells::setMouseMoveY );

    mHScrollbar = new QScrollBar( Qt::Horizontal );
    mVScrollbar = new QScrollBar( Qt::Vertical );
    mVScrollbar->setMinimum( 0 );
    mVScrollbar->setMaximum( 1 );
    mVScrollbar->setPageStep( 1 );
    updateLength( getFrameLength() );

    QWidget* leftWidget = new QWidget();
    leftWidget->setMinimumWidth( 120 );
    QWidget* rightWidget = new QWidget();

    QWidget* leftToolBar = new QWidget();
    leftToolBar->setFixedHeight( 31 );
    QWidget* rightToolBar = new QWidget();
    rightToolBar->setFixedHeight( 31 );

    // --- left widget ---
    // --------- layer buttons ---------
    QToolBar* layerButtons = new QToolBar( this );
    QLabel* layerLabel = new QLabel( tr( "Layers:" ) );
    layerLabel->setIndent( 5 );
    layerLabel->setFont( QFont( "Helvetica", 10 ) );

    QToolButton* addLayerButton = new QToolButton( this );
    addLayerButton->setIcon( QIcon( ":icons/add.png" ) );
    addLayerButton->setToolTip( "Add Layer" );
    addLayerButton->setFixedSize( 24, 24 );

    QToolButton* removeLayerButton = new QToolButton( this );
    removeLayerButton->setIcon( QIcon( ":icons/remove.png" ) );
    removeLayerButton->setToolTip( "Remove Layer" );
    removeLayerButton->setFixedSize( 24, 24 );

    layerButtons->addWidget( layerLabel );
    layerButtons->addWidget( addLayerButton );
    layerButtons->addWidget( removeLayerButton );

    QHBoxLayout* leftToolBarLayout = new QHBoxLayout();
    leftToolBarLayout->setAlignment( Qt::AlignLeft );
    leftToolBarLayout->setMargin( 0 );
    leftToolBarLayout->addWidget( layerButtons );
    leftToolBar->setLayout( leftToolBarLayout );

    QAction* newBitmapLayerAct = new QAction( QIcon( ":icons/layer-bitmap.png" ), tr( "New Bitmap Layer" ), this );
    QAction* newVectorLayerAct = new QAction( QIcon( ":icons/layer-vector.png" ), tr( "New Vector Layer" ), this );
    QAction* newSoundLayerAct = new QAction( QIcon( ":icons/layer-sound.png" ), tr( "New Sound Layer" ), this );
    QAction* newCameraLayerAct = new QAction( QIcon( ":icons/layer-camera.png" ), tr( "New Camera Layer" ), this );

    QMenu* layerMenu = new QMenu( tr( "&Layer" ), this );
    layerMenu->addAction( newBitmapLayerAct );
    layerMenu->addAction( newVectorLayerAct );
    layerMenu->addAction( newSoundLayerAct );
    layerMenu->addAction( newCameraLayerAct );
    addLayerButton->setMenu( layerMenu );
    addLayerButton->setPopupMode( QToolButton::InstantPopup );

    QGridLayout* leftLayout = new QGridLayout();
    leftLayout->addWidget( leftToolBar, 0, 0 );
    leftLayout->addWidget( mLayerList, 1, 0 );
    leftLayout->setMargin( 0 );
    leftLayout->setSpacing( 0 );
    leftWidget->setLayout( leftLayout );

    // --- right widget ---
    // --------- key buttons ---------
    QToolBar* keyButtons = new QToolBar( this );
    QLabel* keyLabel = new QLabel( tr( "Keys:" ) );
    keyLabel->setFont( QFont( "Helvetica", 10 ) );
    keyLabel->setIndent( 5 );

    QToolButton* addKeyButton = new QToolButton( this );
    addKeyButton->setIcon( QIcon( ":icons/add.png" ) );
    addKeyButton->setToolTip( "Add Frame" );
    addKeyButton->setFixedSize( 24, 24 );

    QToolButton* removeKeyButton = new QToolButton( this );
    removeKeyButton->setIcon( QIcon( ":icons/remove.png" ) );
    removeKeyButton->setToolTip( "Remove Frame" );
    removeKeyButton->setFixedSize( 24, 24 );

    QToolButton* duplicateKeyButton = new QToolButton( this );
    duplicateKeyButton->setIcon( QIcon( ":icons/controls/duplicate.png" ) );
    duplicateKeyButton->setToolTip( "Duplicate Frame" );
    duplicateKeyButton->setFixedSize( 24, 24 );

    keyButtons->addWidget( keyLabel );
    keyButtons->addWidget( addKeyButton );
    keyButtons->addWidget( removeKeyButton );
    keyButtons->addWidget( duplicateKeyButton );



    QToolBar* onionButtons = new QToolBar( this );

    QLabel* onionLabel = new QLabel( tr( "Onion skin:" ) );
    onionLabel->setFont( QFont( "Helvetica", 10 ) );
    onionLabel->setIndent( 5 );


    QToolButton* onionTypeButton = new QToolButton( this );
    onionTypeButton->setIcon( QIcon( ":icons/onion_type.png" ) );
    onionTypeButton->setToolTip( "Toggle match keyframes" );
    onionTypeButton->setFixedSize( 24, 24 );

    onionButtons->addWidget( onionLabel );
    onionButtons->addWidget( onionTypeButton );

    // --------- Time controls ---------
    mTimeControls = new TimeControls( this );
    mTimeControls->setCore( editor() );
    mTimeControls->initUI();
    
    QHBoxLayout* rightToolBarLayout = new QHBoxLayout();
    rightToolBarLayout->addWidget( keyButtons );
    rightToolBarLayout->addStretch( 1 );
    rightToolBarLayout->addWidget( onionButtons );
    rightToolBarLayout->addStretch( 1 );
    rightToolBarLayout->addWidget( mTimeControls );
    rightToolBarLayout->setMargin( 0 );
    rightToolBarLayout->setSpacing( 0 );
    rightToolBar->setLayout( rightToolBarLayout );

    QGridLayout* rightLayout = new QGridLayout();
    rightLayout->addWidget( rightToolBar, 0, 0 );
    rightLayout->addWidget( mTracks, 1, 0 );
    rightLayout->setMargin( 0 );
    rightLayout->setSpacing( 0 );
    rightWidget->setLayout( rightLayout );

    // --- Splitter ---
    QSplitter* splitter = new QSplitter( this );
    splitter->addWidget( leftWidget );
    splitter->addWidget( rightWidget );
    splitter->setSizes( QList<int>() << 100 << 600 );


    QGridLayout* lay = new QGridLayout();
    lay->addWidget( splitter, 0, 0 );
    lay->addWidget( mVScrollbar, 0, 1 );
    lay->addWidget( mHScrollbar, 1, 0 );
    lay->setMargin( 0 );
    lay->setSpacing( 0 );
    timeLineContent->setLayout( lay );
    setWidget( timeLineContent );

    setWindowFlags( Qt::WindowStaysOnTopHint );

    connect( mHScrollbar, &QScrollBar::valueChanged, mTracks, &TimeLineCells::hScrollChange );
    connect( mVScrollbar, &QScrollBar::valueChanged, mTracks, &TimeLineCells::vScrollChange );
    connect( mVScrollbar, &QScrollBar::valueChanged, mLayerList, &TimeLineCells::vScrollChange );

    connect( addKeyButton,    &QToolButton::clicked, this, &TimeLine::addKeyClick );
    connect( removeKeyButton, &QToolButton::clicked, this, &TimeLine::removeKeyClick );
    connect( duplicateKeyButton, &QToolButton::clicked, this, &TimeLine::duplicateKeyClick );
    connect( onionTypeButton, &QToolButton::clicked, this, &TimeLine::toogleAbsoluteOnionClick );

    connect( mTimeControls, &TimeControls::loopStartClick, this, &TimeLine::loopStartClick );
    connect( mTimeControls, &TimeControls::loopEndClick, this, &TimeLine::loopEndClick );

    connect( mTimeControls, &TimeControls::soundClick, this, &TimeLine::soundClick );
    connect( mTimeControls, &TimeControls::fpsClick, this, &TimeLine::fpsClick );

    connect( newBitmapLayerAct, &QAction::triggered, this, &TimeLine::newBitmapLayer );
    connect( newVectorLayerAct, &QAction::triggered, this, &TimeLine::newVectorLayer );
    connect( newSoundLayerAct, &QAction::triggered, this, &TimeLine::newSoundLayer );
    connect( newCameraLayerAct, &QAction::triggered, this, &TimeLine::newCameraLayer );
    connect( removeLayerButton, &QPushButton::clicked, this, &TimeLine::deleteCurrentLayer );
    
    LayerManager* layer = editor()->layers();
    connect( layer, &LayerManager::layerCountChanged, this, &TimeLine::updateLayerNumber );

    scrubbing = false;
}
Exemplo n.º 22
0
/*
 * The constructor.  The central button is optional, centerIcon and centerTip are the
 * icon and tooltip for it and can be NULL.  size specifies the size of the buttons.
 * The autoRaise flag is used to set whether the buttons autoraise.  A step size label
 * is optional and provided if stepSize >= 0.
 */
RotationTool::RotationTool(QWidget *parent, QIcon *centerIcon, const char *centerTip, 
                           int size, bool autoRaise, float stepSize)
  : QWidget(parent)
{
  int ind, row, col;
  mStepLabel = NULL;
  mCenterBut = NULL;
  if (sFirstTime) {
    for (ind = 0; ind < 8; ind++) {
      sIcons[ind] = new QIcon();
      sIcons[ind]->addFile(QString(sFileList[ind]), QSize(size - 4, size - 4));
    }
  }

  QHBoxLayout *hLayout = new QHBoxLayout(this);
  hLayout->setContentsMargins(0, 0, 0, 0);
  hLayout->setSpacing(0);
  QVBoxLayout *vLayout = new QVBoxLayout();
  hLayout->addLayout(vLayout);
  vLayout->setContentsMargins(0, 0, 0, 0);
  vLayout->setSpacing(2);
  hLayout->addStretch();

  // Make the grid and the signal mapper
  QGridLayout *grid = new QGridLayout();
  vLayout->addLayout(grid);
  grid->setContentsMargins(0, 0, 0, 0);
  grid->setSpacing(autoRaise ? 0 : 4);

  QSignalMapper *rotMapper = new QSignalMapper(this);
  connect(rotMapper, SIGNAL(mapped(int)), this, SLOT(buttonClicked(int)));

  // Fill the grid
  ind = 0;
  for (row = 0; row < 3; row++) {
    for (col = 0; col < 3; col++) {
      QToolButton *button = new QToolButton(this);
      button->setAutoRaise(autoRaise);
      button->setFixedSize(size, size);
      button->setFocusPolicy(Qt::NoFocus);
      grid->addWidget(button, row, col);
      if (col == 1 && row == 1) {

        // Set center toggle button properties
        button->setCheckable(true);
        button->setChecked(false);
        mCenterBut = button;
        if (centerTip)
          button->setToolTip(centerTip);
        if (centerIcon) 
          button->setIcon(*centerIcon);
        connect(mCenterBut, SIGNAL(toggled(bool)), this, SLOT(centerToggled(bool)));
      } else {

        // Set rotation button properties and mapping, and autorepeat for non-step ones
        button->setToolTip(sButtonTips[ind]);
        button->setIcon(*sIcons[ind]);
        rotMapper->setMapping(button, ind);
        connect(button, SIGNAL(clicked()), rotMapper, SLOT(map()));
        if (!sStepSign[ind]) {
          button->setAutoRepeat(true);
          button->setAutoRepeatDelay(300);
          button->setAutoRepeatInterval(100);
        }
        ind++;
      }
    }
Exemplo n.º 23
0
void LocalToolbar::addAction(QAction* a) {
    QToolBar::addAction(a);

    QToolButton* button = qobject_cast<QToolButton*>(widgetForAction(a));
    button->setFixedSize(TOOLBAR_BUTTON_SIZE, TOOLBAR_BUTTON_SIZE);
}