/**
 * @brief A decorator for splitters
 *
 * From http://stackoverflow.com/a/13513631/882697
 *
 * @param splitter
 * @param index
 */
void helper::decorateSplitter(QSplitter* splitter, int index)
{
    Q_ASSERT(splitter != NULL);

    const int gripLength = 15;
    const int gripWidth = 1;
    const int grips = 3;

    //splitter->setOpaqueResize(false);
    //splitter->setChildrenCollapsible(false);

    splitter->setHandleWidth(7);
    QSplitterHandle* handle = splitter->handle(index);
    Qt::Orientation orientation = splitter->orientation();
    QHBoxLayout* layout = new QHBoxLayout(handle);
    layout->setSpacing(0);
    layout->setMargin(0);

    if (orientation == Qt::Horizontal)
    {
        for (int i=0;i<grips;++i)
        {
            QFrame* line = new QFrame(handle);
            line->setMinimumSize(gripWidth, gripLength);
            line->setMaximumSize(gripWidth, gripLength);
            line->setFrameShape(QFrame::StyledPanel);
            layout->addWidget(line);
        }
    }
    else
    {
        //this will center the vertical grip
        //add a horizontal spacer
        layout->addStretch();
        //create the vertical grip
        QVBoxLayout* vbox = new QVBoxLayout;
        for (int i=0;i<grips;++i)
        {
            QFrame* line = new QFrame(handle);
            line->setMinimumSize(gripLength, gripWidth);
            line->setMaximumSize(gripLength, gripWidth);
            line->setFrameShape(QFrame::StyledPanel);
            vbox->addWidget(line);
        }
        layout->addLayout(vbox);
        //add another horizontal spacer
        layout->addStretch();
    }
}
Example #2
0
// void AssocPropDlg::setupPages (UMLObject * c)
void AssocPropDlg::setupPages (AssociationWidget *assocWidget)
{
    UMLDoc* umlDoc = UMLApp::app()->document();

    // general page
    QFrame *page = new QFrame();
    KPageWidgetItem *pageItem = new KPageWidgetItem( page, i18nc("general settings", "General"));
    pageItem->setHeader( i18n("General Settings") );
    pageItem->setIcon( Icon_Utils::DesktopIcon(Icon_Utils::it_Properties_General) );
    addPage( pageItem );
    QHBoxLayout *genLayout = new QHBoxLayout(page);
    page->setMinimumSize(310, 330);
    m_pGenPage = new AssocGenPage (umlDoc, page, assocWidget);
    genLayout->addWidget(m_pGenPage);

    // role page
    QFrame *newPage = new QFrame();
    pageItem = new KPageWidgetItem( newPage, i18n("Roles"));
    pageItem->setHeader( i18n("Role Settings"));
    pageItem->setIcon( Icon_Utils::DesktopIcon(Icon_Utils::it_Properties_Roles) );
    addPage( pageItem );
    QHBoxLayout * roleLayout = new QHBoxLayout(newPage);
    // newPage->setMinimumSize(310, 330);
    m_pRolePage = new AssocRolePage(umlDoc, newPage, assocWidget);
    roleLayout->addWidget(m_pRolePage);

    setupFontPage();
}
QFrame *makeFrame( const char *text, QWidget *parent )
{
    QFrame* frame = new QFrame(parent);
    QVBoxLayout* layout = new QVBoxLayout(frame);
    layout->setAutoAdd(true);
    new QLabel(text, frame);
    frame->setMinimumSize(200, 200);
    return frame;
}
Example #4
0
PiwigoEdit::PiwigoEdit(QWidget* pParent, Piwigo* pPiwigo, const QString& title)
        : KDialog(pParent, Qt::Dialog)
{
    mpPiwigo = pPiwigo;

    setCaption(title);

    QFrame *page = new QFrame(this);
    QGridLayout* centerLayout = new QGridLayout();
    page->setMinimumSize(500, 200);
    setMainWidget(page);

    mpNameEdit = new KLineEdit(this);
    centerLayout->addWidget(mpNameEdit, 0, 1);

    mpUrlEdit = new KLineEdit(this);
    centerLayout->addWidget(mpUrlEdit, 1, 1);

    mpUsernameEdit = new KLineEdit(this);
    centerLayout->addWidget(mpUsernameEdit, 2, 1);

    mpPasswordEdit = new KLineEdit(this);
    mpPasswordEdit->setEchoMode(KLineEdit::Password);
    centerLayout->addWidget(mpPasswordEdit, 3, 1);

    QLabel* namelabel = new QLabel(this);
    namelabel->setText(i18nc("piwigo login settings", "Name:"));
    centerLayout->addWidget(namelabel, 0, 0);

    QLabel* urlLabel = new QLabel(this);
    urlLabel->setText(i18nc("piwigo login settings", "URL:"));
    centerLayout->addWidget(urlLabel, 1, 0);

    QLabel* usernameLabel = new QLabel(this);
    usernameLabel->setText(i18nc("piwigo login settings", "Username:"));
    centerLayout->addWidget(usernameLabel, 2, 0);

    QLabel* passwdLabel = new QLabel(this);
    passwdLabel->setText(i18nc("piwigo login settings", "Password:"));
    centerLayout->addWidget(passwdLabel, 3, 0);

    //---------------------------------------------

    page->setLayout(centerLayout);

    resize(QSize(300, 150).expandedTo(minimumSizeHint()));

    // setting initial data
    mpNameEdit->setText(pPiwigo->name());
    mpUrlEdit->setText(pPiwigo->url());
    mpUsernameEdit->setText(pPiwigo->username());
    mpPasswordEdit->setText(pPiwigo->password());

    connect(this, SIGNAL( okClicked() ),
            this, SLOT( slotOk() ));
}
Example #5
0
QWidget *QgsListWidgetWrapper::createWidget( QWidget *parent )
{
  if ( isInTable( parent ) )
  {
    // if to be put in a table, draw a border and set a decent size
    QFrame *ret = new QFrame( parent );
    ret->setFrameShape( QFrame::StyledPanel );
    QHBoxLayout *layout = new QHBoxLayout( ret );
    layout->addWidget( new QgsListWidget( field().subType(), ret ) );
    ret->setMinimumSize( QSize( 320, 110 ) );
    return ret;
  }
  else
  {
    return new QgsListWidget( field().subType(), parent );
  }
}
Example #6
0
MainWindow::MainWindow()
{
        tc = QTextCodec::codecForLocale();

	createParamWidget();
	
	
	QTextCodec* tc = QTextCodec::codecForLocale();
	CHECK = false;

	createToolBox();
	
	createActions();
	createMenus();





	QFrame* f = new QFrame;
    f->setFrameStyle( QFrame::Sunken | QFrame::Panel );
    f->setLineWidth( 2 );

	QFrame* f2 = new QFrame;
    f2->setFrameStyle( QFrame::Sunken | QFrame::Panel );
    f2->setLineWidth( 2 );

    c = new GLBox( f, "glbox");

	QHBoxLayout* flayout = new QHBoxLayout(f);
    flayout->setMargin(0);
    flayout->addWidget( c, 0 );

	createSliderWidget();
	createSliderArrowWidget();



	f->resize(1000, 1000);

	f->setMinimumSize(QSize(400, 100));


    scene = new DiagramScene(itemMenu);
	scene->setSceneRect(QRectF(0, 0, 2000, 2000));

    connect(scene, SIGNAL(textInserted(BodyItem *)),
        this, SLOT(textInserted(BodyItem *)));
	
	connect(scene, SIGNAL(actInserted(JointItem *)),
        this, SLOT(actInserted(JointItem *)));

	connect(scene, SIGNAL(senInserted(SensorItem *)),
        this, SLOT(senInserted(SensorItem *)));

	connect(scene, SIGNAL(camInserted(CameraItem *)),
        this, SLOT(camInserted(CameraItem *)));

	connect(scene, SIGNAL(renew()),
        this, SLOT(renew()));
	
	connect(scene, SIGNAL(setRotNum()),
        this, SLOT(setRotNum()));

	connect(scene, SIGNAL(setGeoNum()),
        this, SLOT(setGeoNum()));

	connect(scene, SIGNAL(setSSNum()),
        this, SLOT(setSSNum()));




	createToolbars();

	QHBoxLayout *hlayout = new QHBoxLayout(f2);

    QHBoxLayout *layout = new QHBoxLayout;

	tabWidget = new QTabWidget;
	
	tabWidget->addTab(SliderWidget, tc->toUnicode("パーツ選択ボタン"));
	tabWidget->addTab(SliderArrowWidget, tc->toUnicode("スケール調整(センサ・ジョイントのサイズ)"));
	//QHBoxLayout *layout = new QHBoxLayout;
	//ParamWidget = new QWidget;
	
	//tabWidget->addTab(ParamWidget, tc->toUnicode("パラメータ"));


	layout->addWidget(tabWidget);

    view = new QGraphicsView(scene);
    hlayout->addWidget(view);
	view->setMinimumSize(400, 100);

	layout->addWidget( f2 );

	layout->addWidget( f);
	
	QFrame* f3 = new QFrame;
    f->setFrameStyle( QFrame::Sunken | QFrame::Panel );
    f->setLineWidth( 2 );

	QHBoxLayout *WLayout = new QHBoxLayout(f3);


	RotSlider = new QSlider(Qt::Vertical, this);
    RotSlider->setMaximum(360);
	RotSlider->setValue(180);
    RotSlider->setPageStep(60);
    RotSlider->setTickPosition( QSlider::TicksRight );
	connect( RotSlider, SIGNAL(valueChanged(int)),c,SLOT(setRotation(int)) );



	WLayout->addWidget(RotSlider);
	layout->addWidget( f3);



	

    QWidget *widget = new QWidget;
    widget->setLayout(layout);


    setCentralWidget(widget);
    setWindowTitle(tc->toUnicode("Robot Model Creator"));
    setUnifiedTitleAndToolBarOnMac(true);


	if (RMC::obj)
	{
		if (RMC::obj->getFileName() != "")
		{
			//std::cout << RMC::obj->getFileName() << std::endl;
			loadFile(RMC::obj->getFileName().c_str());
		}
	}
}
Example #7
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent), ui(new Ui::MainWindow),
    logNewMessages(0), logHasErrors(false), showNewLogNumber(true)
{
    ui->setupUi(this);

    setWindowIcon(QIcon(c_icon_app));
    setWindowTitle(c_qtau_name);
    setAcceptDrops(true);
    setContextMenuPolicy(Qt::NoContextMenu);

    //-----------------------------------------

    QLabel *meterLabel = new QLabel(QString("%1/%2") .arg(ns.notesInBar).arg(ns.noteLength), this);
    QLabel *tempoLabel = new QLabel(QString("%1 %2").arg(ns.tempo).arg(tr("bpm")),           this);

    QHBoxLayout *bpmHBL = new QHBoxLayout();
    bpmHBL->setContentsMargins(0,0,0,0);
    bpmHBL->addSpacing(5);
    bpmHBL->addWidget(meterLabel);
    bpmHBL->addWidget(tempoLabel);
    bpmHBL->addSpacing(5);

    QFrame *tempoPanel = new QFrame(this);
    tempoPanel->setMinimumSize(c_piano_min_width, c_meter_min_height);
    tempoPanel->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
    tempoPanel->setContentsMargins(1,0,1,1);
    tempoPanel->setFrameStyle(QFrame::Panel | QFrame::Raised);

    tempoPanel->setLayout(bpmHBL);

    meter = new qtauMeterBar(this);
    meter->setMinimumHeight(c_meter_min_height);
    meter->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum);
    meter->setContentsMargins(0,0,0,0);

    piano = new qtauPiano(ui->centralWidget);
    piano->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Expanding);
    piano->setMinimumSize(c_piano_min_width, c_piano_min_height);
    piano->setContentsMargins(0,0,0,0);

    zoom = new QSlider(Qt::Horizontal, ui->centralWidget);
    zoom->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Preferred);
    zoom->setRange(0, c_zoom_num - 1);
    zoom->setSingleStep(1);
    zoom->setPageStep(1);
    zoom->setValue(cdef_zoom_index);
    zoom->setMinimumWidth(c_piano_min_width);
    zoom->setGeometry(0,0,c_piano_min_width,10);
    zoom->setContentsMargins(0,0,0,0);

    noteEditor = new qtauNoteEditor(ui->centralWidget);
    noteEditor->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    noteEditor->setContentsMargins(0,0,0,0);

    hscr = new QScrollBar(Qt::Horizontal, ui->centralWidget);
    vscr = new QScrollBar(Qt::Vertical,   ui->centralWidget);

    hscr->setContentsMargins(0,0,0,0);
    vscr->setContentsMargins(0,0,0,0);
    hscr->setRange(0, ns.note.width() * ns.notesInBar * cdef_bars);
    vscr->setRange(0, ns.note.height() * 12 * ns.numOctaves);
    hscr->setSingleStep(ns.note.width());
    vscr->setSingleStep(ns.note.height());
    hscr->setContextMenuPolicy(Qt::NoContextMenu);
    vscr->setContextMenuPolicy(Qt::NoContextMenu);

    //---- vocal and music waveform panels, hidden until synthesized (vocal wave) and/or loaded (music wave)

    QScrollBar *dummySB = new QScrollBar(this);
    dummySB->setOrientation(Qt::Vertical);
    dummySB->setRange(0,0);
    dummySB->setEnabled(false);

    QFrame *vocalControls = new QFrame(this);
    vocalControls->setContentsMargins(0,0,0,0);
    vocalControls->setMinimumSize(c_piano_min_width, c_waveform_min_height);
    vocalControls->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Expanding);
    vocalControls->setFrameStyle(QFrame::Panel | QFrame::Raised);

    vocalWave = new qtauWaveform(this);
    vocalWave->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum);
    vocalWave->setMinimumHeight(c_waveform_min_height);
    vocalWave->setContentsMargins(0,0,0,0);

    QHBoxLayout *vocalWaveL = new QHBoxLayout();
    vocalWaveL->setContentsMargins(0,0,0,0);
    vocalWaveL->setSpacing(0);
    vocalWaveL->addWidget(vocalControls);
    vocalWaveL->addWidget(vocalWave);
    vocalWaveL->addWidget(dummySB);

    vocalWavePanel = new QWidget(this);
    vocalWavePanel->setContentsMargins(0,0,0,0);
    vocalWavePanel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum);

    vocalWavePanel->setLayout(vocalWaveL);
    vocalWavePanel->setVisible(false);

    //---------

    QScrollBar *dummySB2 = new QScrollBar(this);
    dummySB2->setOrientation(Qt::Vertical);
    dummySB2->setRange(0,0);
    dummySB2->setEnabled(false);

    QFrame *musicControls = new QFrame(this);
    musicControls->setContentsMargins(0,0,0,0);
    musicControls->setMinimumSize(c_piano_min_width, c_waveform_min_height);
    musicControls->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Expanding);
    musicControls->setFrameStyle(QFrame::Panel | QFrame::Raised);

    musicWave = new qtauWaveform(this);
    musicWave->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum);
    musicWave->setMinimumHeight(c_waveform_min_height);
    musicWave->setContentsMargins(0,0,0,0);

    QHBoxLayout *musicWaveL = new QHBoxLayout();
    musicWaveL->setContentsMargins(0,0,0,0);
    musicWaveL->setSpacing(0);
    musicWaveL->addWidget(musicControls);
    musicWaveL->addWidget(musicWave);
    musicWaveL->addWidget(dummySB2);

    musicWavePanel = new QWidget(this);
    musicWavePanel->setContentsMargins(0,0,0,0);
    musicWavePanel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum);

    musicWavePanel->setLayout(musicWaveL);
    musicWavePanel->setVisible(false);

    //---- notes' dynamics setup area --------------

    QGridLayout *dynBtnL = new QGridLayout();

    QString btnNames[c_dynbuttons_num] = {"VEL", "DYN", "BRE", "BRI", "CLE", "OPE", "GEN", "POR", "PIT", "PBS"};

    for (int i = 0; i < c_dynbuttons_num; ++i)
    {
        qtauDynLabel *l = new qtauDynLabel(btnNames[i], this);
        l->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
        dynBtnL->addWidget(l, i / 2, i % 2, 1, 1);

        l->setStyleSheet(c_dynlbl_css_off);
        l->setFrameStyle(QFrame::Box);
        l->setLineWidth(1);

        connect(l, SIGNAL(leftClicked()),  SLOT(dynBtnLClicked()));
        connect(l, SIGNAL(rightClicked()), SLOT(dynBtnRClicked()));
    }

    dynBtnL->setRowStretch(c_dynbuttons_num / 2, 100);

    QFrame *dynBtnPanel = new QFrame(this);
    dynBtnPanel->setContentsMargins(0,0,0,0);
    dynBtnPanel->setMinimumSize(c_piano_min_width, c_drawzone_min_height);
    dynBtnPanel->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Expanding);
    dynBtnPanel->setFrameStyle(QFrame::Panel | QFrame::Raised);

    dynBtnPanel->setLayout(dynBtnL);

    drawZone = new qtauDynDrawer(ui->centralWidget);
    drawZone->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum);
    drawZone->setMinimumHeight(c_drawzone_min_height);
    drawZone->setContentsMargins(0,0,0,0);

    QScrollBar *dummySB3 = new QScrollBar(this);
    dummySB3->setOrientation(Qt::Vertical);
    dummySB3->setRange(0,0);
    dummySB3->setEnabled(false);

    QHBoxLayout *singParamsL = new QHBoxLayout();
    singParamsL->setContentsMargins(0,0,0,0);
    singParamsL->setSpacing(0);
    singParamsL->addWidget(dynBtnPanel);
    singParamsL->addWidget(drawZone);
    singParamsL->addWidget(dummySB3);

    drawZonePanel = new QWidget(this);
    drawZonePanel->setContentsMargins(0,0,0,0);
    drawZonePanel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum);

    drawZonePanel->setLayout(singParamsL);

    //---- Combining editor panels into hi-level layout ------

    QGridLayout *gl = new QGridLayout();
    gl->setContentsMargins(0,0,0,0);
    gl->setSpacing(0);

    gl->addWidget(tempoPanel, 0, 0, 1, 1);
    gl->addWidget(meter,      0, 1, 1, 1);
    gl->addWidget(piano,      1, 0, 1, 1);
    gl->addWidget(zoom,       2, 0, 1, 1);
    gl->addWidget(noteEditor, 1, 1, 1, 1);
    gl->addWidget(hscr,       2, 1, 1, 1);
    gl->addWidget(vscr,       1, 2, 1, 1);

    QWidget *editorUpperPanel = new QWidget(this);
    editorUpperPanel->setContentsMargins(0,0,0,0);
    editorUpperPanel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    editorUpperPanel->setMaximumSize(9000,9000);

    editorUpperPanel->setLayout(gl);

    editorSplitter = new QSplitter(Qt::Vertical, this);
    editorSplitter->setContentsMargins(0,0,0,0);
    editorSplitter->addWidget(editorUpperPanel);
    editorSplitter->addWidget(vocalWavePanel);
    editorSplitter->addWidget(musicWavePanel);
    editorSplitter->addWidget(drawZonePanel);
    editorSplitter->setStretchFactor(0, 1);
    editorSplitter->setStretchFactor(1, 0);
    editorSplitter->setStretchFactor(2, 0);
    editorSplitter->setStretchFactor(3, 0);

    QVBoxLayout *edVBL = new QVBoxLayout();
    edVBL->setContentsMargins(0,0,0,0);
    edVBL->addWidget(editorSplitter);

    QWidget *editorPanel = new QWidget(this);
    editorPanel->setContentsMargins(0,0,0,0);
    editorPanel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    editorPanel->setMaximumSize(9000,9000);

    editorPanel->setLayout(edVBL);

    //---- Voicebank setup tab ---------------------

    QWidget *voicesPanel = new QWidget(this);
    voicesPanel->setContentsMargins(0,0,0,0);
    voicesPanel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    voicesPanel->setMaximumSize(9000,9000);

    //---- Plugins setup tab -----------------------

    QWidget *pluginsPanel = new QWidget(this);
    pluginsPanel->setContentsMargins(0,0,0,0);
    pluginsPanel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    pluginsPanel->setMaximumSize(9000,9000);

    //---- Settings tab ----------------------------

    QWidget *settingsPanel = new QWidget(this);
    settingsPanel->setContentsMargins(0,0,0,0);
    settingsPanel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    settingsPanel->setMaximumSize(9000,9000);

    //---- Documentation tab -----------------------

    QWidget *docsPanel = new QWidget(this);
    docsPanel->setContentsMargins(0,0,0,0);
    docsPanel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    docsPanel->setMaximumSize(9000,9000);

    QTextEdit *docpad = new QTextEdit(this);
    docpad->setReadOnly(true);
    docpad->setUndoRedoEnabled(false);
    docpad->setContextMenuPolicy(Qt::NoContextMenu);

    QFile embeddedDocTxt(c_doc_txt);

    if (embeddedDocTxt.open(QFile::ReadOnly))
    {
        QTextStream ts(&embeddedDocTxt);
        ts.setAutoDetectUnicode(true);
        ts.setCodec("UTF-8");

        docpad->setText(ts.readAll());
        embeddedDocTxt.close();
    }

    QGridLayout *docL = new QGridLayout();
    docL->setContentsMargins(0,0,0,0);
    docL->addWidget(docpad, 0, 0, 1, 1);

    docsPanel->setLayout(docL);

    //---- Log tab ---------------------------------

    QWidget *logPanel = new QWidget(this);
    logPanel->setContentsMargins(0,0,0,0);
    logPanel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    logPanel->setMaximumSize(9000,9000);

    logpad = new QTextEdit(this);
    logpad->setReadOnly(true);
    logpad->setUndoRedoEnabled(false);
    logpad->setContextMenuPolicy(Qt::NoContextMenu);
    logpad->setStyleSheet("p, pre { white-space: 1.2; }");

    QGridLayout *logL = new QGridLayout();
    logL->setContentsMargins(0,0,0,0);
    logL->addWidget(logpad, 0, 0, 1, 1);

    logPanel->setLayout(logL);

    //---- Combining tabs togeter ------------------

    tabs = new QTabWidget(this);
    tabs->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    tabs->setContentsMargins(0,0,0,0);
    tabs->setMaximumSize(9000, 9000);
    tabs->setTabPosition(QTabWidget::South);
    tabs->setMovable(false); // just to be sure

    tabs->addTab(editorPanel,   QIcon(c_icon_editor),   tr("Editor"));
    tabs->addTab(voicesPanel,   QIcon(c_icon_voices),   tr("Voices"));
    tabs->addTab(pluginsPanel,  QIcon(c_icon_plugins),  tr("Plugins"));
    tabs->addTab(settingsPanel, QIcon(c_icon_settings), tr("Settings"));
    tabs->addTab(docsPanel,     QIcon(c_icon_doc),      tr("Documentation"));
    tabs->addTab(logPanel,      QIcon(c_icon_log),      tr("Log"));

    tabs->widget(0)->setContentsMargins(0,0,0,0);
    tabs->widget(1)->setContentsMargins(0,0,0,0);
    tabs->widget(2)->setContentsMargins(0,0,0,0);
    tabs->widget(3)->setContentsMargins(0,0,0,0);
    tabs->widget(4)->setContentsMargins(0,0,0,0);
    tabs->widget(5)->setContentsMargins(0,0,0,0);

    logTabTextColor = tabs->tabBar()->tabTextColor(5);

    connect(tabs, SIGNAL(currentChanged(int)), SLOT(onTabSelected(int)));

    QVBoxLayout *vbl = new QVBoxLayout();
    vbl->setContentsMargins(0,0,0,0);
    vbl->addWidget(tabs);
    ui->centralWidget->setContentsMargins(0,0,0,0);
    ui->centralWidget->setLayout(vbl);

    //---- Toolbars --------------------------------

    QToolBar *fileTB   = new QToolBar("Fileops",  this);
    QToolBar *playerTB = new QToolBar("Playback", this);
    QToolBar *toolsTB  = new QToolBar("Toolset",  this);

    fileTB  ->setFloatable(false);
    playerTB->setFloatable(false);
    toolsTB ->setFloatable(false);

    fileTB->addAction(ui->actionSave);
    fileTB->addAction(ui->actionSave_audio_as);
    fileTB->addAction(ui->actionUndo);
    fileTB->addAction(ui->actionRedo);

    playerTB->addAction(ui->actionPlay);
    playerTB->addAction(ui->actionStop);
    playerTB->addAction(ui->actionBack);
    playerTB->addAction(ui->actionRepeat);

    volume = new QSlider(Qt::Horizontal, this);
    volume->setMaximum(100);
    volume->setSingleStep(1);
    volume->setPageStep(1);
    volume->setValue(settings.value(c_key_sound, 50).toInt());
    volume->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
    connect(playerTB, SIGNAL(orientationChanged(Qt::Orientation)), volume, SLOT(setOrientation(Qt::Orientation)));

    muteBtn = new QAction(QIcon(c_icon_sound), "", this);
    muteBtn->setCheckable(true);
    connect(muteBtn, SIGNAL(toggled(bool)), SLOT(onMute(bool)));

    playerTB->addWidget(volume);
    playerTB->addAction(muteBtn);

    QComboBox *quantizeCombo = new QComboBox(this);
    QComboBox *lengthCombo   = new QComboBox(this);
    quantizeCombo->addItems(QStringList() << "Q/4" << "Q/8" << "Q/16" << "Q/32" << "Q/64");
    lengthCombo  ->addItems(QStringList() << "♪/4" << "♪/8" << "♪/16" << "♪/32" << "♪/64");
    quantizeCombo->setCurrentIndex(3);
    lengthCombo  ->setCurrentIndex(3);

    toolsTB->addAction(ui->actionEdit_Mode);
    toolsTB->addAction(ui->actionGrid_Snap);
    toolsTB->addSeparator();
    toolsTB->addWidget(quantizeCombo);
    toolsTB->addWidget(lengthCombo);

    addToolBar(fileTB);
    addToolBar(playerTB);
    addToolBar(toolsTB);

    toolbars.append(fileTB);
    toolbars.append(playerTB);
    toolbars.append(toolsTB);

    //----------------------------------------------
    connect(quantizeCombo, SIGNAL(currentIndexChanged(int)), SLOT(onQuantizeSelected(int)));
    connect(lengthCombo,   SIGNAL(currentIndexChanged(int)), SLOT(onNotelengthSelected(int)));

    connect(vsLog::instance(), &vsLog::message,             this, &MainWindow::onLog);

    connect(piano,      &qtauPiano      ::heightChanged,    this, &MainWindow::onPianoHeightChanged);
    connect(noteEditor, &qtauNoteEditor ::widthChanged,     this, &MainWindow::onNoteEditorWidthChanged);

    connect(meter,      &qtauMeterBar   ::scrolled,         this, &MainWindow::notesHScrolled);
    connect(piano,      &qtauPiano      ::scrolled,         this, &MainWindow::notesVScrolled);
    connect(drawZone,   &qtauDynDrawer  ::scrolled,         this, &MainWindow::notesHScrolled);
    connect(noteEditor, &qtauNoteEditor ::vscrolled,        this, &MainWindow::notesVScrolled);
    connect(noteEditor, &qtauNoteEditor ::hscrolled,        this, &MainWindow::notesHScrolled);
    connect(vocalWave,  &qtauWaveform   ::scrolled,         this, &MainWindow::notesHScrolled);
    connect(musicWave,  &qtauWaveform   ::scrolled,         this, &MainWindow::notesHScrolled);
    connect(vscr,       &QScrollBar     ::valueChanged,     this, &MainWindow::vertScrolled);
    connect(hscr,       &QScrollBar     ::valueChanged,     this, &MainWindow::horzScrolled);

    connect(noteEditor, &qtauNoteEditor ::rmbScrolled,      this, &MainWindow::onEditorRMBScrolled);
    connect(noteEditor, &qtauNoteEditor ::requestsOffset,   this, &MainWindow::onEditorRequestOffset);

    connect(zoom,       &QSlider        ::valueChanged,     this, &MainWindow::onZoomed);
    connect(meter,      &qtauMeterBar   ::zoomed,           this, &MainWindow::onEditorZoomed);
    connect(noteEditor, &qtauNoteEditor ::zoomed,           this, &MainWindow::onEditorZoomed);
    connect(drawZone,   &qtauDynDrawer  ::zoomed,           this, &MainWindow::onEditorZoomed);
    connect(vocalWave,  &qtauWaveform   ::zoomed,           this, &MainWindow::onEditorZoomed);
    connect(musicWave,  &qtauWaveform   ::zoomed,           this, &MainWindow::onEditorZoomed);

    connect(ui->actionQuit,      &QAction::triggered, [=]() { this->close(); });
    connect(ui->actionOpen,      &QAction::triggered, this, &MainWindow::onOpenUST);
    connect(ui->actionSave,      &QAction::triggered, this, &MainWindow::onSaveUST);
    connect(ui->actionSave_as,   &QAction::triggered, this, &MainWindow::onSaveUSTAs);

    connect(ui->actionUndo,      &QAction::triggered, this, &MainWindow::onUndo);
    connect(ui->actionRedo,      &QAction::triggered, this, &MainWindow::onRedo);
    connect(ui->actionDelete,    &QAction::triggered, this, &MainWindow::onDelete);

    connect(ui->actionEdit_Mode, &QAction::triggered, this, &MainWindow::onEditMode);
    connect(ui->actionGrid_Snap, &QAction::triggered, this, &MainWindow::onGridSnap);

    connect(ui->actionSave_audio_as, &QAction::triggered, this, &MainWindow::onSaveAudioAs);

    //----------------------------------------------

    lastScoreDir     = settings.value(c_key_dir_score,   "").toString();
    lastAudioDir     = settings.value(c_key_dir_audio,   "").toString();
    audioExt         = settings.value(c_key_audio_codec, "").toString();
    showNewLogNumber = settings.value(c_key_show_lognum, true).toBool();

    if (!settings.value(c_key_dynpanel_on, true).toBool())
    {
        QList<int> panelSizes = editorSplitter->sizes();
        panelSizes.last() = 0;
        editorSplitter->setSizes(panelSizes);
    }

    if (settings.value(c_key_win_max, false).toBool())
        showMaximized();
    else
    {
        QRect winGeom = geometry();
        QRect setGeom = settings.value(c_key_win_size, QRect(winGeom.topLeft(), minimumSize())).value<QRect>();

        if (setGeom.width() >= winGeom.width() && setGeom.height() >= setGeom.height())
            setGeometry(setGeom);
    }

    //----------------------------------------------

    vsLog::instance()->enableHistory(false);
    onLog(QString("\t%1 %2 @ %3").arg(tr("Launching QTau")).arg(c_qtau_ver).arg(__DATE__), ELog::success);

    onLog("\t---------------------------------------------", ELog::info);
    vsLog::r(); // print stored messages from program startup
    onLog("\t---------------------------------------------", ELog::info);
    vsLog::n();
}
Example #8
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;
}
Example #9
0
GalleryEdit::GalleryEdit(QWidget* const pParent, Gallery* const pGallery, const QString& title)
    : KDialog(pParent, Qt::Dialog), d(new Private())
{
    d->gallery = pGallery;

    setCaption(title);

    QFrame *page = new QFrame(this);
    QGridLayout* centerLayout = new QGridLayout();
    page->setMinimumSize(500, 200);
    setMainWidget(page);

    d->nameEdit = new KLineEdit(this);
    centerLayout->addWidget(d->nameEdit, 0, 1);

    d->urlEdit = new KLineEdit(this);
    centerLayout->addWidget(d->urlEdit, 1, 1);

    d->usernameEdit = new KLineEdit(this);
    centerLayout->addWidget(d->usernameEdit, 2, 1);

    d->passwordEdit = new KLineEdit(this);
    d->passwordEdit->setEchoMode(KLineEdit::Password);
    centerLayout->addWidget(d->passwordEdit, 3, 1);

    QLabel* namelabel = new QLabel(this);
    namelabel->setText(i18nc("gallery login settings", "Name:"));
    centerLayout->addWidget(namelabel, 0, 0);

    QLabel* urlLabel = new QLabel(this);
    urlLabel->setText(i18nc("gallery login settings", "URL:"));
    centerLayout->addWidget(urlLabel, 1, 0);

    QLabel* usernameLabel = new QLabel(this);
    usernameLabel->setText(i18nc("gallery login settings", "Username:"));
    centerLayout->addWidget(usernameLabel, 2, 0);

    QLabel* passwdLabel = new QLabel(this);
    passwdLabel->setText(i18nc("gallery login settings", "Password:"));
    centerLayout->addWidget(passwdLabel, 3, 0);

    //---------------------------------------------

    d->galleryVersion = new QCheckBox(i18n("Use &Gallery 2"), this);
    d->galleryVersion->setChecked(2 == pGallery->version());
    centerLayout->addWidget(d->galleryVersion, 4, 1);

    //---------------------------------------------

    page->setLayout(centerLayout);

    resize(QSize(300, 150).expandedTo(minimumSizeHint()));

    // setting initial data
    d->nameEdit->setText(pGallery->name());
    d->urlEdit->setText(pGallery->url());
    d->usernameEdit->setText(pGallery->username());
    d->passwordEdit->setText(pGallery->password());

    connect(this, SIGNAL(okClicked()), 
            this, SLOT(slotOk()));
}
Example #10
0
CSystemDSN::CSystemDSN( QWidget* parent, const char* name )
	: QWidget( parent, name )
{
	QVBoxLayout	*playoutTop		= new QVBoxLayout( this, 5 );
	
    QHBoxLayout	*playoutMain	= new QHBoxLayout( playoutTop );

	pDSNList = new CDSNList( this, "pDSNList" );
	pDSNList->setGeometry( 10, 10, 270, 190 );
	pDSNList->setMinimumSize( 50, 50 );
	pDSNList->setMaximumSize( 32767, 32767 );

    playoutMain->addWidget( pDSNList, 10 );

	QVBoxLayout	*playoutButtons	= new QVBoxLayout( playoutMain, 5 );

	pbAdd = new QPushButton( this, "pbAdd" );
	pbAdd->setGeometry( 290, 10, 100, 30 );
	pbAdd->setMinimumSize( 0, 0 );
	pbAdd->setMaximumSize( 32767, 32767 );
#ifdef QT_V4LAYOUT
	pbAdd->setFocusPolicy( Qt::TabFocus );
	pbAdd->setBackgroundMode( Qt::PaletteBackground );
#else
	pbAdd->setFocusPolicy( QWidget::TabFocus );
	pbAdd->setBackgroundMode( QWidget::PaletteBackground );
#endif
	pbAdd->setText( "A&dd..." );
	pbAdd->setAutoRepeat( FALSE );
#ifndef QT_V4LAYOUT
	pbAdd->setAutoResize( FALSE );
#endif

    playoutButtons->addWidget( pbAdd );

	pbRemove = new QPushButton( this, "pbRemove" );
	pbRemove->setGeometry( 290, 50, 100, 30 );
	pbRemove->setMinimumSize( 0, 0 );
	pbRemove->setMaximumSize( 32767, 32767 );
#ifdef QT_V4LAYOUT
	pbRemove->setFocusPolicy( Qt::TabFocus );
	pbRemove->setBackgroundMode( Qt::PaletteBackground );
#else
	pbRemove->setFocusPolicy( QWidget::TabFocus );
	pbRemove->setBackgroundMode( QWidget::PaletteBackground );
#endif
	pbRemove->setText( "&Remove" );
	pbRemove->setAutoRepeat( FALSE );
#ifndef QT_V4LAYOUT
	pbRemove->setAutoResize( FALSE );
#endif

    playoutButtons->addWidget( pbRemove );

	pbConfigure = new QPushButton( this, "pbConfigure" );
	pbConfigure->setGeometry( 290, 90, 100, 30 );
	pbConfigure->setMinimumSize( 0, 0 );
	pbConfigure->setMaximumSize( 32767, 32767 );
#ifdef QT_V4LAYOUT
	pbConfigure->setFocusPolicy( Qt::TabFocus );
	pbConfigure->setBackgroundMode( Qt::PaletteBackground );
#else
	pbConfigure->setFocusPolicy( QWidget::TabFocus );
	pbConfigure->setBackgroundMode( QWidget::PaletteBackground );
#endif
	pbConfigure->setText( "&Configure..." );
	pbConfigure->setAutoRepeat( FALSE );
#ifndef QT_V4LAYOUT
	pbConfigure->setAutoResize( FALSE );
#endif

    playoutButtons->addWidget( pbConfigure );

    playoutButtons->addStretch( 10 );

	QFrame *pframe;
	pframe = new QFrame( this, "Frame_2" );
	pframe->setGeometry( 10, 210, 380, 80 );
	pframe->setMinimumSize( 0, 0 );
	pframe->setMaximumSize( 32767, 32767 );
	pframe->setFrameStyle( QFrame::Box | QFrame::Raised );

    playoutTop->addWidget( pframe );
    QGridLayout *playoutHelp = new QGridLayout( pframe, 1, 2, 5 );

	QLabel* plabel1;
	plabel1 = new QLabel( pframe, "Label_1" );
	plabel1->setMinimumSize( 32, 32 );
//	plabel1->setMaximumSize( 32, 32 );
	plabel1->setPixmap( xpmDSN_System );

	QLabel* plabel2;
	plabel2 = new QLabel( pframe, "Label_2" );
	plabel2->setMinimumSize( 0, 0 );
	plabel2->setMaximumSize( 32767, 32767 );
	plabel2->setText( "System data sources are shared among all users of this machine. These data sources may also be used by system services. Only the administrator can configure system data sources." );
#ifdef QT_V4LAYOUT
	plabel2->setAlignment( Qt::AlignLeft | Qt::WordBreak );
	plabel2->setWordWrap( true );
#else
	plabel2->setAlignment( AlignLeft | WordBreak );
#endif

	playoutHelp->addWidget( plabel1, 0, 0 );
    playoutHelp->addWidget( plabel2, 0, 1 );
    playoutHelp->setColStretch( 1, 10 );

    pDSNList->Load( ODBC_SYSTEM_DSN );

	connect( pbAdd, SIGNAL(clicked()), pDSNList, SLOT(Add()) );
	connect( pbRemove, SIGNAL(clicked()), pDSNList, SLOT(Delete()) );
	connect( pbConfigure, SIGNAL(clicked()), pDSNList, SLOT(Edit()) );
#ifdef QT_V4LAYOUT
    connect( pDSNList, SIGNAL(doubleClicked( Q3ListViewItem * )), pDSNList, SLOT(DoubleClick( Q3ListViewItem * )));
#else
    connect( pDSNList, SIGNAL(doubleClicked( QListViewItem * )), pDSNList, SLOT(DoubleClick( QListViewItem * )));
#endif
}
    void setupUi(QMainWindow *MainWindow)
    {
        if (MainWindow->objectName().isEmpty())
            MainWindow->setObjectName(QString::fromUtf8("MainWindow"));
        MainWindow->resize(999, 913);
        actionAbout = new QAction(MainWindow);
        actionAbout->setObjectName(QString::fromUtf8("actionAbout"));
        actionAtlas = new QAction(MainWindow);
        actionAtlas->setObjectName(QString::fromUtf8("actionAtlas"));
        actionMapping = new QAction(MainWindow);
        actionMapping->setObjectName(QString::fromUtf8("actionMapping"));
        actionLibrary = new QAction(MainWindow);
        actionLibrary->setObjectName(QString::fromUtf8("actionLibrary"));
        actionToolbox = new QAction(MainWindow);
        actionToolbox->setObjectName(QString::fromUtf8("actionToolbox"));
        centralwidget = new QWidget(MainWindow);
        centralwidget->setObjectName(QString::fromUtf8("centralwidget"));
        gridLayout = new QGridLayout(centralwidget);
        gridLayout->setObjectName(QString::fromUtf8("gridLayout"));
        mainSizer = new QGridLayout();
        mainSizer->setObjectName(QString::fromUtf8("mainSizer"));
        mainSizer->setVerticalSpacing(14);
        mainSizer->setContentsMargins(0, -1, -1, -1);
        renderFrame = new QFrame(centralwidget);
        renderFrame->setObjectName(QString::fromUtf8("renderFrame"));
        renderFrame->setMinimumSize(QSize(800, 600));
        renderFrame->setFrameShape(QFrame::Box);
        renderFrame->setFrameShadow(QFrame::Raised);

        mainSizer->addWidget(renderFrame, 0, 0, 1, 1);


        gridLayout->addLayout(mainSizer, 0, 0, 1, 1);

        MainWindow->setCentralWidget(centralwidget);
        menubar = new QMenuBar(MainWindow);
        menubar->setObjectName(QString::fromUtf8("menubar"));
        menubar->setGeometry(QRect(0, 0, 999, 21));
        menuFile = new QMenu(menubar);
        menuFile->setObjectName(QString::fromUtf8("menuFile"));
        menuTools = new QMenu(menubar);
        menuTools->setObjectName(QString::fromUtf8("menuTools"));
        menuAbout = new QMenu(menubar);
        menuAbout->setObjectName(QString::fromUtf8("menuAbout"));
        menuWindows = new QMenu(menubar);
        menuWindows->setObjectName(QString::fromUtf8("menuWindows"));
        MainWindow->setMenuBar(menubar);
        statusbar = new QStatusBar(MainWindow);
        statusbar->setObjectName(QString::fromUtf8("statusbar"));
        MainWindow->setStatusBar(statusbar);

        menubar->addAction(menuFile->menuAction());
        menubar->addAction(menuTools->menuAction());
        menubar->addAction(menuWindows->menuAction());
        menubar->addAction(menuAbout->menuAction());
        menuTools->addAction(actionAtlas);
        menuTools->addAction(actionMapping);
        menuAbout->addAction(actionAbout);
        menuWindows->addAction(actionLibrary);
        menuWindows->addAction(actionToolbox);

        retranslateUi(MainWindow);

        QMetaObject::connectSlotsByName(MainWindow);
    } // setupUi
Example #12
0
ParStore::ParStore(GlobStore *p_globStore, const QString &name,
            QAction *p_muteOutAction,
            QAction *p_deferChangesAction,
            QWidget* parent):
                QWidget(parent), globStore(p_globStore)
{
    // when temp.empty is true, restoring from that set is ignored
    temp.empty = false;
    temp.muteOut = false;
    temp.res = 1;
    temp.size = 0;
    temp.loopMode = 0;
    temp.waveForm = 0;
    temp.portOut = 0;
    temp.channelOut = 0;
    temp.chIn = 0;
    temp.wave.clear();
    temp.muteMask.clear();
    /* LFO Modules */
    temp.ccnumber = -1;
    temp.ccnumberIn = 0;
    temp.freq = 0;
    temp.ampl = 0;
    temp.offs = 0;
    /* Seq Modules */
    temp.loopMarker = 0;
    temp.notelen = 0;
    temp.vel = 0;
    temp.transp = 0;
    temp.dispVertical = 0;
    /* Arp Modules */
    temp.indexIn0 = 0;
    temp.indexIn1 = 0;
    temp.rangeIn0 = 0;
    temp.rangeIn1 = 0;
    temp.attack = 0;
    temp.release = 0;
    temp.repeatMode = 0;
    temp.rndTick = 0;
    temp.rndLen = 0;
    temp.rndVel = 0;
    temp.pattern = "";
    list.clear();

    ndc = new Indicator(14, name.at(0), this);

    topButton = new QToolButton(this);
    topButton->setFont(QFont("Helvetica", 8));
    topButton->setText(name);
    topButton->setMinimumSize(QSize(75, 10));

    muteOutAction = p_muteOutAction;
    muteOut = new QToolButton(this);
    muteOut->setDefaultAction(muteOutAction);
    muteOut->setFont(QFont("Helvetica", 8));
    muteOut->setMinimumSize(QSize(10, 10));

    deferChangesAction = p_deferChangesAction;
    deferChanges = new QToolButton(this);
    deferChanges->setDefaultAction(deferChangesAction);
    deferChanges->setFont(QFont("Helvetica", 8));
    deferChanges->setMinimumSize(QSize(10, 10));

    QHBoxLayout *muteRowLayout = new QHBoxLayout;
    muteRowLayout->addStretch();
    muteRowLayout->addWidget(muteOut);
    muteRowLayout->addWidget(deferChanges);
    muteRowLayout->setMargin(0);
    muteRowLayout->setSpacing(0);

    QVBoxLayout *controlLayout = new QVBoxLayout;
    controlLayout->addWidget(topButton);
    controlLayout->addLayout(muteRowLayout);
    controlLayout->setMargin(0);
    controlLayout->setSpacing(0);

    QWidget *indicatorBox = new QWidget(this);
    QHBoxLayout *indicatorLayout = new QHBoxLayout;
    indicatorBox->setMinimumHeight(20);
    indicatorBox->setMinimumWidth(25);
    indicatorLayout->addWidget(ndc);
    indicatorLayout->setMargin(2);
    indicatorLayout->setSpacing(1);
    indicatorBox->setLayout(indicatorLayout);

    QFrame *topRow = new QFrame(this);
    QHBoxLayout *topRowLayout = new QHBoxLayout;
    topRowLayout->addWidget(indicatorBox);
    topRowLayout->addLayout(controlLayout);
    topRowLayout->setSpacing(0);
    topRowLayout->setMargin(0);
    topRow->setMinimumSize(QSize(48,46));;
    topRow->setFrameStyle(QFrame::StyledPanel);
    topRow->setLayout(topRowLayout);

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

    locContextMenu = new QMenu(this);

    QAction *storeHereAction = new QAction(tr("&Store here"), this);
    storeHereAction->setProperty("index", list.count());
    storeHereAction->setIcon(QIcon(filesave_xpm));
    locContextMenu->addAction(storeHereAction);
    connect(storeHereAction, SIGNAL(triggered()), this, SLOT(mapStoreSignal()));

    QAction *onlyPatternAction = new QAction(tr("&Act on pattern only"), this);
    onlyPatternAction->setProperty("index", list.count());
    onlyPatternAction->setCheckable(true);
    locContextMenu->addAction(onlyPatternAction);
    connect(onlyPatternAction, SIGNAL(toggled(bool)), this, SLOT(updateOnlyPattern(bool)));

    jumpToIndexMenu = new QMenu(tr("When finished"), this);

    jumpToGroup = new QActionGroup(this);
    connect(jumpToGroup, SIGNAL(triggered(QAction *))
             , this, SLOT(mapJumpToGroup(QAction *)));

    jumpToIndexMenu->addAction(new QAction(tr("Stay here"), this));
    jumpToIndexMenu->actions().last()->setProperty("index", -2);
    jumpToIndexMenu->actions().last()->setActionGroup(jumpToGroup);
    jumpToIndexMenu->actions().last()->setCheckable(true);
    jumpToIndexMenu->actions().last()->setChecked(true);

    jumpToIndexMenu->addAction(new QAction(tr("Jump back"), this));
    jumpToIndexMenu->actions().last()->setProperty("index", -1);
    jumpToIndexMenu->actions().last()->setActionGroup(jumpToGroup);
    jumpToIndexMenu->actions().last()->setCheckable(true);

    jumpToIndexMenu->addSeparator()->setText(tr("Jump to:"));

    locContextMenu->addMenu(jumpToIndexMenu);

    for (int l1 = 0; l1 < list.size() - 1; l1++) addLocation();

    QVBoxLayout *columnLayout = new QVBoxLayout;
    columnLayout->addLayout(buttonLayout);
    columnLayout->addStretch();
    columnLayout->setMargin(0);
    columnLayout->setSpacing(0);
    setLayout(columnLayout);

    globStore->indivButtonLayout->addWidget(this);


    restoreRequest = -1;
    oldRestoreRequest = 0;
    restoreRunOnce = false;
    activeStore = 0;
    currentRequest = 0;
    dispReqIx = 0;
    dispReqSelected = 0;
    needsGUIUpdate = false;
}
Example #13
0
TaskSheet::TaskSheet(TasksViewer *owner) : QScrollArea(owner) {
  QFrame *contentWidget = new QFrame(this);
  contentWidget->setMinimumWidth(300);
  contentWidget->setMinimumHeight(400);

  setWidget(contentWidget);
  setWidgetResizable(true);

  m_task   = 0;
  int row  = 0;
  m_viewer = owner;

  QGridLayout *layout = new QGridLayout(contentWidget);
  layout->setMargin(15);
  layout->setSpacing(8);
  layout->setColumnStretch(3, 1);
  layout->setColumnStretch(5, 1);
  layout->setColumnStretch(6, 4);
  layout->setColumnMinimumWidth(2, 70);
  layout->setColumnMinimumWidth(3, 70);
  layout->setColumnMinimumWidth(4, 40);
  layout->setColumnMinimumWidth(5, 100);
  contentWidget->setLayout(layout);
  ::create(m_name, layout, tr("Name:"), row++);
  ::create(m_status, layout, tr("Status:"), row++);
  ::create(m_commandLine, layout, tr("Command Line:"), row++);
  ::create(m_server, layout, tr("Server:"), row++);
  ::create(m_submittedBy, layout, tr("Submitted By:"), row++);
  ::create(m_submittedOn, layout, tr("Submitted On:"), row++);
  ::create(m_submitDate, layout, tr("Submission Date:"), row++);
  ::create(m_startDate, layout, tr("Start Date:"), row++);
  ::create(m_complDate, layout, tr("Completion Date:"), row++);
  ::create(m_duration, layout, tr("Duration:"), row++);
  // m_duration->setMaximumWidth(38);
  ::create(m_stepCount, layout, tr("Step Count:"), row++);
  // m_stepCount->setMaximumWidth(38);
  ::create(m_failedSteps, layout, tr("Failed Steps:"), row++);
  // m_failedSteps->setMaximumWidth(38);
  ::create(m_succSteps, layout, tr("Successful Steps:"), row++);
  // m_succSteps->setMaximumWidth(38);
  ::create(m_priority, layout, tr("Priority:"), row++);
  // m_priority->setMaximumWidth(40);

  layout->setColumnStretch(0, 0);
  layout->setColumnStretch(1, 0);
  layout->setColumnStretch(2, 1);
  layout->setColumnStretch(3, 1);
  layout->setColumnStretch(4, 1);
  layout->setColumnStretch(5, 1);

  int row1 = 0;

  m_boxComposer = new QFrame(contentWidget);
  m_boxComposer->setMinimumHeight(150);
  QGridLayout *layout1 = new QGridLayout(m_boxComposer);
  layout1->setMargin(0);
  layout1->setSpacing(8);
  m_boxComposer->setLayout(layout1);
  ::create(m_outputPath, layout1, tr("Output:"), row1++, 4);

  ::create(m_chunkSize, m_multimedia, layout1, tr("Frames per Chunk:"),
           tr("Multimedia:"), Qt::AlignRight | Qt::AlignTop,
           Qt::AlignLeft | Qt::AlignTop, row1++);
  ::create(m_from, m_to, layout1, tr("From:"), tr("To:"),
           Qt::AlignRight | Qt::AlignTop, Qt::AlignRight | Qt::AlignTop,
           row1++);
  ::create(m_step, m_shrink, layout1, tr("Step:"), tr("Shrink:"),
           Qt::AlignRight | Qt::AlignTop, Qt::AlignRight | Qt::AlignTop,
           row1++);

  layout1->setColumnMinimumWidth(2, 40);
  QStringList multimediaTypes;
  multimediaTypes << tr("None") << tr("Fx Schematic Flows")
                  << tr("Fx Schematic Terminal Nodes");
  m_multimedia->addItems(multimediaTypes);

  ::create(m_threadsCombo, layout1, tr("Dedicated CPUs:"), row1++, 3);
  QStringList threadsTypes;
  threadsTypes << tr("Single") << tr("Half") << tr("All");
  m_threadsCombo->addItems(threadsTypes);

  ::create(m_rasterGranularityCombo, layout1, tr("Render Tile:"), row1++, 3);
  QStringList granularityTypes;
  granularityTypes << tr("None") << tr("Large") << tr("Medium") << tr("Small");
  m_rasterGranularityCombo->addItems(granularityTypes);

  layout1->addWidget(new QWidget(), 0, 5);

  layout1->setColumnStretch(0, 0);
  layout1->setColumnStretch(1, 0);
  layout1->setColumnStretch(2, 0);
  layout1->setColumnStretch(3, 0);
  layout1->setColumnStretch(4, 0);
  layout1->setColumnStretch(5, 1);

  layout->addWidget(m_boxComposer, row++, 0, 1,
                    6 /*, Qt::AlignLeft|Qt::AlignTop*/);

  // tcleanupper Box
  m_boxCleanup         = new QFrame(contentWidget);
  QGridLayout *layout2 = new QGridLayout(m_boxCleanup);
  layout2->setMargin(0);
  layout2->setSpacing(8);
  m_boxCleanup->setLayout(layout2);
  ::create(m_visible, layout2, tr("Visible Only"), 0);
  ::create(m_overwrite, layout2, tr("Overwrite"), 1, 1);

  QStringList overwriteOptions;
  overwriteOptions << tr("All") << tr("NoPaint") << tr("Off");
  m_overwrite->addItems(overwriteOptions);
  m_overwrite->setCurrentIndex(2);  // do not overwrite by default

  layout2->setColumnStretch(0, 0);
  layout2->setColumnStretch(1, 0);
  layout2->setColumnStretch(2, 1);

  layout->addWidget(m_boxCleanup, row++, 2, 1, 1, Qt::AlignLeft | Qt::AlignTop);

  QLabel *label = new QLabel(tr("Dependencies:"), contentWidget);
  label->setObjectName("TaskSheetItemLabel");
  layout->addWidget(label, row, 0, 1, 2, Qt::AlignRight | Qt::AlignTop);

  m_addedBox = new QListWidget(contentWidget);
  m_addedBox->setSelectionMode(QAbstractItemView::ExtendedSelection);
  m_addedBox->setObjectName("tasksRemoveBox");
  m_addedBox->setFrameStyle(QFrame::StyledPanel);
  layout->addWidget(m_addedBox, row, 2, 1, 2, Qt::AlignLeft | Qt::AlignTop);

  m_notAddedBox = new QListWidget(contentWidget);
  m_notAddedBox->setSelectionMode(QAbstractItemView::ExtendedSelection);
  m_notAddedBox->setObjectName("tasksAddBox");
  m_notAddedBox->setFrameStyle(QFrame::StyledPanel);
  layout->addWidget(m_notAddedBox, row++, 4, 1, 2,
                    Qt::AlignLeft | Qt::AlignTop);

  QPushButton *removeBtn = new QPushButton(tr("Remove >>"));
  layout->addWidget(removeBtn, row, 2, 1, 2, Qt::AlignRight | Qt::AlignTop);

  QPushButton *addBtn = new QPushButton(tr("<< Add"));
  layout->addWidget(addBtn, row++, 4, 1, 2, Qt::AlignLeft | Qt::AlignTop);

  bool ret = true;

  ret =
      ret && connect(m_name, SIGNAL(editingFinished()), this, SLOT(setName()));
  ret =
      ret && connect(m_from, SIGNAL(editingFinished()), this, SLOT(setFrom()));
  ret = ret && connect(m_to, SIGNAL(editingFinished()), this, SLOT(setTo()));
  ret =
      ret && connect(m_step, SIGNAL(editingFinished()), this, SLOT(setStep()));
  ret = ret &&
        connect(m_shrink, SIGNAL(editingFinished()), this, SLOT(setShrink()));
  ret = ret && connect(m_outputPath, SIGNAL(editingFinished()), this,
                       SLOT(setOutput()));
  ret = ret && connect(m_chunkSize, SIGNAL(editingFinished()), this,
                       SLOT(setChunkSize()));
  ret = ret && connect(m_priority, SIGNAL(editingFinished()), this,
                       SLOT(setPriority()));

  ret = ret && connect(m_name, SIGNAL(focusIn()), this, SLOT(onFocusIn()));
  ret = ret && connect(m_from, SIGNAL(focusIn()), this, SLOT(onFocusIn()));
  ret = ret && connect(m_to, SIGNAL(focusIn()), this, SLOT(onFocusIn()));
  ret = ret && connect(m_step, SIGNAL(focusIn()), this, SLOT(onFocusIn()));
  ret = ret && connect(m_shrink, SIGNAL(focusIn()), this, SLOT(onFocusIn()));
  ret =
      ret && connect(m_outputPath, SIGNAL(focusIn()), this, SLOT(onFocusIn()));
  ret = ret && connect(m_chunkSize, SIGNAL(focusIn()), this, SLOT(onFocusIn()));
  ret = ret && connect(m_priority, SIGNAL(focusIn()), this, SLOT(onFocusIn()));

  ret = ret && connect(m_multimedia, SIGNAL(currentIndexChanged(int)), this,
                       SLOT(setMultimedia(int)));
  ret = ret && connect(m_visible, SIGNAL(stateChanged(int)), this,
                       SLOT(setVisible(int)));

  ret = ret && connect(m_overwrite, SIGNAL(currentIndexChanged(int)), this,
                       SLOT(setOverwrite(int)));

  ret =
      ret && connect(m_addedBox, SIGNAL(itemDoubleClicked(QListWidgetItem *)),
                     this, SLOT(onRemovedItemDoubleClicked(QListWidgetItem *)));
  ret = ret &&
        connect(m_notAddedBox, SIGNAL(itemDoubleClicked(QListWidgetItem *)),
                this, SLOT(onAddedItemDoubleClicked(QListWidgetItem *)));

  ret = ret &&
        connect(removeBtn, SIGNAL(clicked(bool)), this, SLOT(onRemoved(bool)));
  ret =
      ret && connect(addBtn, SIGNAL(clicked(bool)), this, SLOT(onAdded(bool)));

  ret = ret && connect(m_threadsCombo, SIGNAL(currentIndexChanged(int)), this,
                       SLOT(setThreadsCombo(int)));
  ret =
      ret && connect(m_rasterGranularityCombo, SIGNAL(currentIndexChanged(int)),
                     this, SLOT(setGranularityCombo(int)));

  assert(ret);

  // The following instruction is needed in order to prevent contentWidget from
  // shrinking
  // beyond the tolerable size for its grid layout.
  contentWidget->setMinimumSize(layout->minimumSize());

  widget()->hide();
}