コード例 #1
0
TrackDashboard::TrackDashboard()
{   
    nam = new WsAccessManager( this );
    
    ui.papyrus = new QWidget( this );    
    ui.cover = new PrettyCoverWidget;
    ui.cover->setParent( ui.papyrus );
    
    connect( ui.cover, SIGNAL( clicked()), SLOT( onCoverClicked()));
    
    setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding );
    
    ui.info = new QWidget( ui.papyrus );
    QVBoxLayout* v = new QVBoxLayout( ui.info );
    
    v->addWidget( ui.bio = new BioWebView );

    v->addSpacing( 10 );
    v->addWidget( new QLabel( tr( HEADING "Tags") ) );
    v->addSpacing( 3 );
    v->addWidget( ui.tags = new ListView );
    ((ListView*)ui.tags)->setSeedType( Seed::TagType );
    v->addSpacing( 10 );
    v->addWidget( new QLabel( tr( HEADING "Similar Artists") ) );
    v->addSpacing( 3 );
    v->addWidget( ui.similarArtists = new ListView );
    ((ListView*)ui.similarArtists)->setSeedType( Seed::ArtistType );
    v->setMargin( 0 );
    v->setSpacing( 0 );

    ui.bio->page()->mainFrame()->setScrollBarPolicy( Qt::Vertical, Qt::ScrollBarAlwaysOff );
    ui.bio->page()->mainFrame()->setScrollBarPolicy( Qt::Horizontal, Qt::ScrollBarAlwaysOff );
    ui.bio->page()->setLinkDelegationPolicy( QWebPage::DelegateExternalLinks );
    ui.bio->setAutoFillBackground( true );
    connect( ui.bio, SIGNAL(linkClicked( const QUrl& )), SLOT(openExternally( const QUrl& )) );

    ui.scrollbar = new FadingScrollBar( this );
    ui.scrollbar->setVisible( false );
    connect( ui.scrollbar, SIGNAL(valueChanged( int )), SLOT(setPapyrusPosition( int )) );

#ifndef Q_WS_MAC
    // mac has finer grained scrolling, and acceleration
    ui.scrollbar->setSingleStep( 9 );
#endif

    UnicornWidget::paintItBlack( this );
    UnicornWidget::paintItBlack( ui.bio );
    setAutoFillBackground( true );

    QPalette p = palette();
    QColor c( 0x0e, 0x0e, 0x0e );
    p.setColor( QPalette::Window, c );
    p.setColor( QPalette::Base, Qt::transparent );
    p.setColor( QPalette::Text, Qt::white );
    setPalette( p );
    p.setColor( QPalette::Text, QColor( 0xa3, 0xa5, 0xa8 ) );
    ui.bio->setPalette( p );

	ui.spinner = new SpinnerLabel( this );
    ui.spinner->move( 10, 10 );

    clear();

    setAttribute( Qt::WA_MacNoClickThrough );
    
    ui.sources = new QPushButton( AuthenticatedUser().name(), this );
}
コード例 #2
0
ファイル: tab_replays.cpp プロジェクト: Aurenos/Cockatrice
TabReplays::TabReplays(TabSupervisor *_tabSupervisor, AbstractClient *_client)
    : Tab(_tabSupervisor), client(_client)
{
    localDirModel = new QFileSystemModel(this);
    localDirModel->setRootPath(settingsCache->getReplaysPath());
    localDirModel->sort(0, Qt::AscendingOrder);
    
    localDirView = new QTreeView;
    localDirView->setModel(localDirModel);
    localDirView->setColumnHidden(1, true);
    localDirView->setRootIndex(localDirModel->index(localDirModel->rootPath(), 0));
    localDirView->setSortingEnabled(true);
#if QT_VERSION < 0x050000
    localDirView->header()->setResizeMode(QHeaderView::ResizeToContents);
#else
    localDirView->header()->setSectionResizeMode(QHeaderView::ResizeToContents);
#endif
    localDirView->header()->setSortIndicator(0, Qt::AscendingOrder);
    
    leftToolBar = new QToolBar;
    leftToolBar->setOrientation(Qt::Horizontal);
    leftToolBar->setIconSize(QSize(32, 32));
    QHBoxLayout *leftToolBarLayout = new QHBoxLayout;
    leftToolBarLayout->addStretch();
    leftToolBarLayout->addWidget(leftToolBar);
    leftToolBarLayout->addStretch();

    QVBoxLayout *leftVbox = new QVBoxLayout;
    leftVbox->addWidget(localDirView);
    leftVbox->addLayout(leftToolBarLayout);
    leftGroupBox = new QGroupBox;
    leftGroupBox->setLayout(leftVbox);
    
    rightToolBar = new QToolBar;
    rightToolBar->setOrientation(Qt::Horizontal);
    rightToolBar->setIconSize(QSize(32, 32));
    QHBoxLayout *rightToolBarLayout = new QHBoxLayout;
    rightToolBarLayout->addStretch();
    rightToolBarLayout->addWidget(rightToolBar);
    rightToolBarLayout->addStretch();

    serverDirView = new RemoteReplayList_TreeWidget(client);

    QVBoxLayout *rightVbox = new QVBoxLayout;
    rightVbox->addWidget(serverDirView);
    rightVbox->addLayout(rightToolBarLayout);
    rightGroupBox = new QGroupBox;
    rightGroupBox->setLayout(rightVbox);
    
    QHBoxLayout *hbox = new QHBoxLayout;
    hbox->addWidget(leftGroupBox);
    hbox->addWidget(rightGroupBox);
    
    aOpenLocalReplay = new QAction(this);
    aOpenLocalReplay->setIcon(QIcon(":/resources/icon_view.svg"));
    connect(aOpenLocalReplay, SIGNAL(triggered()), this, SLOT(actOpenLocalReplay()));
    aDeleteLocalReplay = new QAction(this);
    aDeleteLocalReplay->setIcon(QIcon(":/resources/remove_row.svg"));
    connect(aDeleteLocalReplay, SIGNAL(triggered()), this, SLOT(actDeleteLocalReplay()));
    aOpenRemoteReplay = new QAction(this);
    aOpenRemoteReplay->setIcon(QIcon(":/resources/icon_view.svg"));
    connect(aOpenRemoteReplay, SIGNAL(triggered()), this, SLOT(actOpenRemoteReplay()));
    aDownload = new QAction(this);
    aDownload->setIcon(QIcon(":/resources/arrow_left_green.svg"));
    connect(aDownload, SIGNAL(triggered()), this, SLOT(actDownload()));
    aKeep = new QAction(this);
    aKeep->setIcon(QIcon(":/resources/lock.svg"));
    connect(aKeep, SIGNAL(triggered()), this, SLOT(actKeepRemoteReplay()));
    aDeleteRemoteReplay = new QAction(this);
    aDeleteRemoteReplay->setIcon(QIcon(":/resources/remove_row.svg"));
    connect(aDeleteRemoteReplay, SIGNAL(triggered()), this, SLOT(actDeleteRemoteReplay()));
    
    leftToolBar->addAction(aOpenLocalReplay);
    leftToolBar->addAction(aDeleteLocalReplay);
    rightToolBar->addAction(aOpenRemoteReplay);
    rightToolBar->addAction(aDownload);
    rightToolBar->addAction(aKeep);
    rightToolBar->addAction(aDeleteRemoteReplay);
    
    retranslateUi();
    setLayout(hbox);
    
    connect(client, SIGNAL(replayAddedEventReceived(const Event_ReplayAdded &)), this, SLOT(replayAddedEventReceived(const Event_ReplayAdded &)));
}
コード例 #3
0
AikatauluMuokkaaja::AikatauluMuokkaaja(QWidget *parent) :
    QWidget(parent)
{
    tunnusEdit_ = new QLineEdit(this);
    tunnusEdit_->setPlaceholderText(tr("Junanumero"));

    aikaEdit_ = new QTimeEdit(this);
    aikaEdit_->setDisplayFormat("hh.mm");

    selaaja_ = new AikatauluSelaaja(this);
    selaaja()->zoomOut(4);

    reittiCombo_ = new QComboBox(this);
    reittiCombo_->setMaxVisibleItems(25);
    lataaReitit();

    vaunumaaraSpin_ = new QSpinBox(this);
    vaunumaaraSpin_->setRange(0,50);
    vaunumaaraSpin_->setSuffix(tr(" vaunua"));

    QVBoxLayout* leiskaVasen = new QVBoxLayout();
    leiskaVasen->addWidget(tunnusEdit_);
    leiskaVasen->addWidget(aikaEdit_);
    leiskaVasen->addWidget(reittiCombo_);
    leiskaVasen->addWidget(vaunumaaraSpin_);

    lisaaNappi_ = new QPushButton(QIcon(":/r/pic/lisaa.png"),QString());
    poistaNappi_ = new QPushButton(QIcon(":/r/pic/poista.png"), QString());
    valmisNappi_ = new QPushButton( QIcon(":/r/pic/hyvaksy.png"), QString());
    peruNappi_ = new QPushButton( QIcon(":/r/pic/peru.png"), QString());

    QVBoxLayout* leiskaOikea = new QVBoxLayout();
    leiskaOikea->addWidget(lisaaNappi_);
    leiskaOikea->addWidget(poistaNappi_);
    leiskaOikea->addWidget(valmisNappi_);
    leiskaOikea->addWidget(peruNappi_);

    QHBoxLayout* ylaleiska = new QHBoxLayout;
    ylaleiska->addLayout(leiskaVasen);
    ylaleiska->addLayout(leiskaOikea);

    QVBoxLayout* paaleiska = new QVBoxLayout();
    paaleiska->addLayout(ylaleiska);
    paaleiska->addWidget(selaaja_);
    setLayout(paaleiska);

    connect( selaaja_, SIGNAL(naytetaanJuna(QString)), this, SLOT(valittuJuna(QString)));
    connect( selaaja_, SIGNAL(naytetaanAsema(QString)), this, SLOT(eiValittuaJunaa()));
    connect( aikaEdit_, SIGNAL(timeChanged(QTime)) , this, SLOT(katsoKelpaako()));
    connect( tunnusEdit_, SIGNAL(textChanged(QString)), this, SLOT(katsoKelpaako()));
    connect( reittiCombo_, SIGNAL(currentIndexChanged(QString)), this, SLOT(katsoKelpaako()));
    connect( vaunumaaraSpin_, SIGNAL(valueChanged(int)), this, SLOT(katsoKelpaako()));
    connect( this, SIGNAL(junaPaivitetty(QString)), selaaja_, SLOT(haeJunaAikataulu(QString)));


    connect( lisaaNappi_, SIGNAL(clicked()), this, SLOT(uusiJuna()));
    connect( peruNappi_, SIGNAL(clicked()), this, SLOT(peruMuokkaus()));
    connect( valmisNappi_, SIGNAL(clicked()), this, SLOT(muokkausValmis()));
    connect( poistaNappi_, SIGNAL(clicked()), this, SLOT(poistaJuna()));


    valmisNappi_->setEnabled(false);
    poistaNappi_->setEnabled(false);
}
コード例 #4
0
void RenderWindow::slotChangedComboFractal(int indexInComboBox)
{
  QString comboName = this->sender()->objectName();
  int index = qobject_cast<QComboBox *>(this->sender())->itemData(indexInComboBox).toInt();
  int fractalNumber = comboName.right(1).toInt() - 1;

  QString fullFormulaName = fractalList[index].nameInComboBox;
  if (fractalList[index].internalID > 0)
  {
    QString formulaName = fractalList[index].internalName;
    QString uiFilename = systemData.sharedDir + "qt_data" + QDir::separator() + "fractal_"
        + formulaName + ".ui";

    if (fractalWidgets[fractalNumber]) delete fractalWidgets[fractalNumber];
    fractalWidgets[fractalNumber] = NULL;

    MyUiLoader loader;
    QFile uiFile(uiFilename);

    if (uiFile.exists())
    {
      uiFile.open(QFile::ReadOnly);
      fractalWidgets[fractalNumber] = loader.load(&uiFile);
      QVBoxLayout *layout =
          ui->dockWidget_fractal->findChild<QVBoxLayout*>("verticalLayout_fractal_"
              + QString::number(fractalNumber + 1));
      layout->addWidget(fractalWidgets[fractalNumber]);
      uiFile.close();
      fractalWidgets[fractalNumber]->show();
      gMainInterface->ConnectSignalsForSlidersInWindow(fractalWidgets[fractalNumber]);
      gMainInterface->SynchronizeInterfaceWindow(fractalWidgets[fractalNumber],
                                                 &gParFractal->at(fractalNumber),
                                                 cInterface::write);

      QFrame *frame = ui->tabWidget_fractals->findChild<QFrame*>("frame_iterations_formula_"
          + QString::number(fractalNumber + 1));
      MyCheckBox *caddCheckBoxframe =
          frame->findChild<MyCheckBox*>(QString("checkBox_dont_add_c_constant_")
              + QString::number(fractalNumber + 1));

      switch(fractalList[index].cpixelAddition)
      {
        case fractal::cpixelEnabledByDefault:
          caddCheckBoxframe->setText(QObject::tr("Don't add global C constant"));
          caddCheckBoxframe->setEnabled(true);
          break;

        case fractal::cpixelDisabledByDefault:
        {
          caddCheckBoxframe->setText(QObject::tr("Add global C constant"));
          caddCheckBoxframe->setEnabled(true);
          break;
        }

        case fractal::cpixelAlreadyHas:
        {
          caddCheckBoxframe->setText(QObject::tr("Don't add global C constant"));
          caddCheckBoxframe->setEnabled(false);
          break;
        }
      }

      fractal::enumCPixelAddition cPixelAddition = fractalList[index].cpixelAddition;
      bool boleanState = ui->groupCheck_boolean_operators->isChecked();
      if (cPixelAddition == fractal::cpixelAlreadyHas)
        ui->tabWidget_fractals->findChild<QGroupBox*>("groupBox_c_constant_addition_"
            + QString::number(fractalNumber + 1))->setVisible(false);
      else ui->tabWidget_fractals->findChild<QGroupBox*>("groupBox_c_constant_addition_"
          + QString::number(fractalNumber + 1))->setVisible(boleanState);

      if (fractalList[index].internalID == fractal::kaleidoscopicIFS)
      {
        QWidget *pushButton_preset_dodecahedron =
            fractalWidgets[fractalNumber]->findChild<QWidget*>("pushButton_preset_dodecahedron");
        QApplication::connect(pushButton_preset_dodecahedron,
                              SIGNAL(clicked()),
                              this,
                              SLOT(slotPressedButtonIFSDefaultsDodecahedron()));
        QWidget *pushButton_preset_icosahedron =
            fractalWidgets[fractalNumber]->findChild<QWidget*>("pushButton_preset_icosahedron");
        QApplication::connect(pushButton_preset_icosahedron,
                              SIGNAL(clicked()),
                              this,
                              SLOT(slotPressedButtonIFSDefaultsIcosahedron()));
        QWidget *pushButton_preset_octahedron =
            fractalWidgets[fractalNumber]->findChild<QWidget*>("pushButton_preset_octahedron");
        QApplication::connect(pushButton_preset_octahedron,
                              SIGNAL(clicked()),
                              this,
                              SLOT(slotPressedButtonIFSDefaultsOctahedron()));
        QWidget *pushButton_preset_menger_sponge =
            fractalWidgets[fractalNumber]->findChild<QWidget*>("pushButton_preset_menger_sponge");
        QApplication::connect(pushButton_preset_menger_sponge,
                              SIGNAL(clicked()),
                              this,
                              SLOT(slotPressedButtonIFSDefaultsMengerSponge()));
        QWidget *pushButton_preset_reset =
            fractalWidgets[fractalNumber]->findChild<QWidget*>("pushButton_preset_reset");
        QApplication::connect(pushButton_preset_reset,
                              SIGNAL(clicked()),
                              this,
                              SLOT(slotPressedButtonIFSDefaultsReset()));
      }
    }
    else
    {
      cErrorMessage::showMessage(QString("Can't open file ") + uiFilename
                                     + QString("\nFractal ui file can't be loaded"),
                                 cErrorMessage::errorMessage,
                                 gMainInterface->mainWindow);
    }
  }
  else
  {
    if (fractalWidgets[fractalNumber]) delete fractalWidgets[fractalNumber];
    fractalWidgets[fractalNumber] = NULL;
  }
  ui->tabWidget_fractals->setTabText(fractalNumber, QString("#%1: %2").arg(fractalNumber + 1).arg(fullFormulaName));
  // ui->tabWidget_fractals->setTabIcon(fractalNumber, QIcon(fractalList[index].getIconName()));
}
コード例 #5
0
ファイル: subplot_dlg.cpp プロジェクト: loonuh/Overflows
//-----------------------------------------------------------------------------
SubplotDialog::SubplotDialog(QWidget *parent) : QDialog(parent)
{
	grBuf = 0;
	setWindowTitle(tr("UDAV - Setup inplot"));
	QLabel *l;
	QPushButton *b;
	QVBoxLayout *v = new QVBoxLayout(this), *u;
	QGridLayout *g = new QGridLayout;	v->addLayout(g);
	g->setColumnStretch(2, 1);	g->setColumnStretch(4, 1);
	g->setColumnStretch(6, 1);	g->setColumnStretch(8, 1);
	g->setColumnStretch(10, 1);	g->setAlignment(Qt::AlignTop);
	// SubPlot section
	cb = new QRadioButton("SubPlot",this);	g->addWidget(cb,0,0);
	cb->setToolTip(tr("Set drawing area as cell of matrix nx*ny."));
	connect(cb,SIGNAL(toggled(bool)),this,SLOT(updatePic()));
	l = new QLabel("nx",this);	g->addWidget(l,0,1);
	bn = new QSpinBox(this);	g->addWidget(bn,0,2);
	bn->setMinimum(1);	bn->setToolTip(tr("Horizontal size"));
	connect(bn,SIGNAL(valueChanged(QString)),this,SLOT(updatePic()));
	l = new QLabel("ny",this);	g->addWidget(l,0,3);
	bm = new QSpinBox(this);	g->addWidget(bm,0,4);
	bm->setMinimum(1);	bm->setToolTip(tr("Vertical size"));
	connect(bm,SIGNAL(valueChanged(QString)),this,SLOT(updatePic()));
	l = new QLabel("ind",this);	g->addWidget(l,0,5);
	bk = new QSpinBox(this);	g->addWidget(bk,0,6);
	bk->setMinimum(0);	bk->setToolTip(tr("Cell index"));
	connect(bk,SIGNAL(valueChanged(QString)),this,SLOT(updatePic()));

	// MultiPlot section
	cm = new QRadioButton("MultiPlot",this);	g->addWidget(cm,1,0);
	cm->setToolTip(tr("Set drawing area as cells of matrix nx*ny."));
	connect(cm,SIGNAL(toggled(bool)),this,SLOT(updatePic()));
	l = new QLabel("nx",this);	g->addWidget(l,1,1);
	mn = new QSpinBox(this);	g->addWidget(mn,1,2);
	mn->setMinimum(1);	mn->setToolTip(tr("Horizontal size"));
	connect(mn,SIGNAL(valueChanged(QString)),this,SLOT(updatePic()));
	l = new QLabel("ny",this);	g->addWidget(l,1,3);
	mm = new QSpinBox(this);	g->addWidget(mm,1,4);
	mm->setMinimum(1);	mm->setToolTip(tr("Vertical size"));
	connect(mm,SIGNAL(valueChanged(QString)),this,SLOT(updatePic()));
	l = new QLabel("ind",this);	g->addWidget(l,1,5);
	mk = new QSpinBox(this);	g->addWidget(mk,1,6);
	mk->setMinimum(0);	mk->setToolTip(tr("Starting cell index"));
	connect(mk,SIGNAL(valueChanged(QString)),this,SLOT(updatePic()));
	l = new QLabel("dx",this);	g->addWidget(l,1,7);
	mx = new QSpinBox(this);	g->addWidget(mx,1,8);
	mx->setMinimum(1);	mx->setToolTip(tr("Width of selected cells"));
	connect(mx,SIGNAL(valueChanged(QString)),this,SLOT(updatePic()));
	l = new QLabel("dy",this);	g->addWidget(l,1,9);
	my = new QSpinBox(this);	g->addWidget(my,1,10);
	my->setMinimum(1);	my->setToolTip(tr("Height of selected cells"));
	connect(my,SIGNAL(valueChanged(QString)),this,SLOT(updatePic()));

	// GridPlot section
	cg = new QRadioButton("GridPlot",this);	g->addWidget(cg,2,0);
	cg->setToolTip(tr("Set drawing area as cell of matrix nx*ny."));
	connect(cg,SIGNAL(toggled(bool)),this,SLOT(updatePic()));
	l = new QLabel("nx",this);	g->addWidget(l,2,1);
	gn = new QSpinBox(this);	g->addWidget(gn,2,2);
	gn->setMinimum(1);	gn->setToolTip(tr("Horizontal size"));
	connect(gn,SIGNAL(valueChanged(QString)),this,SLOT(updatePic()));
	l = new QLabel("ny",this);	g->addWidget(l,2,3);
	gm = new QSpinBox(this);	g->addWidget(gm,2,4);
	gm->setMinimum(1);	gm->setToolTip(tr("Vertical size"));
	connect(gm,SIGNAL(valueChanged(QString)),this,SLOT(updatePic()));
	l = new QLabel("ind",this);	g->addWidget(l,2,5);
	gk = new QSpinBox(this);	g->addWidget(gk,2,6);
	gk->setMinimum(0);	gk->setToolTip(tr("Cell index"));
	connect(gk,SIGNAL(valueChanged(QString)),this,SLOT(updatePic()));
	l = new QLabel("d",this);	g->addWidget(l,2,7);
	gd = new QLineEdit(this);	g->addWidget(gd,2,8);
	gd->setToolTip(tr("Distance between cells"));
	connect(gd,SIGNAL(textChanged(QString)),this,SLOT(updatePic()));

	// ColumnPlot section
	cc = new QRadioButton("ColumnPlot",this);	g->addWidget(cc,3,0);
	cc->setToolTip(tr("Set drawing area as cells of column."));
	connect(cc,SIGNAL(toggled(bool)),this,SLOT(updatePic()));
	l = new QLabel("num",this);	g->addWidget(l,3,1);
	cn = new QSpinBox(this);	g->addWidget(cn,3,2);
	cn->setMinimum(1);	cn->setToolTip(tr("Size of column"));
	connect(cn,SIGNAL(valueChanged(QString)),this,SLOT(updatePic()));
	l = new QLabel("ind",this);	g->addWidget(l,3,5);
	ck = new QSpinBox(this);	g->addWidget(ck,3,6);
	ck->setMinimum(0);	ck->setToolTip(tr("Cell index"));
	connect(ck,SIGNAL(valueChanged(QString)),this,SLOT(updatePic()));
	l = new QLabel("d",this);	g->addWidget(l,3,7);
	cd = new QLineEdit(this);	g->addWidget(cd,3,8);
	cd->setToolTip(tr("Distance between cells"));
	connect(cd,SIGNAL(textChanged(QString)),this,SLOT(updatePic()));

	// StickPlot section
	cs = new QRadioButton("StickPlot",this);	g->addWidget(cs,4,0);
	cs->setToolTip(tr("Set drawing area as cells of stick."));
	connect(cc,SIGNAL(toggled(bool)),this,SLOT(updatePic()));
	l = new QLabel("num",this);	g->addWidget(l,4,1);
	sn = new QSpinBox(this);	g->addWidget(sn,4,2);
	sn->setMinimum(1);	sn->setToolTip(tr("Size of stick"));
	connect(sn,SIGNAL(valueChanged(QString)),this,SLOT(updatePic()));
	l = new QLabel("ind",this);	g->addWidget(l,4,5);
	sk = new QSpinBox(this);	g->addWidget(sk,4,6);
	sk->setMinimum(0);	sk->setToolTip(tr("Cell index"));
	connect(sk,SIGNAL(valueChanged(QString)),this,SLOT(updatePic()));

	// InPlot section
	ci = new QRadioButton("InPlot",this);	g->addWidget(ci,5,0);
	ci->setToolTip(tr("Set drawing area as cells of matrix nx*ny."));
	connect(ci,SIGNAL(toggled(bool)),this,SLOT(updatePic()));
	l = new QLabel("x1",this);	g->addWidget(l,5,1);
	x1 = new QLineEdit(this);	g->addWidget(x1,5,2);
	x1->setText("0");	x1->setToolTip(tr("Left bottom edge"));
	connect(x1,SIGNAL(textChanged(QString)),this,SLOT(updatePic()));
	l = new QLabel("x2",this);	g->addWidget(l,5,3);
	x2 = new QLineEdit(this);	g->addWidget(x2,5,4);
	x2->setText("1");	x2->setToolTip(tr("Right bottom edge"));
	connect(x2,SIGNAL(textChanged(QString)),this,SLOT(updatePic()));
	l = new QLabel("y1",this);	g->addWidget(l,5,5);
	y1 = new QLineEdit(this);	g->addWidget(y1,5,6);
	y1->setText("0");	y1->setToolTip(tr("Left top edge"));
	connect(y1,SIGNAL(textChanged(QString)),this,SLOT(updatePic()));
	l = new QLabel("y2",this);	g->addWidget(l,5,7);
	y2 = new QLineEdit(this);	g->addWidget(y2,5,8);
	y2->setText("1");	y2->setToolTip(tr("Right top edge"));
	connect(y2,SIGNAL(textChanged(QString)),this,SLOT(updatePic()));

	QHBoxLayout *h, *H;
	h = new QHBoxLayout;	v->addLayout(h);
	u = new QVBoxLayout;	h->addLayout(u);

	H = new QHBoxLayout;	u->addLayout(H);
	l = new QLabel(tr("Rotate on"),this);	H->addWidget(l);
	l = new QLabel(QString::fromWCharArray(L"θ"),this);	H->addWidget(l);
	tet = new QSpinBox(this);	H->addWidget(tet,1);	tet->setValue(0);	tet->setSingleStep(5);
	tet->setToolTip(tr("Angle around x axis (in degrees)"));
	connect(tet,SIGNAL(valueChanged(QString)),this,SLOT(updatePic()));
	l = new QLabel(QString::fromWCharArray(L"φ"),this);	H->addWidget(l);
	phi = new QSpinBox(this);	H->addWidget(phi,1);	phi->setValue(0);	phi->setSingleStep(5);
	phi->setToolTip(tr("Angle around z axis (in degrees)"));
	connect(phi,SIGNAL(valueChanged(QString)),this,SLOT(updatePic()));

	H = new QHBoxLayout;	u->addLayout(H);
	l = new QLabel(tr("Aspect"),this);	H->addWidget(l);
	l = new QLabel(tr("X/Z"),this);	H->addWidget(l);
	axz = new QLineEdit(this);	H->addWidget(axz);	axz->setText("1");
	axz->setToolTip(tr("Aspect ratio of x-scale to z-acale"));
	connect(axz,SIGNAL(textChanged(QString)),this,SLOT(updatePic()));
	l = new QLabel(tr("Y/Z"),this);	H->addWidget(l);
	ayz = new QLineEdit(this);	H->addWidget(ayz);	ayz->setText("1");
	ayz->setToolTip(tr("Aspect ratio of y-scale to z-acale"));
	connect(ayz,SIGNAL(textChanged(QString)),this,SLOT(updatePic()));

	H = new QHBoxLayout;	u->addLayout(H);
	l = new QLabel(tr("Reserve at"),this);	H->addWidget(l);
	rl = new QCheckBox(tr("left"),this);	H->addWidget(rl);	rl->setChecked(true);
	rl->setToolTip(tr("Reserve space for labels at left side (style '<')"));
	rb = new QCheckBox(tr("bottom"),this);	H->addWidget(rb);	rb->setChecked(true);
	rb->setToolTip(tr("Reserve space for labels at bottom side (style '_')"));
	rt = new QCheckBox(tr("top"),this);		H->addWidget(rt);	rt->setChecked(true);
	rt->setToolTip(tr("Reserve space for labels at top side (style '^')"));
	rr = new QCheckBox(tr("right"),this);	H->addWidget(rr);	rr->setChecked(true);
	rr->setToolTip(tr("Reserve space for labels at right side (style '>')"));
	rw = new QCheckBox(tr("Whole area"),this);	H->addWidget(rw);
	rw->setToolTip(tr("Set to use whole area (style '#')"));
	connect(rl,SIGNAL(toggled(bool)),this,SLOT(updatePic()));
	connect(rr,SIGNAL(toggled(bool)),this,SLOT(updatePic()));
	connect(rt,SIGNAL(toggled(bool)),this,SLOT(updatePic()));
	connect(rb,SIGNAL(toggled(bool)),this,SLOT(updatePic()));
	connect(rw,SIGNAL(toggled(bool)),this,SLOT(updatePic()));

	H = new QHBoxLayout;	u->addLayout(H);
	l = new QLabel(tr("Title"),this);	H->addWidget(l);
	title = new QLineEdit(this);		H->addWidget(title);
	title->setToolTip(tr("Title for plot. Can be used in SubPlot or MultiPlot only."));
	connect(title,SIGNAL(textChanged(QString)),this,SLOT(updatePic()));
	b = new QPushButton(tr("Style"),this);	H->addWidget(b);
	connect(b, SIGNAL(clicked()),this, SLOT(titleStl()));

	H = new QHBoxLayout;	u->addLayout(H);
	l = new QLabel(tr("Result is"),this);	H->addWidget(l);
	res = new QLineEdit(this);		H->addWidget(res);	res->setReadOnly(true);
	res->setToolTip(tr("Resulting string."));

	pic = new QLabel(this);	h->addWidget(pic,1);

	h = new QHBoxLayout;	v->addLayout(h);	h->addStretch(1);
	b = new QPushButton(tr("Cancel"),this);	h->addWidget(b);
	connect(b, SIGNAL(clicked()),this, SLOT(reject()));
	b = new QPushButton(tr("OK"), this);	h->addWidget(b);	b->setDefault(true);
	connect(b, SIGNAL(clicked()),this, SLOT(finish()));
	
	stlDialog = new StyleDialog(this);
}
コード例 #6
0
FileBrowserDialog::FileBrowserDialog(const Account &account, const ServerRepo& repo, const QString &path, QWidget *parent)
    : QDialog(parent),
      account_(account),
      repo_(repo),
      current_path_(path),
      current_readonly_(repo_.readonly)
{
    current_lpath_ = current_path_.split('/');

    data_mgr_ = new DataManager(account_);

    setWindowTitle(tr("Cloud File Browser"));
    setWindowIcon(QIcon(":/images/seafile.png"));
    setWindowFlags((windowFlags() & ~Qt::WindowContextHelpButtonHint & ~Qt::Dialog)
#if !defined(Q_OS_MAC)
                   | Qt::FramelessWindowHint
#endif
#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
                   | Qt::WindowMinimizeButtonHint
#endif
                   | Qt::Window);

    resizer_ = new QSizeGrip(this);
    resizer_->resize(resizer_->sizeHint());
    setAttribute(Qt::WA_TranslucentBackground, true);

    createTitleBar();
    createToolBar();
    createStatusBar();
    createLoadingFailedView();
    createFileTable();

    QWidget* widget = new QWidget;
    widget->setObjectName("mainWidget");
    QVBoxLayout* layout = new QVBoxLayout;
    layout->setContentsMargins(0, 0, 0, 0);
    layout->setSpacing(0);
    setLayout(layout);
    layout->addWidget(widget);

    QVBoxLayout *vlayout = new QVBoxLayout;
    vlayout->setContentsMargins(1, 0, 1, 0);
    vlayout->setSpacing(0);
    widget->setLayout(vlayout);

    stack_ = new QStackedWidget;
    stack_->insertWidget(INDEX_LOADING_VIEW, loading_view_);
    stack_->insertWidget(INDEX_TABLE_VIEW, table_view_);
    stack_->insertWidget(INDEX_LOADING_FAILED_VIEW, loading_failed_view_);
    stack_->setContentsMargins(0, 0, 0, 0);

    vlayout->addWidget(header_);
    vlayout->addWidget(toolbar_);
    vlayout->addWidget(stack_);
    vlayout->addWidget(status_bar_);

#ifdef Q_OS_MAC
    header_->setVisible(false);
#endif

    // this <--> table_view_
    connect(table_view_, SIGNAL(direntClicked(const SeafDirent&)),
            this, SLOT(onDirentClicked(const SeafDirent&)));
    connect(table_view_, SIGNAL(direntSaveAs(const QList<const SeafDirent*>&)),
            this, SLOT(onDirentSaveAs(const QList<const SeafDirent*>&)));
    connect(table_view_, SIGNAL(direntRename(const SeafDirent&)),
            this, SLOT(onGetDirentRename(const SeafDirent&)));
    connect(table_view_, SIGNAL(direntRemove(const SeafDirent&)),
            this, SLOT(onGetDirentRemove(const SeafDirent&)));
    connect(table_view_, SIGNAL(direntRemove(const QList<const SeafDirent*> &)),
            this, SLOT(onGetDirentRemove(const QList<const SeafDirent*> &)));
    connect(table_view_, SIGNAL(direntShare(const SeafDirent&)),
            this, SLOT(onGetDirentShare(const SeafDirent&)));
    connect(table_view_, SIGNAL(direntShareSeafile(const SeafDirent&)),
            this, SLOT(onGetDirentShareSeafile(const SeafDirent&)));
    connect(table_view_, SIGNAL(direntUpdate(const SeafDirent&)),
            this, SLOT(onGetDirentUpdate(const SeafDirent&)));
    connect(table_view_, SIGNAL(direntPaste()),
            this, SLOT(onGetDirentsPaste()));
    connect(table_view_, SIGNAL(cancelDownload(const SeafDirent&)),
            this, SLOT(onCancelDownload(const SeafDirent&)));
    connect(table_view_, SIGNAL(syncSubdirectory(const QString&)),
            this, SLOT(onGetSyncSubdirectory(const QString &)));

    //dirents <--> data_mgr_
    connect(data_mgr_, SIGNAL(getDirentsSuccess(bool, const QList<SeafDirent>&)),
            this, SLOT(onGetDirentsSuccess(bool, const QList<SeafDirent>&)));
    connect(data_mgr_, SIGNAL(getDirentsFailed(const ApiError&)),
            this, SLOT(onGetDirentsFailed(const ApiError&)));

    //create <--> data_mgr_
    connect(data_mgr_, SIGNAL(createDirectorySuccess(const QString&)),
            this, SLOT(onDirectoryCreateSuccess(const QString&)));
    connect(data_mgr_, SIGNAL(createDirectoryFailed(const ApiError&)),
            this, SLOT(onDirectoryCreateFailed(const ApiError&)));

    //rename <--> data_mgr_
    connect(data_mgr_, SIGNAL(renameDirentSuccess(const QString&, const QString&)),
            this, SLOT(onDirentRenameSuccess(const QString&, const QString&)));
    connect(data_mgr_, SIGNAL(renameDirentFailed(const ApiError&)),
            this, SLOT(onDirentRenameFailed(const ApiError&)));

    //remove <--> data_mgr_
    connect(data_mgr_, SIGNAL(removeDirentSuccess(const QString&)),
            this, SLOT(onDirentRemoveSuccess(const QString&)));
    connect(data_mgr_, SIGNAL(removeDirentFailed(const ApiError&)),
            this, SLOT(onDirentRemoveFailed(const ApiError&)));

    //share <--> data_mgr_
    connect(data_mgr_, SIGNAL(shareDirentSuccess(const QString&)),
            this, SLOT(onDirentShareSuccess(const QString&)));
    connect(data_mgr_, SIGNAL(shareDirentFailed(const ApiError&)),
            this, SLOT(onDirentShareFailed(const ApiError&)));

    //copy <--> data_mgr_
    connect(data_mgr_, SIGNAL(copyDirentsSuccess()),
            this, SLOT(onDirentsCopySuccess()));
    connect(data_mgr_, SIGNAL(copyDirentsFailed(const ApiError&)),
            this, SLOT(onDirentsCopyFailed(const ApiError&)));

    //move <--> data_mgr_
    connect(data_mgr_, SIGNAL(moveDirentsSuccess()),
            this, SLOT(onDirentsMoveSuccess()));
    connect(data_mgr_, SIGNAL(moveDirentsFailed(const ApiError&)),
            this, SLOT(onDirentsMoveFailed(const ApiError&)));

    //subrepo <-->data_mgr_
    connect(data_mgr_, SIGNAL(createSubrepoSuccess(const ServerRepo &)),
            this, SLOT(onCreateSubrepoSuccess(const ServerRepo &)));
    connect(data_mgr_, SIGNAL(createSubrepoFailed(const ApiError&)),
            this, SLOT(onCreateSubrepoFailed(const ApiError&)));

    connect(AutoUpdateManager::instance(), SIGNAL(fileUpdated(const QString&, const QString&)),
            this, SLOT(onFileAutoUpdated(const QString&, const QString&)));

    QTimer::singleShot(0, this, SLOT(fetchDirents()));
}
コード例 #7
0
ファイル: BitBlockgui.cpp プロジェクト: Bitblocks/bitblocks
BitBlockGUI::BitBlockGUI(QWidget *parent):
    QMainWindow(parent),
    clientModel(0),
    walletModel(0),
    encryptWalletAction(0),
    changePassphraseAction(0),
    aboutQtAction(0),
    trayIcon(0),
    notificator(0),
    rpcConsole(0)
{
    resize(850, 550);
    setWindowTitle(tr("BitBlock") + " - " + tr("Wallet"));
#ifndef Q_OS_MAC
    qApp->setWindowIcon(QIcon(":icons/BitBlock"));
    setWindowIcon(QIcon(":icons/BitBlock"));
#else
    setUnifiedTitleAndToolBarOnMac(true);
    QApplication::setAttribute(Qt::AA_DontShowIconsInMenus);
#endif
    // Accept D&D of URIs
    setAcceptDrops(true);

    // Create actions for the toolbar, menu bar and tray/dock icon
    createActions();

    // Create application menu bar
    createMenuBar();

    // Create the toolbars
    createToolBars();

    // Create the tray icon (or setup the dock icon)
    createTrayIcon();

    // Create tabs
    overviewPage = new OverviewPage();

    transactionsPage = new QWidget(this);
    QVBoxLayout *vbox = new QVBoxLayout();
    transactionView = new TransactionView(this);
    vbox->addWidget(transactionView);
    transactionsPage->setLayout(vbox);

    addressBookPage = new AddressBookPage(AddressBookPage::ForEditing, AddressBookPage::SendingTab);

    receiveCoinsPage = new AddressBookPage(AddressBookPage::ForEditing, AddressBookPage::ReceivingTab);

    sendCoinsPage = new SendCoinsDialog(this);

    signVerifyMessageDialog = new SignVerifyMessageDialog(this);

    centralWidget = new QStackedWidget(this);
    centralWidget->addWidget(overviewPage);
    centralWidget->addWidget(transactionsPage);
    centralWidget->addWidget(addressBookPage);
    centralWidget->addWidget(receiveCoinsPage);
    centralWidget->addWidget(sendCoinsPage);
    setCentralWidget(centralWidget);

    // Create status bar
    statusBar();

    // Status bar notification icons
    QFrame *frameBlocks = new QFrame();
    frameBlocks->setContentsMargins(0,0,0,0);
    frameBlocks->setMinimumWidth(56);
    frameBlocks->setMaximumWidth(56);
    QHBoxLayout *frameBlocksLayout = new QHBoxLayout(frameBlocks);
    frameBlocksLayout->setContentsMargins(3,0,3,0);
    frameBlocksLayout->setSpacing(3);
    labelEncryptionIcon = new QLabel();
    labelConnectionsIcon = new QLabel();
    labelBlocksIcon = new QLabel();
    frameBlocksLayout->addStretch();
    frameBlocksLayout->addWidget(labelEncryptionIcon);
    frameBlocksLayout->addStretch();
    frameBlocksLayout->addWidget(labelConnectionsIcon);
    frameBlocksLayout->addStretch();
    frameBlocksLayout->addWidget(labelBlocksIcon);
    frameBlocksLayout->addStretch();

    // Progress bar and label for blocks download
    progressBarLabel = new QLabel();
    progressBarLabel->setVisible(false);
    progressBar = new QProgressBar();
    progressBar->setAlignment(Qt::AlignCenter);
    progressBar->setVisible(false);

    // Override style sheet for progress bar for styles that have a segmented progress bar,
    // as they make the text unreadable (workaround for issue #1071)
    // See https://qt-project.org/doc/qt-4.8/gallery.html
    QString curStyle = qApp->style()->metaObject()->className();
    if(curStyle == "QWindowsStyle" || curStyle == "QWindowsXPStyle")
    {
        progressBar->setStyleSheet("QProgressBar { background-color: #e8e8e8; border: 1px solid grey; border-radius: 7px; padding: 1px; text-align: center; } QProgressBar::chunk { background: QLinearGradient(x1: 0, y1: 0, x2: 1, y2: 0, stop: 0 #FF8000, stop: 1 orange); border-radius: 7px; margin: 0px; }");
    }

    statusBar()->addWidget(progressBarLabel);
    statusBar()->addWidget(progressBar);
    statusBar()->addPermanentWidget(frameBlocks);

    syncIconMovie = new QMovie(":/movies/update_spinner", "mng", this);

    // Clicking on a transaction on the overview page simply sends you to transaction history page
    connect(overviewPage, SIGNAL(transactionClicked(QModelIndex)), this, SLOT(gotoHistoryPage()));
    connect(overviewPage, SIGNAL(transactionClicked(QModelIndex)), transactionView, SLOT(focusTransaction(QModelIndex)));

    // Double-clicking on a transaction on the transaction history page shows details
    connect(transactionView, SIGNAL(doubleClicked(QModelIndex)), transactionView, SLOT(showDetails()));

    rpcConsole = new RPCConsole(this);
    connect(openRPCConsoleAction, SIGNAL(triggered()), rpcConsole, SLOT(show()));

    // Clicking on "Verify Message" in the address book sends you to the verify message tab
    connect(addressBookPage, SIGNAL(verifyMessage(QString)), this, SLOT(gotoVerifyMessageTab(QString)));
    // Clicking on "Sign Message" in the receive coins page sends you to the sign message tab
    connect(receiveCoinsPage, SIGNAL(signMessage(QString)), this, SLOT(gotoSignMessageTab(QString)));

    gotoOverviewPage();
}
コード例 #8
0
void FenPrincipale::calcul_general() {
	QString html = "<table>\n\t<thead>\n\t\t<tr>\n\t\t\t";
	html += "<td>"+tr("Position")+"</td>";
	html += "<td>"+tr("Équipage")+"</td>";
	html += "<td>"+tr("Points")+"</td>";
	for (int j = 0; j < this->nbManches; ++j) {
		html += "<td>"+tr("M")+QString::number(j+1)+"</td>";
	}
	html += "\n\t\t</tr>\n\t</thead>\n\t<tboby>";
	QTableWidget *table = new QTableWidget();
	table->verticalHeader()->hide();
	table->setSelectionMode(QAbstractItemView::NoSelection);
	table->setColumnCount(3+this->nbManches);
	table->setRowCount(this->nbEquipages);
	table->setColumnWidth(0, 80);
	table->setColumnWidth(1, 200);
	table->setColumnWidth(2, 60);
	int size = 80 + 200 + 60;
	QList<QString> labels;
	labels << tr("Position") << tr("Équipage") << tr("Points");
	for (int j = 0; j < this->nbManches; ++j) {
		labels << tr("M")+QString::number(j+1);
		size += 50;
		table->setColumnWidth(3+j, 50);
	}
	table->setMinimumWidth(size + 20);
	table->setMaximumWidth(size + 20);
	table->setHorizontalHeaderLabels(labels);
	ui->resultatsLayout->insertWidget(0, table);
	for (int i = 0; i < this->nbEquipages; ++i) {
		QList<int> ids;
		Equipage e1;
		for (int k = 0; k < this->nbEquipages; ++k) {
			Equipage e2 = this->equipages[k];
			if (e2.points <= 0) {
				// cet équipage a déjà été affiché
				continue;
			}
			if (ids.isEmpty() || e2.points < e1.points) {
				ids.clear();
				ids.append(k);
				e1 = e2;
			}
			else if (e2.points == e1.points) {
				// égalité de points
				// pour départager les équipages, on confronte leurs meilleures
				// manches (sans celles retirées)
				for (int j = 0; j < e1.pointsTries.size(); ++j) {
					if (e2.pointsTries[j] < e1.pointsTries[j]) {
						ids.clear();
						ids.append(k);
						e1 = e2;
						break;
					}
					else if (e2.pointsTries[j] > e1.pointsTries[j]) {
						break;
					}
					else if (j == e1.pointsTries.size()-1) {
						// égalité des manches
						// pour départager les équipages, on confronte toutes
						// leur manches dans l'ordre en partant de la dernière
						for (int l = 0; l < e1.pointsOrdonnes.size(); ++l) {
							if (e2.pointsOrdonnes[l] < e1.pointsOrdonnes[l]) {
								ids.clear();
								ids.append(k);
								e1 = e2;
								break;
							}
							else if (e2.pointsOrdonnes[l] > e1.pointsOrdonnes[l]) {
								break;
							}
							else if (l == e1.pointsOrdonnes.size()-1) {
								// égalité parfaite
								ids.append(k);
							}
						}
					}
				}
			}
		}
		for (int k = 0; k < ids.size(); ++k) {
			Equipage e = this->equipages[ids[k]];
			// on ajoute le début de la table html
			// on rajoute les manches en parallèle à causes de celles retirées
			QString nomString = "<span class=\"equipage\">"+e.nom+"</span>";
			if (this->typeClmt == CLMT_TEMPS) {
				nomString += "<span class=\"bateau\">"
					+this->bateaux.value(e.rating.toUpper()).serie
					+" ("+QString::number(e.coef)+")</span>";
			}
			html += "\n\t\t<tr>\n\t\t\t<td>"+QString::number(i+1)+"</td>"
				+"<td>"+nomString+"</td>"
				+"<td>"+QString::number(e.points)+"</td>";
			// on ajout l'équipage
			QLabel *pos = new QLabel(QString::number(i+1));
			QWidget *nomWidget = new QWidget();
			QVBoxLayout *nomLayout = new QVBoxLayout();
			QLabel *nom = new QLabel(e.nom);
			nom->setProperty("label", "nom");
			nomLayout->addWidget(nom);
			if (this->typeClmt == CLMT_TEMPS) {
				QLabel *bateau = new QLabel();
				bateau->setText(this->bateaux.value(e.rating.toUpper()).serie
					+" ("+QString::number(e.coef)+")");
				bateau->setProperty("label", "bateau");
				nomLayout->addWidget(bateau);
				table->setRowHeight(i+k, 45);
			}
			nomLayout->setContentsMargins(0, 0, 0, 0);
			nomLayout->setSpacing(0);
			nomWidget->setLayout(nomLayout);
			QLabel *points = new QLabel(QString::number(e.points));
			table->setCellWidget(i+k, 0, pos);
			table->setCellWidget(i+k, 1, nomWidget);
			table->setCellWidget(i+k, 2, points);
			for (int j = 0; j < this->nbManches; ++j) {
				Manche m = e.manches[j];
				QLabel *la = new QLabel();
				if (m.tpsCompense < 0) {
					la->setText(this->get_abr(m.abr));
				}
				else {
					la->setText(QString::number(m.points));
				}
				for (int l = 0; l < e.pointsRetires.size(); ++l) {
					if (e.pointsRetires[l] == m.points) {
						la->setText("("+la->text()+")");
						e.pointsRetires.removeAt(l);
						break;
					}
				}
				html += "<td>"+la->text()+"</td>";
				table->setCellWidget(i+k, j+3, la);
			}
			html += "\n\t\t</tr>";
			this->equipages[ids[k]].points = 0;
		}
		i += ids.size()-1;
	}
	html += "\n\t</tbody>\n</table>";
	this->htmls.prepend(html);
	this->progression(95);
}
コード例 #9
0
REIXSSampleMoveActionEditor::REIXSSampleMoveActionEditor(REIXSSampleMoveActionInfo *info, QWidget *parent) : QFrame(parent) {

	info_ = info;

	// Create GUI:
	fromSample_ = new QRadioButton("Sample on Plate");
	fromPositions_ = new QRadioButton("Defined Position");

	QVBoxLayout* vl = new QVBoxLayout();
	vl->addWidget(fromSample_);
	vl->addWidget(fromPositions_);
	vl->setContentsMargins(0,0,0,0);

	QHBoxLayout* hl = new QHBoxLayout();

	sample_ = new QComboBox();

	x_ = new QDoubleSpinBox();
	x_->setRange(-100, 100);
	x_->setDecimals(2);

	y_ = new QDoubleSpinBox();
	y_->setRange(-100, 100);
	y_->setDecimals(2);

	z_ = new QDoubleSpinBox();
	z_->setRange(-1000, 1000);
	z_->setDecimals(2);

	theta_ = new QDoubleSpinBox();
	theta_->setRange(-360, 360);
	theta_->setDecimals(2);

	hl->addLayout(vl);
	hl->addStretch(0);
	hl->addWidget(sample_);
	hl->addStretch(0);
	hl->addWidget(new QLabel("X:"));
	hl->addWidget(x_);
	hl->addWidget(new QLabel("Y:"));
	hl->addWidget(y_);
	hl->addWidget(new QLabel("Z:"));
	hl->addWidget(z_);
	hl->addWidget(new QLabel("Theta:"));
	hl->addWidget(theta_);


	setLayout(hl);

	// Initialize GUI:

	// Fill the sample choices based on the beamline's _current_ sample plate. This is a dubious choice, and couples this widget to the beamline class.
	AMSamplePlate* samplePlate = REIXSBeamline::bl()->samplePlate();
	for(int i=0, cc=samplePlate->count(); i<cc; ++i) {
		int sampleId = samplePlate->at(i).sampleId();
		AMSample s; s.loadFromDb(AMDatabase::database("user"), sampleId);
		sample_->addItem(s.name(), sampleId);
	}
	if(samplePlate->id() == info_->samplePlateId() && info_->samplePlateId() > 0) {	// If the beamline's current sample plate id matches the samplePlateId() of our action, set the currently-selected sample to match.
		sample_->setCurrentIndex(info_->sampleIndex());
	}

	// Mode 1: move to sample plate / sample:
	if(info_->samplePlateId() > 0) {
		fromSample_->setChecked(true);

		sample_->setEnabled(true);
		x_->setEnabled(false);
		y_->setEnabled(false);
		z_->setEnabled(false);
		theta_->setEnabled(false);
	}
	// Mode 2: move to fixed position:
	else {
		fromPositions_->setChecked(true);
		sample_->setEnabled(false);
		x_->setEnabled(true);
		y_->setEnabled(true);
		z_->setEnabled(true);
		theta_->setEnabled(true);

		x_->setValue(info_->x());
		y_->setValue(info_->y());
		z_->setValue(info_->z());
		theta_->setValue(info_->theta());
	}

	// make connections:
	connect(sample_, SIGNAL(activated(int)), this, SLOT(onSampleActivated(int)));
	connect(fromSample_, SIGNAL(toggled(bool)), this, SLOT(onFromSampleToggled(bool)));

	// connect editing finished for all spin boxes...
	connect(x_, SIGNAL(editingFinished()), this, SLOT(onSpinBoxEditingFinished()));
	connect(y_, SIGNAL(editingFinished()), this, SLOT(onSpinBoxEditingFinished()));
	connect(z_, SIGNAL(editingFinished()), this, SLOT(onSpinBoxEditingFinished()));
	connect(theta_, SIGNAL(editingFinished()), this, SLOT(onSpinBoxEditingFinished()));
}
コード例 #10
0
void SearchTab::createGui()
{
	QVBoxLayout *layout = new QVBoxLayout(this);
	layout->setMargin(2);
	layout->setSpacing(0);

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

	QWidget *queryWidget = new QWidget(Splitter);
	QVBoxLayout *queryLayout = new QVBoxLayout(queryWidget);
	queryLayout->setMargin(3);

	QWidget *queryFormWidget = new QWidget(queryWidget);
	queryLayout->addWidget(queryFormWidget);

	QFormLayout *queryFormLayout = new QFormLayout(queryFormWidget);
	queryFormLayout->setLabelAlignment(Qt::AlignLeft | Qt::AlignHCenter);
	queryFormLayout->setRowWrapPolicy(QFormLayout::WrapAllRows);
	queryFormLayout->setMargin(0);

	Query = new QLineEdit(queryFormWidget);
	Query->setMinimumWidth(200);
	queryFormLayout->addRow(tr("Search for:"), Query);

	connect(Query, SIGNAL(returnPressed()), this, SLOT(performSearch()));

	SearchInChats = new QRadioButton(tr("Chats"), queryFormWidget);
	SearchInChats->setChecked(true);
	SelectChat = m_pluginInjectedFactory->makeInjected<HistoryTalkableComboBox>(queryFormWidget);
	SelectChat->setAllLabel(tr(" - All chats - "));
	SelectChat->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
	queryFormLayout->addRow(SearchInChats, SelectChat);

	SearchInStatuses = new QRadioButton(tr("Statuses"), queryFormWidget);
	SelectStatusBuddy = m_pluginInjectedFactory->makeInjected<HistoryTalkableComboBox>(queryFormWidget);
	SelectStatusBuddy->setAllLabel(tr(" - All buddies - "));
	SelectStatusBuddy->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
	SelectStatusBuddy->setEnabled(false);
	queryFormLayout->addRow(SearchInStatuses, SelectStatusBuddy);

	SearchInSmses = new QRadioButton(tr("Smses"), queryFormWidget);
	SelectSmsRecipient = m_pluginInjectedFactory->makeInjected<HistoryTalkableComboBox>(queryFormWidget);
	SelectSmsRecipient->setAllLabel(tr(" - All recipients - "));
	SelectSmsRecipient->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
	SelectSmsRecipient->setEnabled(false);
	queryFormLayout->addRow(SearchInSmses, SelectSmsRecipient);

	QButtonGroup *kindRadioGroup = new QButtonGroup(queryFormWidget);
	kindRadioGroup->addButton(SearchInChats);
	kindRadioGroup->addButton(SearchInStatuses);
	kindRadioGroup->addButton(SearchInSmses);
	connect(kindRadioGroup, SIGNAL(buttonReleased(QAbstractButton*)),
	        this, SLOT(kindChanged(QAbstractButton*)));

	SearchByDate = new QCheckBox(tr("By date"), queryFormWidget);
	SearchByDate->setCheckState(Qt::Unchecked);

	QWidget *dateWidget = new QWidget(queryFormWidget);

	QHBoxLayout *dateLayout = new QHBoxLayout(dateWidget);

	FromDate = new QDateEdit(dateWidget);
	FromDate->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
	FromDate->setCalendarPopup(true);
	FromDate->setDate(QDate::currentDate().addDays(-7));
	dateLayout->addWidget(FromDate);

	dateLayout->addWidget(new QLabel(tr("to"), dateWidget));

	ToDate = new QDateEdit(dateWidget);
	ToDate->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
	ToDate->setCalendarPopup(true);
	ToDate->setDate(QDate::currentDate());
	dateLayout->addWidget(ToDate);

	connect(FromDate, SIGNAL(dateChanged(QDate)), this, SLOT(fromDateChanged(QDate)));
	connect(ToDate, SIGNAL(dateChanged(QDate)), this, SLOT(toDateChanged(QDate)));
	connect(SearchByDate, SIGNAL(toggled(bool)), dateWidget, SLOT(setEnabled(bool)));

	dateWidget->setEnabled(false);
	queryFormLayout->addRow(SearchByDate, dateWidget);

	QPushButton *searchButton = new QPushButton(tr("Search"), queryFormWidget);
	searchButton->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
	queryFormLayout->addRow(0, searchButton);

	connect(searchButton, SIGNAL(clicked()), this, SLOT(performSearch()));

	TimelineView = m_pluginInjectedFactory->makeInjected<TimelineChatMessagesView>(Splitter);
	TimelineView->setTalkableVisible(true);
	TimelineView->setTitleVisible(true);
	TimelineView->setLengthHeader(tr("Found"));
	connect(TimelineView, SIGNAL(currentDateChanged()), this, SLOT(currentDateChanged()));
	connect(TimelineView, SIGNAL(messagesDisplayed()), this, SLOT(messagesDisplayed()));

	TimelineView->searchBar()->setAutoVisibility(false);
	TimelineView->searchBar()->setSearchWidget(this);
	connect(TimelineView->searchBar(), SIGNAL(clearSearch()), this, SLOT(clearSelect()));

	setFocusProxy(Query);
}
コード例 #11
0
void FenPrincipale::calcul_manches() {
	for (int j = 0;  j < this->nbManches; ++j) {
			// on initialise la table html pour l'export
		QString html = "<table>\n\t<thead>\n\t\t<tr>\n\t\t\t";
		html += "<td>"+tr("Place")+"</td>";
		html += "<td>"+tr("Équipage")+"</td>";
		html += "<td>"+tr("Points")+"</td>";
		if (this->typeClmt == CLMT_TEMPS) {
			html += "<td>"+tr("Temps réel")+"</td><td>"+tr("Temps compensé")+"</td>";
		}
		html += "\n\t\t</tr>\n\t</thead>\n\t<tboby>";
			// on affiche la table qui va contenir les résultats de la manche
		QTableWidget *table = new QTableWidget();
		table->verticalHeader()->hide();
		table->setSelectionMode(QAbstractItemView::NoSelection);
		table->setProperty("table", "manches");
		QList<QString> labels;
		labels << tr("Place") << tr("Équipage") << tr("Points");
		if (this->typeClmt == CLMT_TEMPS) {
			table->setColumnCount(5);
			labels << tr("Temps réel") << tr("Temps compensé");
			table->setMaximumWidth(560 + 20);
			table->setMinimumWidth(560 + 20);
			table->setColumnWidth(3, 120);
			table->setColumnWidth(4, 120);
		}
		else {
			table->setColumnCount(3);
			table->setMaximumWidth(320 + 20);
			table->setMinimumWidth(320 + 20);
		}
		table->setColumnWidth(0, 60);
		table->setColumnWidth(1, 200);
		table->setColumnWidth(2, 60);
		table->setHorizontalHeaderLabels(labels);
		table->setRowCount(this->nbEquipages);
		ui->choisirResultat->insertItem(j+1,
			tr("Résultats de la manche %1").arg(QString::number(j+1)));
		int nbAffiches = 0; // pour savoir à quelle ligne on en est
			// on traite et affiche les équipages
		// on traite chaque manche pour attribuer les points aux équipages
		for (int i = 0; i < this->nbEquipages; ++i) {
			// on recherche tous les équipages non encore traités pour cette
			// manches qui ont un tpsCompense minimal
			int min = 0;
			QList<int> ids;
			for (int k = 0; k < this->nbEquipages; ++k) {
				Manche m = this->equipages[k].manches[j];
				if (m.tpsCompense < 0 || m.points > 0 ) {
					// cet équipage a déjà été traité ou n'a pas de place/temps
					// (DNF, DNS, OCS, ...)
					continue;
				}
				if (m.tpsCompense < min || min == 0) {
					min = m.tpsCompense;
					ids.clear();
					ids.append(k);
				}
				else if (m.tpsCompense == min) {
					ids.append(k);
				}
			}
			if (min == 0) {
				// on n'a pas trouvé d'équipage à traiter (se produit s'il y a
				// des équipages DNS, DNF, OCS, ...)
				break;
			}
			for (int l = 0; l < ids.size(); ++l) {
				double points = (ids.size()-1.0)/2.0+i+1.0;
				this->equipages[ids.at(l)].points += points;
				this->equipages[ids.at(l)].pointsOrdonnes.prepend(points);
				this->equipages[ids.at(l)].pointsTries.append(points);
				this->equipages[ids.at(l)].manches[j].points = points;
				// on affiche ces équipages
				Equipage e = this->equipages[ids.at(l)];
				Manche m = e.manches[j];
				QLabel *place = new QLabel(QString::number(i+1));
				table->setCellWidget(i+l, 0, place);
				QWidget *nomWidget = new QWidget();
				QVBoxLayout *nomLayout = new QVBoxLayout();
				QLabel *nom = new QLabel(e.nom);
				nom->setProperty("label", "nom");
				nomLayout->addWidget(nom);
				if (this->typeClmt == CLMT_TEMPS) {
					QLabel *bateau = new QLabel();
					bateau->setText(this->bateaux.value(e.rating.toUpper()).serie
						+" ("+QString::number(e.coef)+")");
					bateau->setProperty("label", "bateau");
					nomLayout->addWidget(bateau);
					table->setRowHeight(i+l, 45);
				}
				nomLayout->setContentsMargins(0, 0, 0, 0);
				nomLayout->setSpacing(0);
				nomWidget->setLayout(nomLayout);
				table->setCellWidget(i+l, 1, nomWidget);
				QLabel *pointsi = new QLabel(QString::number(m.points));
				table->setCellWidget(i+l, 2, pointsi);
				if (this->typeClmt == CLMT_TEMPS) {
					QLabel *tpsReel = new QLabel(this->formate_tps(m.tpsReel));
					table->setCellWidget(i+l, 3, tpsReel);
					QLabel *tpsCompense = new QLabel(this->formate_tps(qRound(m.tpsCompense)));
					table->setCellWidget(i+l, 4, tpsCompense);
				}
				// on ajoute l'équipage à la table html
				QString nomString = "<span class=\"equipage\">"+e.nom+"</span>";
				if (this->typeClmt == CLMT_TEMPS) {
					nomString += "<span class=\"bateau\">"
						+this->bateaux.value(e.rating.toUpper()).serie
						+" ("+QString::number(e.coef)+")</span>";
				}
				html += "\n\t\t<tr>\n\t\t\t<td>"+QString::number(i+1)+"</td>"
					+"<td>"+nomString+"</td>"
					+"<td>"+QString::number(m.points)+"</td>";
				if (this->typeClmt == CLMT_TEMPS) {
					html += "<td>"+this->formate_tps(m.tpsReel)+"</td>"
						+"<td>"+this->formate_tps(qRound(m.tpsCompense))+"</td>";
				}
				html += "\n\t\t</tr>";
				++nbAffiches;
			}
			i = i+ids.size()-1;
		}
		// on traite les équipages qui n'ont pas de place/temps
		for (int i = 0; i < this->nbEquipages; ++i) {
			if (this->equipages[i].manches[j].tpsCompense < 0) {
				double points = this->nbEquipages+1.0;
				this->equipages[i].points += points;
				this->equipages[i].pointsOrdonnes.prepend(points);
				this->equipages[i].pointsTries.append(points);
				this->equipages[i].manches[j].points = points;
				// on affiche ces équipages
				Equipage e = this->equipages[i];
				Manche m = e.manches[j];
				QString abr = this->get_abr(m.abr);
				QLabel *place = new QLabel(abr);
				table->setCellWidget(nbAffiches, 0, place);
				QWidget *nomWidget = new QWidget();
				QVBoxLayout *nomLayout = new QVBoxLayout();
				QLabel *nom = new QLabel(e.nom);
				nom->setProperty("label", "nom");
				nomLayout->addWidget(nom);
				if (this->typeClmt == CLMT_TEMPS) {
					QLabel *bateau = new QLabel();
					bateau->setText(this->bateaux.value(e.rating.toUpper()).serie
						+" ("+QString::number(e.coef)+")");
					bateau->setProperty("label", "bateau");
					nomLayout->addWidget(bateau);
					table->setRowHeight(nbAffiches, 45);
				}
				nomLayout->setContentsMargins(0, 0, 0, 0);
				nomLayout->setSpacing(0);
				nomWidget->setLayout(nomLayout);
				table->setCellWidget(nbAffiches, 1, nomWidget);
				QLabel *pointsi = new QLabel(QString::number(m.points));
				table->setCellWidget(nbAffiches, 2, pointsi);
				if (this->typeClmt == CLMT_TEMPS) {
					QLabel *tpsReel = new QLabel(abr);
					table->setCellWidget(nbAffiches, 3, tpsReel);
					QLabel *tpsCompense = new QLabel(abr);
					table->setCellWidget(nbAffiches, 4, tpsCompense);
				}
				// on ajoute l'équipage à la table html
				QString nomString = "<span class=\"equipage\">"+e.nom+"</span>";
				if (this->typeClmt == CLMT_TEMPS) {
					nomString += "<span class=\"bateau\">"
						+this->bateaux.value(e.rating.toUpper()).serie
						+" ("+QString::number(e.coef)+")</span>";
				}
				html += "\n\t\t<tr>\n\t\t\t<td>"+abr+"</td><td>"+nomString+"</td>"
					+"<td>"+QString::number(m.points)+"</td>";
				if (this->typeClmt == CLMT_TEMPS) {
					html += "<td>"+abr+"</td><td>"+abr+"</td>";
				}
				html += "\n\t\t</tr>";
				++nbAffiches;
			}
		}
		ui->resultatsLayout->addWidget(table);
		table->hide();
		html += "\n\t</tbody>\n</table>";
		this->htmls.append(html);
		this->progression(5+j*75/this->nbManches);
	}
	// on trie les liste pointsTries
	for (int i = 0; i < this->nbEquipages; ++i) {
		qSort(this->equipages[i].pointsTries);
	}
}
コード例 #12
0
EditACLEntryDialog::EditACLEntryDialog(KACLListView *listView, KACLListViewItem *item, const QStringList &users, const QStringList &groups,
                                       const QStringList &defaultUsers, const QStringList &defaultGroups, int allowedTypes, int allowedDefaultTypes,
                                       bool allowDefaults)
    : KDialogBase(listView, "edit_entry_dialog", true, i18n("Edit ACL Entry"), KDialogBase::Ok | KDialogBase::Cancel, KDialogBase::Ok, false)
    , m_listView(listView)
    , m_item(item)
    , m_users(users)
    , m_groups(groups)
    , m_defaultUsers(defaultUsers)
    , m_defaultGroups(defaultGroups)
    , m_allowedTypes(allowedTypes)
    , m_allowedDefaultTypes(allowedDefaultTypes)
    , m_defaultCB(0)
{
    QWidget *page = new QWidget(this);
    setMainWidget(page);
    QVBoxLayout *mainLayout = new QVBoxLayout(page, 0, spacingHint(), "mainLayout");
    m_buttonGroup = new QVButtonGroup(i18n("Entry Type"), page, "bg");

    if(allowDefaults)
    {
        m_defaultCB = new QCheckBox(i18n("Default for new files in this folder"), page, "defaultCB");
        mainLayout->addWidget(m_defaultCB);
        connect(m_defaultCB, SIGNAL(toggled(bool)), this, SLOT(slotUpdateAllowedUsersAndGroups()));
        connect(m_defaultCB, SIGNAL(toggled(bool)), this, SLOT(slotUpdateAllowedTypes()));
    }

    mainLayout->addWidget(m_buttonGroup);

    QRadioButton *ownerType = new QRadioButton(i18n("Owner"), m_buttonGroup, "ownerType");
    m_buttonGroup->insert(ownerType, KACLListView::User);
    QRadioButton *owningGroupType = new QRadioButton(i18n("Owning Group"), m_buttonGroup, "owningGroupType");
    m_buttonGroup->insert(owningGroupType, KACLListView::Group);
    QRadioButton *othersType = new QRadioButton(i18n("Others"), m_buttonGroup, "othersType");
    m_buttonGroup->insert(othersType, KACLListView::Others);
    QRadioButton *maskType = new QRadioButton(i18n("Mask"), m_buttonGroup, "maskType");
    m_buttonGroup->insert(maskType, KACLListView::Mask);
    QRadioButton *namedUserType = new QRadioButton(i18n("Named User"), m_buttonGroup, "namesUserType");
    m_buttonGroup->insert(namedUserType, KACLListView::NamedUser);
    QRadioButton *namedGroupType = new QRadioButton(i18n("Named Group"), m_buttonGroup, "namedGroupType");
    m_buttonGroup->insert(namedGroupType, KACLListView::NamedGroup);

    connect(m_buttonGroup, SIGNAL(clicked(int)), this, SLOT(slotSelectionChanged(int)));

    m_widgetStack = new QWidgetStack(page);
    mainLayout->addWidget(m_widgetStack);

    QHBox *usersBox = new QHBox(m_widgetStack);
    m_widgetStack->addWidget(usersBox, KACLListView::NamedUser);

    QHBox *groupsBox = new QHBox(m_widgetStack);
    m_widgetStack->addWidget(groupsBox, KACLListView::NamedGroup);

    QLabel *usersLabel = new QLabel(i18n("User: "******"users");
    usersLabel->setBuddy(m_usersCombo);

    QLabel *groupsLabel = new QLabel(i18n("Group: "), groupsBox);
    m_groupsCombo = new QComboBox(false, groupsBox, "groups");
    groupsLabel->setBuddy(m_groupsCombo);

    if(m_item)
    {
        m_buttonGroup->setButton(m_item->type);
        if(m_defaultCB)
            m_defaultCB->setChecked(m_item->isDefault);
        slotUpdateAllowedTypes();
        slotSelectionChanged(m_item->type);
        slotUpdateAllowedUsersAndGroups();
        if(m_item->type == KACLListView::NamedUser)
        {
            m_usersCombo->setCurrentText(m_item->qualifier);
        }
        else if(m_item->type == KACLListView::NamedGroup)
        {
            m_groupsCombo->setCurrentText(m_item->qualifier);
        }
    }
    else
    {
        // new entry, preselect "named user", arguably the most common one
        m_buttonGroup->setButton(KACLListView::NamedUser);
        slotUpdateAllowedTypes();
        slotSelectionChanged(KACLListView::NamedUser);
        slotUpdateAllowedUsersAndGroups();
    }
    incInitialSize(QSize(100, 0));
}
コード例 #13
0
Container::Container(unsigned id, const char *cfg)
{
    m_bInit   = false;
    m_bInSize = false;
    m_bStatusSize = false;
    m_bBarChanged = false;
    m_bReceived = false;
    m_bNoSwitch = false;

    SET_WNDPROC("container")
    setWFlags(WDestructiveClose);
    QFrame *frm = new QFrame(this);
    setCentralWidget(frm);

    connect(CorePlugin::m_plugin, SIGNAL(modeChanged()), this, SLOT(modeChanged()));

    QVBoxLayout *lay = new QVBoxLayout(frm);
    m_wnds = new QWidgetStack(frm);
    m_wnds->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));
    lay->addWidget(m_wnds);

    m_tabSplitter = new Splitter(frm);
    m_tabSplitter->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum));
    m_tabBar = new UserTabBar(m_tabSplitter);
    m_tabBar->setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Expanding));
    m_tabBar->hide();

    m_status = new ContainerStatus(m_tabSplitter);
    lay->addWidget(m_tabSplitter);

    load_data(containerData, &data, cfg);

    bool bPos = true;
    if (cfg == NULL){
        setId(id);
        memcpy(data.barState, CorePlugin::m_plugin->data.containerBar, sizeof(data.barState));
        memcpy(data.geometry, CorePlugin::m_plugin->data.containerGeo, sizeof(data.geometry));
        if ((data.geometry[WIDTH].value == (unsigned long)-1) || (data.geometry[HEIGHT].value == (unsigned long)-1)){
            QWidget *desktop = QApplication::desktop();
            data.geometry[WIDTH].value = desktop->width() / 3;
            data.geometry[HEIGHT].value = desktop->height() / 3;
        }
        bPos = false;
        if ((data.geometry[TOP].value != (unsigned long)-1) || (data.geometry[LEFT].value != (unsigned long)-1)){
            bPos = true;
            QWidgetList  *list = QApplication::topLevelWidgets();
            for (int i = 0; i < 2; i++){
                bool bOK = true;
                QWidgetListIt it(*list);
                QWidget * w;
                while ((w = it.current()) != NULL){
                    if (w == this){
                        ++it;
                        continue;
                    }
                    if (w->inherits("Container")){
                        int dw = w->pos().x() - data.geometry[LEFT].value;
                        int dh = w->pos().y() - data.geometry[TOP].value;
                        if (dw < 0) dw = -dw;
                        if (dh < 0) dh = -dh;
                        if ((dw < 3) && (dh < 3)){
                            int nl = data.geometry[LEFT].value;
                            int nt = data.geometry[TOP].value;
                            nl += 21;
                            nt += 20;
                            QWidget *desktop = QApplication::desktop();
                            if (nl + (int)data.geometry[WIDTH].value > desktop->width())
                                nl = 0;
                            if (nt + (int)data.geometry[WIDTH].value > desktop->width())
                                nt = 0;
                            if ((nl != (int)data.geometry[LEFT].value) && (nt != (int)data.geometry[TOP].value)){
                                data.geometry[LEFT].value = nl;
                                data.geometry[TOP].value  = nt;
                                bOK = false;
                            }
                        }
                    }
                    ++it;
                }
                if (bOK)
                    break;
            }
            delete list;
        }
        setStatusSize(CorePlugin::m_plugin->getContainerStatusSize());
        showBar();
        m_bInit = true;
    }
    m_bInSize = true;
    restoreGeometry(this, data.geometry, bPos, true);
    m_bInSize = false;
    connect(m_tabBar, SIGNAL(selected(int)), this, SLOT(contactSelected(int)));
    connect(this, SIGNAL(toolBarPositionChanged(QToolBar*)), this, SLOT(toolbarChanged(QToolBar*)));
    connect(m_status, SIGNAL(sizeChanged(int)), this, SLOT(statusChanged(int)));

    m_accel = new QAccel(this);
    connect(m_accel, SIGNAL(activated(int)), this, SLOT(accelActivated(int)));
    setupAccel();
}
コード例 #14
0
ファイル: expert.cpp プロジェクト: ceefour/aphrodox
Expert::Expert( QWidget *parent ) : QTabDialog( parent )
{

  m_dependencies = new QDict< QList<IInput> >(257);
  m_dependencies->setAutoDelete(TRUE);
  m_inputWidgets = new QDict< IInput >;
  m_switches = new QDict< QObject >;
  m_changed = FALSE;

  setHelpButton();
  
  QListIterator<ConfigOption> options = Config::instance()->iterator();
  QVBoxLayout *pageLayout = 0;
  QFrame *page = 0;
  ConfigOption *option = 0;
  for (options.toFirst();(option=options.current());++options)
  {
    switch(option->kind())
    {
      case ConfigOption::O_Info:
        {
          if (pageLayout) pageLayout->addStretch(1);
          QScrollView *view = new QScrollView(this);
          view->setVScrollBarMode(QScrollView::Auto);
          view->setHScrollBarMode(QScrollView::AlwaysOff);
          view->setResizePolicy(QScrollView::AutoOneFit);
          page = new QFrame( view->viewport(), option->name() );
          pageLayout = new QVBoxLayout(page);
          pageLayout->setMargin(10);
          view->addChild(page);
          addTab(view,option->name());
          QWhatsThis::add(page, option->docs().simplifyWhiteSpace() );
          QToolTip::add(page, option->docs() );
        }
        break;
      case ConfigOption::O_String:
        {
          ASSERT(page!=0);
          InputString::StringMode sm=InputString::StringFree;
          switch(((ConfigString *)option)->widgetType())
          {
            case ConfigString::String: sm=InputString::StringFree; break;
            case ConfigString::File:   sm=InputString::StringFile; break;
            case ConfigString::Dir:    sm=InputString::StringDir;  break;
          }
          InputString *inputString = new InputString( 
                         option->name(),                        // name
                         page,                                  // widget
                         *((ConfigString *)option)->valueRef(), // variable 
                         sm                                     // type
                       ); 
          pageLayout->addWidget(inputString);
          QWhatsThis::add(inputString, option->docs().simplifyWhiteSpace() );
          QToolTip::add(inputString,option->docs());
          connect(inputString,SIGNAL(changed()),SLOT(changed()));
          m_inputWidgets->insert(option->name(),inputString);
          addDependency(m_switches,option->dependsOn(),option->name());
        }
        break;
      case ConfigOption::O_Enum:
        {
          ASSERT(page!=0);
          InputString *inputString = new InputString( 
                         option->name(),                        // name
                         page,                                  // widget
                         *((ConfigEnum *)option)->valueRef(),   // variable 
                         InputString::StringFixed               // type
                       ); 
          pageLayout->addWidget(inputString);
          QStrListIterator sli=((ConfigEnum *)option)->iterator();
          for (sli.toFirst();sli.current();++sli)
          {
            inputString->addValue(sli.current());
          }
          inputString->init();
          QWhatsThis::add(inputString, option->docs().simplifyWhiteSpace() );
          QToolTip::add(inputString, option->docs());
          connect(inputString,SIGNAL(changed()),SLOT(changed()));
          m_inputWidgets->insert(option->name(),inputString);
          addDependency(m_switches,option->dependsOn(),option->name());
        }
        break;
      case ConfigOption::O_List:
        {
          ASSERT(page!=0);
          InputStrList::ListMode lm=InputStrList::ListString;
          switch(((ConfigList *)option)->widgetType())
          {
            case ConfigList::String:     lm=InputStrList::ListString;  break;
            case ConfigList::File:       lm=InputStrList::ListFile;    break;
            case ConfigList::Dir:        lm=InputStrList::ListDir;     break;
            case ConfigList::FileAndDir: lm=InputStrList::ListFileDir; break;
          }
          InputStrList *inputStrList = new InputStrList(
                          option->name(),                         // name
                          page,                                   // widget
                          *((ConfigList *)option)->valueRef(),    // variable
                          lm                                      // type
                        );
          pageLayout->addWidget(inputStrList);
          QWhatsThis::add(inputStrList, option->docs().simplifyWhiteSpace() );
          QToolTip::add(inputStrList, option->docs());
          connect(inputStrList,SIGNAL(changed()),SLOT(changed()));
          m_inputWidgets->insert(option->name(),inputStrList);
          addDependency(m_switches,option->dependsOn(),option->name());
        }
        break;
        break;
      case ConfigOption::O_Bool:
        {
          ASSERT(page!=0);
          InputBool *inputBool = new InputBool(
                          option->name(),                         // name
                          page,                                   // widget
                          *((ConfigBool *)option)->valueRef()     // variable
                        );
          pageLayout->addWidget(inputBool);
          QWhatsThis::add(inputBool, option->docs().simplifyWhiteSpace() );
          QToolTip::add(inputBool, option->docs() );
          connect(inputBool,SIGNAL(changed()),SLOT(changed()));
          m_inputWidgets->insert(option->name(),inputBool);
          addDependency(m_switches,option->dependsOn(),option->name());
        }
        break;
      case ConfigOption::O_Int:
        {
          ASSERT(page!=0);
          InputInt *inputInt = new InputInt(
                          option->name(),                         // name
                          page,                                   // widget
                          *((ConfigInt *)option)->valueRef(),     // variable
                          ((ConfigInt *)option)->minVal(),        // min value
                          ((ConfigInt *)option)->maxVal()         // max value
                        );
          pageLayout->addWidget(inputInt);
          QWhatsThis::add(inputInt, option->docs().simplifyWhiteSpace() );
          QToolTip::add(inputInt, option->docs() );
          connect(inputInt,SIGNAL(changed()),SLOT(changed()));
          m_inputWidgets->insert(option->name(),inputInt);
          addDependency(m_switches,option->dependsOn(),option->name());
        }
        break;
      case ConfigOption::O_Obsolete:
        break;
    } 
  }
  if (pageLayout) pageLayout->addStretch(1);

  QDictIterator<QObject> di(*m_switches);
  QObject *obj = 0;
  for (di.toFirst();(obj=di.current());++di)
  {
    connect(obj,SIGNAL(toggle(const char *,bool)),SLOT(toggle(const char *,bool)));
    // UGLY HACK: assumes each item depends on a boolean without checking!
    emit toggle(di.currentKey(),((InputBool *)obj)->getState());
  }

  connect(this,SIGNAL(helpButtonPressed()),this,SLOT(handleHelp()));
  
}
コード例 #15
0
PolynomFitDialog::PolynomFitDialog( QWidget* parent, Qt::WFlags fl )
: QDialog( parent, fl )
{
    setName( "PolynomFitDialog" );
	setWindowTitle(tr("MantidPlot - Polynomial Fit Options"));
    setSizeGripEnabled( true );

    QGroupBox *gb1 = new QGroupBox();
	QGridLayout *gl1 = new QGridLayout(gb1);
	gl1->addWidget(new QLabel(tr("Polynomial Fit of")), 0, 0);

	boxName = new QComboBox();
    gl1->addWidget(boxName, 0, 1);

    gl1->addWidget(new QLabel( tr("Order (1 - 9, 1 = linear)")), 1, 0);
	boxOrder = new QSpinBox();
    boxOrder->setRange(1, 9);
	boxOrder->setValue(2);
    gl1->addWidget(boxOrder, 1, 1);

    gl1->addWidget(new QLabel( tr("Fit curve # pts")), 2, 0);
	boxPoints = new QSpinBox();
    boxPoints->setRange(1, 1000);
    boxPoints->setSingleStep(50);
    boxPoints->setSpecialValueText(tr("Not enough points"));
    gl1->addWidget(boxPoints, 2, 1);

    gl1->addWidget(new QLabel( tr("Fit curve Xmin")), 3, 0);
	boxStart = new QLineEdit(tr("0"));
    gl1->addWidget(boxStart, 3, 1);

    gl1->addWidget(	new QLabel( tr("Fit curve Xmax")), 4, 0);
	boxEnd = new QLineEdit();
    gl1->addWidget(boxEnd, 4, 1);

    gl1->addWidget(new QLabel( tr("Color")), 5, 0);
	boxColor = new ColorBox();
	boxColor->setColor(QColor(Qt::red));
    gl1->addWidget(boxColor, 5, 1);

	boxShowFormula = new QCheckBox(tr( "Show Formula on Graph?" ));
	boxShowFormula->setChecked( false );
    gl1->addWidget(boxShowFormula, 6, 1);
    gl1->setRowStretch(7, 1);

	buttonFit = new QPushButton(tr( "&Fit" ));
	buttonFit->setDefault( true );

	buttonCancel = new QPushButton(tr( "&Close" ));

    QVBoxLayout* vl = new QVBoxLayout();
    vl->addWidget(buttonFit);
    vl->addWidget(buttonCancel);
    vl->addStretch();

	QHBoxLayout* hlayout = new QHBoxLayout(this);
	hlayout->addWidget(gb1);
	hlayout->addLayout(vl);

	connect( buttonFit, SIGNAL( clicked() ), this, SLOT( fit() ) );
	connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) );
	connect( boxName, SIGNAL( activated(const QString&) ), this, SLOT(activateCurve(const QString&)));
}
コード例 #16
0
QTM_USE_NAMESPACE

EventOccurrenceEditPage::EventOccurrenceEditPage(QWidget *parent)
    :QWidget(parent),
    m_manager(0),
    scrollAreaLayout(0),
    m_typeComboBox(0),
    m_subjectEdit(0),
    m_countSpinBox(0),
    m_repeatUntilDate(0)
{
    //create asynch request to save an item
    m_saveItemRequest = new QOrganizerItemSaveRequest(this);
    // Create widgets
    QLabel *subjectLabel = new QLabel("Subject:", this);
    m_subjectEdit = new QLineEdit(this);
    QLabel *startTimeLabel = new QLabel("Start time:", this);
    m_startTimeEdit = new QDateTimeEdit(this);
    m_startTimeEdit->setDisplayFormat(QString("yyyy-MM-dd hh:mm:ss AP"));
    QLabel *endTimeLabel = new QLabel("End time:", this);
    m_endTimeEdit = new QDateTimeEdit(this);
    m_endTimeEdit->setDisplayFormat(QString("yyyy-MM-dd hh:mm:ss AP"));

#if !(defined(Q_OS_SYMBIAN) || defined(Q_WS_SIMULATOR))
    // Add push buttons for Maemo as it does not support soft keys
    QHBoxLayout* hbLayout = new QHBoxLayout();
    QPushButton *okButton = new QPushButton("Ok", this);
    connect(okButton,SIGNAL(clicked()),this,SLOT(saveOrNextClicked()));
    hbLayout->addWidget(okButton);
    QPushButton *cancelButton = new QPushButton("Cancel", this);
    connect(cancelButton,SIGNAL(clicked()),this,SLOT(cancelClicked()));
    hbLayout->addWidget(cancelButton);
#endif

    scrollAreaLayout = new QVBoxLayout();
    scrollAreaLayout->addWidget(subjectLabel);
    scrollAreaLayout->addWidget(m_subjectEdit);
    scrollAreaLayout->addWidget(startTimeLabel);
    scrollAreaLayout->addWidget(m_startTimeEdit);
    scrollAreaLayout->addWidget(endTimeLabel);
    scrollAreaLayout->addWidget(m_endTimeEdit);
    scrollAreaLayout->addStretch();

#if !(defined(Q_OS_SYMBIAN) || defined(Q_WS_SIMULATOR))
    scrollAreaLayout->addLayout(hbLayout);
#endif

    QScrollArea *scrollArea = new QScrollArea(this);
    scrollArea->setWidgetResizable(true);
    QWidget *formContainer = new QWidget(scrollArea);
    formContainer->setLayout(scrollAreaLayout);
    scrollArea->setWidget(formContainer);

    QVBoxLayout *mainLayout = new QVBoxLayout();
    mainLayout->addWidget(scrollArea);
    setLayout(mainLayout);

    // Add softkeys
    QAction* cancelSoftKey = new QAction("Cancel", this);
    cancelSoftKey->setSoftKeyRole(QAction::NegativeSoftKey);
    addAction(cancelSoftKey);
    connect(cancelSoftKey, SIGNAL(triggered(bool)), this, SLOT(cancelClicked()));

    m_saveOrNextSoftKey = new QAction("Save",this);
    m_saveOrNextSoftKey->setSoftKeyRole(QAction::PositiveSoftKey);
    addAction(m_saveOrNextSoftKey);
    connect(m_saveOrNextSoftKey, SIGNAL(triggered(bool)), this, SLOT(saveOrNextClicked()));
    m_countFieldAdded = false;
    m_multipleEntries = false;
    m_listOfEvents.clear();
}
コード例 #17
0
ファイル: clientwindow.cpp プロジェクト: nikname/LinQedIn
// METODO ClientWindow::setupUI
void ClientWindow::setupUI() {
    createMenuActions();
    createMenus();

    QWidget *centralWidget = new QWidget( this );
    centralWidget->setStyleSheet( "background: #EEE" );

    menuWidget->setFixedHeight( 50 );
    menuWidget->setStyleSheet( "background: #069; color: white;" );

    homeButton->setIcon( QIcon( QPixmap( ":/icons/icon/home.png" ) ) );
    setButtonProperties( homeButton );
    backButton->setIcon( QIcon( QPixmap( ":/icons/icon/arrow-left" ) ) );
    setButtonProperties( backButton );
    backButton->setVisible( false );

    setMenuButtonProperties( profileButton );

    setMenuButtonSelected( profileButton );

    QWidget *middleFiller = new QWidget( menuWidget );
    middleFiller->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding );

    openSearchButton->setIcon( QIcon( QPixmap( ":/icons/icon/magnify.png" ) ) );
    setButtonProperties( openSearchButton );

    searchWidget->setFixedHeight( 50 );
    searchWidget->setStyleSheet( "background: #069; color: white;" );
    searchWidget->setVisible( false );

    closeSearchButton->setIcon( QIcon( QPixmap( ":/icons/icon/close-white.png" ) ) );
    setButtonProperties( closeSearchButton );

    searchText->setPlaceholderText( tr( "Search" ) );
    searchText->setStyleSheet(
        "QLineEdit { border: 1px solid white; border-top: none; border-right: none;"
            "border-left: none; padding: 0 10px; color: white; }"
    );

    searchButton->setIcon( QIcon( QPixmap( ":/icons/icon/magnify.png" ) ) );
    setButtonProperties( searchButton );

    QHBoxLayout *searchLayout = new QHBoxLayout( searchWidget );
    searchLayout->addWidget( closeSearchButton );
    searchLayout->addWidget( searchText );
    searchLayout->addWidget( searchButton );
    searchLayout->setMargin( 0 );

    QHBoxLayout* menuLayout = new QHBoxLayout( menuWidget );
    menuLayout->addWidget( homeButton );
    menuLayout->addWidget( backButton );
    menuLayout->addSpacing( 10 );
    menuLayout->addWidget( linqedinLabel );
    menuLayout->addSpacing( 20 );
    menuLayout->addWidget( profileButton );
    menuLayout->addWidget( middleFiller );
    menuLayout->addWidget( openSearchButton );
    menuLayout->addWidget( searchWidget );
    menuLayout->setContentsMargins( 0, 0, 0, 0 );

    QWidget *contentWidget = new QWidget( scrollArea );

    QWidget *contentFiller = new QWidget( contentWidget );
    contentFiller->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Expanding );

    contentLayout = new QVBoxLayout( contentWidget );
    contentLayout->addWidget( profileWidget );
    contentLayout->addWidget( contentFiller );

    scrollArea->setWidget( contentWidget );
    scrollArea->setWidgetResizable( true );
    scrollArea->setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOn );

    QVBoxLayout *centralLayout = new QVBoxLayout( centralWidget );
    centralLayout->addWidget( menuWidget );
    centralLayout->addWidget( searchWidget );
    centralLayout->addWidget( scrollArea );
    centralLayout->setMargin( 0 );
    centralLayout->setSpacing( 0 );

    setStyleSheet(
        "QScrollBar:vertical { padding-left: 2px; width: 6px; }"
        "QScrollBar::handle:vertical { background: rgba(0,0,0,0.38); border-radius: 2px;"
            "min-height: 10px; }"
        "QScrollBar::add-line:vertical, QScrollBar::sub-line:vertical { border: none; }"
        "QScrollBar:horizontal { padding-top: 2px; height: 6px; }"
        "QScrollBar::handle:horizontal { background: rgba(0,0,0,0.38); border-radius: 2px;"
            "min-height: 10px; }"
        "QScrollBar::add-line:horizontal, QScrollBar::sub-line:horizontal { border: none; }"
    );

    setCentralWidget( centralWidget );
    setMinimumSize( 600, 400 );
    setWindowTitle( "LinQedIn Client" );
}
コード例 #18
0
DevFindDialog::DevFindDialog(QTextEdit *e)
 : QDialog(e), edit(e)
{
	setWindowTitle("Find text");
	
	connect(this, SIGNAL( accepted() ),
			this, SLOT  ( setVars() ) );
	
	QLabel *lbl;
	QGroupBox *g;
	QVBoxLayout *b;
	QGridLayout *l = new QGridLayout;
	
	text = new QLineEdit;
	lbl = new QLabel("Text to Find");
	l->addWidget(lbl, 0, 0, 1, 1);
	l->addWidget(text, 0, 1, 1, 3);
	
	g = new QGroupBox("Options");
	b = new QVBoxLayout;
	
	sensitive = new QCheckBox("Case &sensitive");
	b->addWidget(sensitive);
	
	bound = new QCheckBox("&Whole words only");
	b->addWidget(bound);
	
	g->setLayout(b);
	l->addWidget(g, 1, 0, 3, 2);
	
	g = new QGroupBox("Direction");
	b = new QVBoxLayout;
	
	forward = new QRadioButton("Forward");
	forward->toggle();
	b->addWidget(forward);
	
	backward = new QRadioButton("Backward");
	b->addWidget(backward);
	
	g->setLayout(b);
	l->addWidget(g, 1, 2, 3, 2);
	
	g = new QGroupBox("Scope");
	b = new QVBoxLayout;
	
	global = new QRadioButton("Global");
	global->toggle();
	b->addWidget(global);
	
	selection = new QRadioButton("Selected only");
	b->addWidget(selection);
	
	g->setLayout(b);
	l->addWidget(g, 4, 0, 3, 2);
	
	g = new QGroupBox("Origin");
	b = new QVBoxLayout;
	
	cursor = new QRadioButton("Cursor");
	cursor->toggle();
	b->addWidget(cursor);
	
	whole = new QRadioButton("Entire scope");
	b->addWidget(whole);
	
	g->setLayout(b);
	l->addWidget(g, 4, 2, 3, 2);
	
	b_accept = new QPushButton("&Find");
	connect(b_accept, SIGNAL( clicked() ),
			this	, SLOT  ( accept() ) );
	l->addWidget(b_accept, 7, 0, 1, 1);
	
	b_cancel = new QPushButton("&Cancel");
	connect(b_cancel, SIGNAL( clicked() ),
			this	, SLOT  ( reject() ) );
	l->addWidget(b_cancel, 7, 3, 1, 1);
	
	setLayout(l);
}
コード例 #19
0
ファイル: DraftSettings.cpp プロジェクト: kspagnoli/fbb
DraftSettingsDialog::DraftSettingsDialog()
{
    // Cancel button
    QPushButton* cancelButton = new QPushButton("Cancel");

    // Draft button
    QPushButton* acceptButton = new QPushButton("Save");
    acceptButton->setDefault(true);

    // Button layout
    QHBoxLayout* buttonsLayout = new QHBoxLayout;
    buttonsLayout->addWidget(cancelButton);
    buttonsLayout->addWidget(acceptButton);

    // 
    QList<QLineEdit*> vecNames;
    QList<QLineEdit*> vecAbbreviations;

    //
    enum OwnerGridColumn
    {
        OwnerGridColumn_ID,
        OwnerGridColumn_Name,
        OwnerGridColumn_Abbreviateion,
        OwnerGridColumn_COUNT
    };

    // Column names
    const char* ColumnNames[] = {
        "ID",
        "Owner Name",
        "Abbreviation"
    };

    // Owner group box
    QGroupBox* ownerGroupBox = new QGroupBox("Owners");
    QGridLayout* ownerGridLayout = new QGridLayout(ownerGroupBox);

    // Per max owner...
    for (auto row = 0u; row <= DraftSettings::Get().OwnerCount; row++) {

        // Per column...
        for (auto col = 0u; col < OwnerGridColumn_COUNT; col++) {

            // Header
            if (row == 0) {
                ownerGridLayout->addWidget(new QLabel(ColumnNames[col]), row, col);
                continue;
            }

            // Widget data
            auto GetWidget = [&]() -> QWidget*
            {
                const bool valid = row <= DraftSettings::Get().OwnerCount;

                switch (col)
                {
                case OwnerGridColumn_ID:
                    return new QLabel(QString("#%1").arg(row));
                case OwnerGridColumn_Name:
                    {
                        auto lineEdit = valid ? new QLineEdit(DraftSettings::Get().OwnerNames[row]) : new QLineEdit();
                        vecNames.append(lineEdit);
                        return lineEdit;
                    }
                case OwnerGridColumn_Abbreviateion:
                    {
                        auto lineEdit = valid ? new QLineEdit(DraftSettings::Get().OwnerAbbreviations[row]) : new QLineEdit();
                        vecAbbreviations.append(lineEdit);
                        return lineEdit;
                    }
                default:
                    return nullptr;
                    break;
                }
            };

            ownerGridLayout->addWidget(GetWidget(), row, col);
        }
    }

    // Budget group box
    QGroupBox* budgetGroupBox = new QGroupBox("Budget");
    QFormLayout* budgetForumLayout = new QFormLayout(budgetGroupBox);
    auto* lineEditHitters = new QLineEdit("14");
    lineEditHitters->setValidator(new QIntValidator(0, INT_MAX));
    budgetForumLayout->addRow(tr("# Hitters:"), lineEditHitters);
    auto* lineEditPitchers = new QLineEdit("10");
    lineEditPitchers->setValidator(new QIntValidator(0, INT_MAX));
    budgetForumLayout->addRow(tr("# Pitcher:"), lineEditPitchers);
    auto* lineEditBudget = new QLineEdit("280");
    lineEditBudget->setValidator(new QIntValidator(0, INT_MAX));
    budgetForumLayout->addRow(tr("Budget:"), lineEditBudget);
    auto* hittingSplit = new QLineEdit("70");
    hittingSplit->setValidator(new QIntValidator(0, 100));
    budgetForumLayout->addRow(tr("Hitting Split:"), hittingSplit);

    // Player pool group box
    auto* playerPoolGroupBox = new QGroupBox("Player Pool");
    auto* playerPoolGroupLayout = new QHBoxLayout(playerPoolGroupBox);
    auto* radioNL = new QRadioButton(tr("NL Only"));
    playerPoolGroupLayout->addWidget(radioNL);
    auto* radioAL = new QRadioButton(tr("AL Only"));
    playerPoolGroupLayout->addWidget(radioAL);
    auto* radioMixed = new QRadioButton(tr("Mixed"));
    playerPoolGroupLayout->addWidget(radioMixed);
    radioNL->setChecked(true);

    // Main layout
    QVBoxLayout* mainLayout = new QVBoxLayout;
    mainLayout->addWidget(ownerGroupBox);
    mainLayout->addWidget(budgetGroupBox);
    mainLayout->addWidget(playerPoolGroupBox);
    mainLayout->addSpacing(6);
    mainLayout->addLayout(buttonsLayout);

    // Just returns
    connect(cancelButton, &QPushButton::clicked, [=]{
        reject();
    });

    // Save settings
    connect(acceptButton, &QPushButton::clicked, [=] {

        // Basic settings
        DraftSettings draftSettings = {};
        draftSettings.Budget = lineEditBudget->text().toInt();
        draftSettings.HitterCount = lineEditHitters->text().toInt();
        draftSettings.PitcherCount = lineEditPitchers->text().toInt();
        draftSettings.RosterSize = draftSettings.HitterCount + draftSettings.PitcherCount;
        draftSettings.HittingSplit = hittingSplit->text().toFloat() / 100.f;
        draftSettings.PitchingSplit = 1.f - draftSettings.HittingSplit;

        // Owner 0
        draftSettings.OwnerNames.append(DraftSettings::Get().OwnerNames[0]);
        draftSettings.OwnerAbbreviations.append(DraftSettings::Get().OwnerAbbreviations[0]);

        // Loop owners
        for (auto i = 0u; i < DraftSettings::Get().OwnerCount; i++) {
            draftSettings.OwnerNames.append(vecNames[i]->text());
            draftSettings.OwnerAbbreviations.append(vecAbbreviations[i]->text());
        }

        // Save
        DraftSettings::Get() = draftSettings;
        accept();
    });

    // Configure this dialog
    setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
    setWindowTitle(tr("Adjust Settings"));
    setLayout(mainLayout);
    setModal(true);
}
コード例 #20
0
ファイル: UISettingsDialog.cpp プロジェクト: ryenus/vbox
/* Settings Dialog Constructor: */
UISettingsDialog::UISettingsDialog(QWidget *pParent)
    /* Parent class: */
    : QIWithRetranslateUI<QIMainDialog>(pParent)
    /* Protected variables: */
    , m_pSelector(0)
    , m_pStack(0)
    /* Common variables: */
    , m_dialogType(SettingsDialogType_Wrong)
    , m_fPolished(false)
    /* Loading/saving stuff: */
    , m_fLoaded(false)
    , m_fSaved(false)
    /* Status bar stuff: */
    , m_pStatusBar(new QStackedWidget(this))
    /* Process bar stuff: */
    , m_pProcessBar(new QProgressBar(this))
    /* Error/Warning stuff: */
    , m_fValid(true)
    , m_fSilent(true)
    , m_pWarningPane(new VBoxWarningPane(this))
    /* Whats-this stuff: */
    , m_pWhatsThisTimer(new QTimer(this))
    , m_pWhatsThisCandidate(0)
{
    /* Apply UI decorations: */
    Ui::UISettingsDialog::setupUi(this);

#ifdef Q_WS_MAC
    /* No status bar on the mac: */
    setSizeGripEnabled(false);
    setStatusBar(0);
#endif /* Q_WS_MAC */

    /* Page-title font is derived from the system font: */
    QFont pageTitleFont = font();
    pageTitleFont.setBold(true);
    pageTitleFont.setPointSize(pageTitleFont.pointSize() + 2);
    m_pLbTitle->setFont(pageTitleFont);

    /* Get main grid layout: */
    QGridLayout *pMainLayout = static_cast<QGridLayout*>(centralWidget()->layout());
#ifdef VBOX_GUI_WITH_TOOLBAR_SETTINGS
    /* No page-title with tool-bar: */
    m_pLbTitle->hide();
    /* No whats-this with tool-bar: */
    m_pLbWhatsThis->hide();
    /* Create modern tool-bar selector: */
    m_pSelector = new VBoxSettingsToolBarSelector(this);
    static_cast<UIToolBar*>(m_pSelector->widget())->setMacToolbar();
    addToolBar(qobject_cast<QToolBar*>(m_pSelector->widget()));
    /* No title in this mode, we change the title of the window: */
    pMainLayout->setColumnMinimumWidth(0, 0);
    pMainLayout->setHorizontalSpacing(0);
#else
    /* Create classical tree-view selector: */
    m_pSelector = new VBoxSettingsTreeViewSelector(this);
    pMainLayout->addWidget(m_pSelector->widget(), 0, 0, 3, 1);
    m_pSelector->widget()->setFocus();
    pMainLayout->setSpacing(10);
#endif /* VBOX_GUI_WITH_TOOLBAR_SETTINGS */

    /* Creating stack of pages: */
    m_pStack = new QStackedWidget(m_pWtStackHandler);
    QVBoxLayout *pStackLayout = new QVBoxLayout(m_pWtStackHandler);
    pStackLayout->setContentsMargins(0, 0, 0, 0);
    pStackLayout->addWidget(m_pStack);

    /* Status bar: */
    m_pStatusBar->addWidget(new QWidget);
    m_pButtonBox->addExtraWidget(m_pStatusBar);

    /* Setup process bar stuff: */
    m_pStatusBar->addWidget(m_pProcessBar);

    /* Setup error & warning stuff: */
    m_pStatusBar->addWidget(m_pWarningPane);
    m_errorIcon = UIIconPool::defaultIcon(UIIconPool::MessageBoxCriticalIcon, this).pixmap(16, 16);
    m_warningIcon = UIIconPool::defaultIcon(UIIconPool::MessageBoxWarningIcon, this).pixmap(16, 16);

    /* Setup whatsthis stuff: */
    qApp->installEventFilter(this);
    m_pWhatsThisTimer->setSingleShot(true);
    connect(m_pWhatsThisTimer, SIGNAL(timeout()), this, SLOT(sltUpdateWhatsThis()));
    m_pLbWhatsThis->setAutoFillBackground(true);
    QPalette whatsThisPalette = m_pLbWhatsThis->palette();
    whatsThisPalette.setBrush(QPalette::Window, whatsThisPalette.brush(QPalette::Midlight));
    m_pLbWhatsThis->setPalette(whatsThisPalette);
    m_pLbWhatsThis->setFixedHeight(m_pLbWhatsThis->frameWidth() * 2 +
                                   m_pLbWhatsThis->margin() * 2 +
                                   m_pLbWhatsThis->fontMetrics().lineSpacing() * 4);

    /* Set the default button: */
    m_pButtonBox->button(QDialogButtonBox::Ok)->setDefault(true);

    /* Setup connections: */
    connect(m_pSelector, SIGNAL(categoryChanged(int)), this, SLOT(sltCategoryChanged(int)));
    connect(m_pButtonBox, SIGNAL(helpRequested()), &msgCenter(), SLOT(sltShowHelpHelpDialog()));

    /* Translate UI: */
    retranslateUi();
}
コード例 #21
0
Transfers::Transfers(QWidget* _p, const char* _n)
          : QWidget(_p) {


	QVBoxLayout *MainBox = new QVBoxLayout(this);
	MainBox->setMargin(0);
	MainBox->setSpacing(0);
	transferSplitter = new QSplitter(this);
	MainBox->addWidget(transferSplitter);
	downloadsWidget = new QWidget(transferSplitter);
	uploadsWidget = new QWidget(transferSplitter);
	transferSplitter->setOrientation(Qt::Vertical);

    if (museeq->settings()->value("saveTransfersLayout", false).toBool()) {
        QString optionName = "transferSplitter_Layout";
        transferSplitter->restoreState(museeq->settings()->value(optionName).toByteArray());
    }

	// Downloads
	QVBoxLayout *downloadVbox = new QVBoxLayout(downloadsWidget);
	downloadVbox->setMargin(0);
	downloadVbox->setSpacing(3);
	QHBoxLayout *downloadHbox = new QHBoxLayout;
	downloadVbox->addLayout(downloadHbox);
	QLabel * downloadsLabel = new QLabel(tr("Downloads:"), downloadsWidget);
	downloadsLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
	downloadHbox->addWidget(downloadsLabel);

	mDownrate = new QSpinBox(downloadsWidget);
	mDownrate->setMaximum(9999);
	downloadHbox->addWidget(mDownrate);
	QLabel * downrateLabel = new QLabel(tr("KiB/s"), downloadsWidget);
	downloadHbox->addWidget(downrateLabel);
	connect(mDownrate, SIGNAL(valueChanged(const QString&)), SLOT(setDownrate(const QString&)));
	connect(museeq, SIGNAL(configChanged(const QString&, const QString&, const QString&)), SLOT(slotConfigChanged(const QString&, const QString&, const QString&)));

	QFrame* sep = new QFrame(downloadsWidget);
	downloadHbox->addWidget(sep);
	sep->setFrameShape(QFrame::VLine);
	sep->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred);

	mDownslots = new QSpinBox(downloadsWidget);
	downloadHbox->addWidget(mDownslots);
	QLabel * downslotsLabel = new QLabel(tr("slots"), downloadsWidget);
	downloadHbox->addWidget(downslotsLabel);
	connect(mDownslots, SIGNAL(valueChanged(const QString&)), SLOT(setDownslots(const QString&)));
	connect(museeq, SIGNAL(configChanged(const QString&, const QString&, const QString&)), SLOT(slotConfigChanged(const QString&, const QString&, const QString&)));

	QFrame* sep2 = new QFrame(downloadsWidget);
	downloadHbox->addWidget(sep2);
	sep2->setFrameShape(QFrame::VLine);
	sep2->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred);

	mGroupDownloads = new QCheckBox(tr("Group by user"), downloadsWidget);
	downloadHbox->addWidget(mGroupDownloads);
	connect(mGroupDownloads, SIGNAL(toggled(bool)), SLOT(groupDownloadsSet(bool)));

	mDownloads = new TransferListView(true, downloadsWidget, "downloads");
 	downloadVbox->addWidget(mDownloads);
	mDownloads->setAcceptDrops(true);
	connect(museeq, SIGNAL(downloadUpdated(const NTransfer&)), mDownloads, SLOT(update(const NTransfer&)));
	connect(museeq, SIGNAL(downloadRemoved(const QString&, const QString&)), mDownloads, SLOT(remove(const QString&, const QString&)));
	connect(mDownloads, SIGNAL(dropSlsk(const QList<QUrl>&)), SLOT(dropSlsk(const QList<QUrl>&)));
	// Uploads
	QVBoxLayout *uploadVbox = new QVBoxLayout(uploadsWidget);
	uploadVbox->setMargin(0);
	uploadVbox->setSpacing(3);
	QHBoxLayout *uploadHbox = new QHBoxLayout;
	uploadVbox->addLayout(uploadHbox);

	uploadHbox->setSpacing(5);
	QLabel * uploadsLabel = new QLabel(tr("Uploads:"));
	uploadsLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
	uploadHbox->addWidget(uploadsLabel);

	mUprate = new QSpinBox(uploadsWidget);
	mUprate->setMaximum(9999);
	uploadHbox->addWidget(mUprate);
	QLabel * uprateLabel = new QLabel(tr("KiB/s"), uploadsWidget);
	uploadHbox->addWidget(uprateLabel);
	connect(mUprate, SIGNAL(valueChanged(const QString&)), SLOT(setUprate(const QString&)));
	connect(museeq, SIGNAL(configChanged(const QString&, const QString&, const QString&)), SLOT(slotConfigChanged(const QString&, const QString&, const QString&)));

	QFrame* sep3 = new QFrame(uploadsWidget);
	uploadHbox->addWidget(sep3);
	sep3->setFrameShape(QFrame::VLine);
	sep3->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred);

	mUpslots = new QSpinBox(uploadsWidget);
	uploadHbox->addWidget(mUpslots);
	QLabel * upslotsLabel = new QLabel(tr("slots"), uploadsWidget);
	uploadHbox->addWidget(upslotsLabel);
	connect(mUpslots, SIGNAL(valueChanged(const QString&)), SLOT(setUpslots(const QString&)));
	connect(museeq, SIGNAL(configChanged(const QString&, const QString&, const QString&)), SLOT(slotConfigChanged(const QString&, const QString&, const QString&)));

	QFrame* sep4 = new QFrame(uploadsWidget);
	uploadHbox->addWidget(sep4);
	sep4->setFrameShape(QFrame::VLine);
	sep4->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred);

	mGroupUploads = new QCheckBox(tr("Group by user"), uploadsWidget);
	uploadHbox->addWidget(mGroupUploads);
	connect(mGroupUploads, SIGNAL(toggled(bool)), SLOT(groupUploadsSet(bool)));

	mUploads = new TransferListView(false, uploadsWidget, "uploads");
	uploadVbox->addWidget(mUploads);
	connect(museeq, SIGNAL(uploadUpdated(const NTransfer&)), mUploads, SLOT(update(const NTransfer&)));
	connect(museeq, SIGNAL(uploadRemoved(const QString&, const QString&)), mUploads, SLOT(remove(const QString&, const QString&)));

	mTransferMenu = new QMenu(this);

	ActionRetry = new QAction(tr("Retry"), this);
	connect(ActionRetry, SIGNAL(triggered()), this, SLOT(retrySelected()));
	mTransferMenu->addAction(ActionRetry);

	ActionCheckPosition = new QAction(tr("Check place"), this);
	connect(ActionCheckPosition, SIGNAL(triggered()), this, SLOT(updateSelected()));
	mTransferMenu->addAction(ActionCheckPosition);

	ActionAbort = new QAction(tr("Abort"), this);
	connect(ActionAbort, SIGNAL(triggered()), this, SLOT(abortSelected()));
	mTransferMenu->addAction(ActionAbort);

	ActionMessageDownloading = new QAction(tr("Message downloading users"), this);
	connect(ActionMessageDownloading, SIGNAL(triggered()), this, SLOT(messageDownloadingUsers()));
	mTransferMenu->addAction(ActionMessageDownloading);

	mClearMenu = mTransferMenu->addMenu(tr("Clear"));

	ActionClearSelected = new QAction(tr("Selected"), this);
	connect(ActionClearSelected, SIGNAL(triggered()), this, SLOT(clearSelected()));
	mClearMenu->addAction(ActionClearSelected);

	mClearMenu->addSeparator();

	ActionClearFinished = new QAction(tr("Finished"), this);
	connect(ActionClearFinished, SIGNAL(triggered()), this, SLOT(clearFinished()));
	mClearMenu->addAction(ActionClearFinished);

	ActionClearAborted = new QAction(tr("Aborted"), this);
	connect(ActionClearAborted, SIGNAL(triggered()), this, SLOT(clearAborted()));
	mClearMenu->addAction(ActionClearAborted);

	ActionClearAwaiting = new QAction(tr("Offline"), this);
	connect(ActionClearAwaiting, SIGNAL(triggered()), this, SLOT(clearAwaiting()));
	mClearMenu->addAction(ActionClearAwaiting);

	ActionClearCruft = new QAction(tr("Cruft"), this);
	connect(ActionClearCruft, SIGNAL(triggered()), this, SLOT(clearCruft()));
	mClearMenu->addAction(ActionClearCruft);

	ActionClearFinishedAborted = new QAction(tr("Finished / aborted"), this);
	connect(ActionClearFinishedAborted, SIGNAL(triggered()), this, SLOT(clearFinishedAborted()));
	mClearMenu->addAction(ActionClearFinishedAborted);

	ActionClearQueued = new QAction(tr("Queued"), this);
	connect(ActionClearQueued, SIGNAL(triggered()), this, SLOT(clearQueued()));
	mClearMenu->addAction(ActionClearQueued);


	mTransferMenu->addSeparator();
	mUsersMenu = mTransferMenu->addMenu(tr("Users"));

	connect(mDownloads, SIGNAL(customContextMenuRequested(const QPoint&)), SLOT(popupDownloads(const QPoint&)));
	connect(mUploads, SIGNAL(customContextMenuRequested(const QPoint&)), SLOT(popupUploads(const QPoint&)));
	connect(museeq, SIGNAL(transfersSorting(bool)), SLOT(setSorting(bool)));

	mUpGroupingChanging = mDownGroupingChanging = true;
    groupDownloads(museeq->settings()->value("groupDownloads", false).toBool());
    groupUploads(museeq->settings()->value("groupUploads", false).toBool());
	mUpGroupingChanging = mDownGroupingChanging = false;

	connect(museeq, SIGNAL(closingMuseeq()), this, SLOT(onClosingMuseeq()));
}
コード例 #22
0
int main(int argc, char **argv)
{

    QApplication app(argc, argv);

    // Initializing the graph and its container
    Q3DScatter *graph = new Q3DScatter();
    QWidget *container = QWidget::createWindowContainer(graph);
    //! [0]

    QSize screenSize = graph->screen()->size();
    container->setMinimumSize(QSize(screenSize.width() / 2.25, screenSize.height() / 4));
    container->setMaximumSize(screenSize);
    container->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    container->setFocusPolicy(Qt::StrongFocus);

    //! [1]
    QWidget *widget = new QWidget;
    QGroupBox *menuLayout = new QGroupBox;
    QGroupBox *optionLayout = new QGroupBox;
    QVBoxLayout *vLayout = new QVBoxLayout(widget);
    vLayout->addWidget(menuLayout);
    vLayout->addWidget(container, 1);
    vLayout->addWidget(optionLayout);
    //! [1]

    widget->setWindowTitle(QStringLiteral("CRN Dava Visualization"));

    //! [4]
    /*
    QComboBox *themeList = new QComboBox(widget);
    themeList->addItem(QStringLiteral("Qt"));
    themeList->addItem(QStringLiteral("Primary Colors"));
    themeList->addItem(QStringLiteral("Digia"));
    themeList->addItem(QStringLiteral("Stone Moss"));
    themeList->addItem(QStringLiteral("Army Blue"));
    themeList->addItem(QStringLiteral("Retro"));
    themeList->addItem(QStringLiteral("Ebony"));
    themeList->addItem(QStringLiteral("Isabelle"));
    themeList->setCurrentIndex(6);

    QPushButton *labelButton = new QPushButton(widget);
    labelButton->setText(QStringLiteral("Change label style"));
    */
    int logoHeight = 100, logoWidth = 300;
    int buttonSize = 100;
    QGridLayout *gridMenu = new QGridLayout();
    QPushButton *taLogoLabel = new QPushButton();
    QPushButton *configLabel = new QPushButton();
    QPushButton *saveLabel = new QPushButton();
    QPushButton *openLabel = new QPushButton();
    QPushButton *globeLabel = new QPushButton();
    QPixmap taLogoPix("/home/adityarputra/Pictures/placeholder.png");
    QIcon taLogoIcon(taLogoPix);
    QPixmap configPix("/home/adityarputra/Pictures/placeholder.png");
    QIcon configIcon(configPix);
    QPixmap savePix("/home/adityarputra/Pictures/placeholder.png");
    QIcon saveIcon(savePix);
    QPixmap openPix("/home/adityarputra/Pictures/placeholder.png");
    QIcon openIcon(openPix);
    QPixmap globePix("/home/adityarputra/Pictures/placeholder.png");
    QIcon globeIcon(globePix);

    taLogoLabel->setIcon(taLogoIcon);
    taLogoLabel->setMaximumSize(logoWidth,logoHeight);
    //taLogoLabel->setText("TA logo label");
    configLabel->setIcon(configIcon);
    configLabel->setMaximumSize(buttonSize,buttonSize);
    //configLabel->setText("Config Icon");
    saveLabel->setIcon(saveIcon);
    saveLabel->setMaximumSize(buttonSize,buttonSize);
    //saveLabel->setText("Save Icon");
    openLabel->setIcon(openIcon);
    openLabel->setMaximumSize(buttonSize,buttonSize);
    //openLabel->setText("Open Icon");
    globeLabel->setIcon(globeIcon);
    globeLabel->setMaximumSize(buttonSize,buttonSize);
    //globeLabel->setText("Globe Icon");

    gridMenu->addWidget(taLogoLabel,0,0);
    gridMenu->addWidget(configLabel,0,2);
    gridMenu->addWidget(saveLabel,0,3);
    gridMenu->addWidget(openLabel,0,4);
    gridMenu->addWidget(globeLabel,0,5);

    gridMenu->setColumnStretch(0,300);
    gridMenu->setRowMinimumHeight(0,100);
    gridMenu->setColumnStretch(1,100);
    gridMenu->setColumnStretch(2,100);
    gridMenu->setColumnStretch(3,100);
    gridMenu->setColumnStretch(4,100);
    gridMenu->setColumnStretch(5,100);

    menuLayout->setLayout(gridMenu);

    //-----------------------------------//
    QGridLayout *gridOption = new QGridLayout();
    QComboBox *gasTypeCombo = new QComboBox();
    QPushButton *rewindButton = new QPushButton();
    QPushButton *prevButton = new QPushButton();
    QPushButton *startButton = new QPushButton();
    QPushButton *nextButton = new QPushButton();
    QPushButton *forwardButton = new QPushButton();
    QTableWidget *sensorDataTable = new QTableWidget();
    QPlainTextEdit *console = new QPlainTextEdit();

    sensorDataTable->setRowCount(60);
    sensorDataTable->setColumnCount(9);

    QPixmap buttonPix("/home/adityarputra/Pictures/placeholder.png");
    QIcon buttonIcon(buttonPix);

    rewindButton->setIcon(buttonIcon);
    rewindButton->setMaximumWidth(50);
    prevButton->setIcon(buttonIcon);
    prevButton->setMaximumWidth(50);
    startButton->setIcon(buttonIcon);
    startButton->setMaximumWidth(50);
    nextButton->setIcon(buttonIcon);
    nextButton->setMaximumWidth(50);
    forwardButton->setIcon(buttonIcon);
    forwardButton->setMaximumWidth(50);

    gridOption->addWidget(sensorDataTable,0,6,3,1);
    gridOption->addWidget(gasTypeCombo,0,0,1,5);
    gridOption->addWidget(rewindButton,1,0);
    gridOption->addWidget(prevButton,1,1);
    gridOption->addWidget(startButton,1,2);
    gridOption->addWidget(nextButton,1,3);
    gridOption->addWidget(forwardButton,1,4);
    gridOption->addWidget(console,2,0,1,5);
    gridOption->setColumnStretch(0,50);
    gridOption->setColumnStretch(1,50);
    gridOption->setColumnStretch(2,50);
    gridOption->setColumnStretch(3,50);
    gridOption->setColumnStretch(4,50);
    gridOption->setColumnStretch(5,50);
    gridOption->setColumnStretch(6,400);

    optionLayout->setLayout(gridOption);

    //----------------------------------To be deleted---------------------------------
    /*QCheckBox *smoothCheckBox = new QCheckBox(widget);
    smoothCheckBox->setText(QStringLiteral("Smooth dots"));
    smoothCheckBox->setChecked(true);

    QComboBox *itemStyleList = new QComboBox(widget);
    itemStyleList->addItem(QStringLiteral("Sphere"), int(QAbstract3DSeries::MeshSphere));
    itemStyleList->addItem(QStringLiteral("Cube"), int(QAbstract3DSeries::MeshCube));
    itemStyleList->addItem(QStringLiteral("Minimal"), int(QAbstract3DSeries::MeshMinimal));
    itemStyleList->addItem(QStringLiteral("Point"), int(QAbstract3DSeries::MeshPoint));
    itemStyleList->setCurrentIndex(0);

    QPushButton *cameraButton = new QPushButton(widget);
    cameraButton->setText(QStringLiteral("Change camera preset"));

    QPushButton *itemCountButton = new QPushButton(widget);
    itemCountButton->setText(QStringLiteral("Toggle item count"));

    QCheckBox *backgroundCheckBox = new QCheckBox(widget);
    backgroundCheckBox->setText(QStringLiteral("Show background"));
    backgroundCheckBox->setChecked(true);

    QCheckBox *gridCheckBox = new QCheckBox(widget);
    gridCheckBox->setText(QStringLiteral("Show grid"));
    gridCheckBox->setChecked(true);

    QComboBox *shadowQuality = new QComboBox(widget);
    shadowQuality->addItem(QStringLiteral("None"));
    shadowQuality->addItem(QStringLiteral("Low"));
    shadowQuality->addItem(QStringLiteral("Medium"));
    shadowQuality->addItem(QStringLiteral("High"));
    shadowQuality->addItem(QStringLiteral("Low Soft"));
    shadowQuality->addItem(QStringLiteral("Medium Soft"));
    shadowQuality->addItem(QStringLiteral("High Soft"));
    shadowQuality->setCurrentIndex(4);

    QFontComboBox *fontList = new QFontComboBox(widget);
    fontList->setCurrentFont(QFont("Arial"));*/
    //----------------------------------------------------------------

    // Adding widget to respective layout
    /*
    vLayout->addWidget(labelButton, 0, Qt::AlignTop);
    vLayout->addWidget(cameraButton, 0, Qt::AlignTop);
    vLayout->addWidget(itemCountButton, 0, Qt::AlignTop);
    vLayout->addWidget(backgroundCheckBox);
    vLayout->addWidget(gridCheckBox);
    vLayout->addWidget(smoothCheckBox, 0, Qt::AlignTop);
    vLayout->addWidget(new QLabel(QStringLiteral("Change dot style")));
    vLayout->addWidget(itemStyleList);
    vLayout->addWidget(new QLabel(QStringLiteral("Change theme")));
    vLayout->addWidget(themeList);
    vLayout->addWidget(new QLabel(QStringLiteral("Adjust shadow quality")));
    vLayout->addWidget(shadowQuality);
    vLayout->addWidget(new QLabel(QStringLiteral("Change font")));
    vLayout->addWidget(fontList, 1, Qt::AlignTop);
    */
    //! [5]

    //! [2]
    ScatterDataModifier *modifier = new ScatterDataModifier(graph);
    //! [2]

    connect(configLabel,SIGNAL(clicked(bool)),this,
    /*
    QObject::connect(cameraButton, &QPushButton::clicked, modifier,
                     &ScatterDataModifier::changePresetCamera);
    QObject::connect(labelButton, &QPushButton::clicked, modifier,
                     &ScatterDataModifier::changeLabelStyle);
    QObject::connect(itemCountButton, &QPushButton::clicked, modifier,
                     &ScatterDataModifier::toggleItemCount);

    QObject::connect(backgroundCheckBox, &QCheckBox::stateChanged, modifier,
                     &ScatterDataModifier::setBackgroundEnabled);
    QObject::connect(gridCheckBox, &QCheckBox::stateChanged, modifier,
                     &ScatterDataModifier::setGridEnabled);
    QObject::connect(smoothCheckBox, &QCheckBox::stateChanged, modifier,
                     &ScatterDataModifier::setSmoothDots);

    QObject::connect(modifier, &ScatterDataModifier::backgroundEnabledChanged,
                     backgroundCheckBox, &QCheckBox::setChecked);
    QObject::connect(modifier, &ScatterDataModifier::gridEnabledChanged,
                     gridCheckBox, &QCheckBox::setChecked);
    QObject::connect(itemStyleList, SIGNAL(currentIndexChanged(int)), modifier,
                     SLOT(changeStyle(int)));

    QObject::connect(themeList, SIGNAL(currentIndexChanged(int)), modifier,
                     SLOT(changeTheme(int)));

    QObject::connect(shadowQuality, SIGNAL(currentIndexChanged(int)), modifier,
                     SLOT(changeShadowQuality(int)));

    QObject::connect(modifier, &ScatterDataModifier::shadowQualityChanged, shadowQuality,
                     &QComboBox::setCurrentIndex);
    QObject::connect(graph, &Q3DScatter::shadowQualityChanged, modifier,
                     &ScatterDataModifier::shadowQualityUpdatedByVisual);

    QObject::connect(fontList, &QFontComboBox::currentFontChanged, modifier,
                     &ScatterDataModifier::changeFont);
    QObject::connect(modifier, &ScatterDataModifier::fontChanged, fontList,
                     &QFontComboBox::setCurrentFont);
    */
    //! [6]

    //! [3]
    widget->show();
    return app.exec();
    //! [3]
}
コード例 #23
0
//adds dynamic actions to the toolbar (example settings)
void RenderWindow::slotPopulateToolbar(bool completeRefresh)
{
  WriteLog("cInterface::PopulateToolbar(QWidget *window, QToolBar *toolBar) started");
  QDir toolbarDir = QDir(systemData.dataDirectory + "toolbar");
  toolbarDir.setSorting(QDir::Time);
  QStringList toolbarFiles = toolbarDir.entryList(QDir::NoDotAndDotDot | QDir::Files);
  QSignalMapper *mapPresetsFromExamplesLoad = new QSignalMapper(this);
  QSignalMapper *mapPresetsFromExamplesRemove = new QSignalMapper(this);
  ui->toolBar->setIconSize(QSize(gPar->Get<int>("toolbar_icon_size"), gPar->Get<int>("toolbar_icon_size")));

  QList<QAction *> actions = ui->toolBar->actions();
  QStringList toolbarInActions;
  for (int i = 0; i < actions.size(); i++)
  {
    QAction * action = actions.at(i);
    if(action->objectName() == "actionAdd_Settings_to_Toolbar") continue;
    if(!toolbarFiles.contains(action->objectName()) || completeRefresh)
    {
      // preset has been removed
      ui->toolBar->removeAction(action);
    }
    else
    {
      toolbarInActions << action->objectName();
    }
  }

  for (int i = 0; i < toolbarFiles.size(); i++)
  {
    if(toolbarInActions.contains(toolbarFiles.at(i)))
    {
      // already present
      continue;
    }
    QString filename = systemData.dataDirectory + "toolbar/" + toolbarFiles.at(i);
    cThumbnailWidget *thumbWidget = NULL;

    if (QFileInfo(filename).suffix() == QString("fract"))
    {
      WriteLogString("Generating thumbnail for preset", filename);
      cSettings parSettings(cSettings::formatFullText);
      parSettings.BeQuiet(true);

      if (parSettings.LoadFromFile(filename))
      {
        cParameterContainer *par = new cParameterContainer;
        cFractalContainer *parFractal = new cFractalContainer;
        InitParams(par);
        for (int i = 0; i < NUMBER_OF_FRACTALS; i++)
          InitFractalParams(&parFractal->at(i));
        if (parSettings.Decode(par, parFractal))
        {
          thumbWidget = new cThumbnailWidget(gPar->Get<int>("toolbar_icon_size"), gPar->Get<int>("toolbar_icon_size"), 2, this);
          thumbWidget->UseOneCPUCore(true);
          thumbWidget->AssignParameters(*par, *parFractal);
        }
        delete par;
        delete parFractal;
      }
    }

    if(thumbWidget)
    {
      QWidgetAction *action = new QWidgetAction(this);
      QToolButton *buttonLoad = new QToolButton;
      QVBoxLayout *tooltipLayout = new QVBoxLayout;
      QToolButton *buttonRemove = new QToolButton;

      tooltipLayout->setContentsMargins(3, 3, 3, 3);
      tooltipLayout->addWidget(thumbWidget);
      QIcon iconDelete = QIcon::fromTheme("list-remove", QIcon(":system/icons/list-remove.svg"));
      buttonRemove->setIcon(iconDelete);
      buttonRemove->setMaximumSize(QSize(15, 15));
      buttonRemove->setStyleSheet("margin-bottom: -2px; margin-left: -2px;");
      tooltipLayout->addWidget(buttonRemove);
      buttonLoad->setToolTip(QObject::tr("Toolbar settings: ") + filename);
      buttonLoad->setLayout(tooltipLayout);
      action->setDefaultWidget(buttonLoad);
      action->setObjectName(toolbarFiles.at(i));
      ui->toolBar->addAction(action);

      mapPresetsFromExamplesLoad->setMapping(buttonLoad, filename);
      mapPresetsFromExamplesRemove->setMapping(buttonRemove, filename);
      QApplication::connect(buttonLoad, SIGNAL(clicked()), mapPresetsFromExamplesLoad, SLOT(map()));
      QApplication::connect(buttonRemove, SIGNAL(clicked()), mapPresetsFromExamplesRemove, SLOT(map()));
    }
  }
  QApplication::connect(mapPresetsFromExamplesLoad,
                        SIGNAL(mapped(QString)),
                        this,
                        SLOT(slotMenuLoadPreset(QString)));

  QApplication::connect(mapPresetsFromExamplesRemove,
                        SIGNAL(mapped(QString)),
                        this,
                        SLOT(slotMenuRemovePreset(QString)));

  WriteLog("cInterface::PopulateToolbar(QWidget *window, QToolBar *toolBar) finished");
}
コード例 #24
0
ファイル: BuzzerModule.cpp プロジェクト: davidpuzey/peanuts
BuzzerControl::BuzzerControl() {
    QHBoxLayout *layout = new QHBoxLayout();
    QVBoxLayout *settingsLayout = new QVBoxLayout();
    QHBoxLayout *confLayout = new QHBoxLayout();
    QGridLayout *teamLayout = new QGridLayout();

    serialPortList = new QComboBox();
    start = new QPushButton("Connect");
    start->setCheckable(true);
    refresh = new QPushButton("Refresh");
    QPushButton *reset = new QPushButton("Reset");

    connect(refresh, SIGNAL(clicked()), this, SLOT(updateSerialPortList()));
    connect(start, SIGNAL(clicked(bool)), this, SLOT(serialGo(bool)));

    updateSerialPortList();

    confLayout->addWidget(serialPortList);
    confLayout->addWidget(start);
    confLayout->addWidget(refresh);
    confLayout->addWidget(reset);

    QSignalMapper *signalMapper = new QSignalMapper();

    teamLayout->addWidget(new QLabel("Teams:"), 0, 1);
    for (int i = 0; i < MAX_TEAMS; i++) {
        teamName[i] = new QLineEdit();
        QPushButton *triggerButton = new QPushButton("Trigger");

        teamLayout->addWidget(new QLabel(QString::number(i+1)), i+1, 0);
        teamLayout->addWidget(teamName[i], i+1, 1);
        teamLayout->addWidget(triggerButton, i+1, 2);
        connect(triggerButton, SIGNAL(clicked()), signalMapper, SLOT(map()));
        signalMapper->setMapping(triggerButton, i);
    }

    connect(signalMapper, SIGNAL(mapped(int)), this, SLOT(teamWin(int)));

    QWidget *confWidget = new QWidget();
    confWidget->setLayout(confLayout);
    QWidget *teamWidget = new QWidget();
    teamWidget->setLayout(teamLayout);

    settingsLayout->addWidget(confWidget);
    settingsLayout->addWidget(teamWidget);

    QWidget *settingsWidget = new QWidget();
    settingsWidget->setLayout(settingsLayout);

    QDir *videosDir = new QDir("media/buzzer/videos/");
    videosDir->setFilter(QDir::Files);
    videoFiles = videosDir->entryInfoList();

    videoPlaylist = new QListWidget();
    for (int i = 0; i < videoFiles.size(); i++)
        new QListWidgetItem(videoFiles[i].fileName(), videoPlaylist);
    videoPlaylist->setCurrentRow(0);

    QPushButton *startBtn = new QPushButton("Start");
    connect(videoPlaylist, SIGNAL(itemDoubleClicked(QListWidgetItem *)), startBtn, SLOT(animateClick()));
    connect(startBtn, SIGNAL(clicked()), this, SLOT(startNewVideo()));
    pauseBtn = new QPushButton("Pause");
    connect(pauseBtn, SIGNAL(clicked()), this, SIGNAL(toggleVideoPlaying()));
    QPushButton *nextBtn = new QPushButton("Next");
    connect(nextBtn, SIGNAL(clicked()), this, SLOT(videoFinished()));

    QHBoxLayout *controlsLayout = new QHBoxLayout();
    controlsLayout->addWidget(startBtn);
    controlsLayout->addWidget(pauseBtn);
    controlsLayout->addWidget(nextBtn);

    QWidget *controlsWidget = new QWidget();
    controlsWidget->setLayout(controlsLayout);

    QVBoxLayout *playlistLayout = new QVBoxLayout();
    playlistLayout->addWidget(new QLabel("Videos:"));
    playlistLayout->addWidget(videoPlaylist);
    playlistLayout->addWidget(controlsWidget);

    QWidget *playlistWidget = new QWidget();
    playlistWidget->setLayout(playlistLayout);

    layout->addWidget(settingsWidget);
    layout->addWidget(playlistWidget);
    setLayout(layout);
}
コード例 #25
0
ファイル: parametergroup.cpp プロジェクト: AlFoX/qt-client
void ParameterGroup::setFixedSize(bool pFixed)
{
  if (pFixed == _fixed)
    return;
  
  if (layout())
    delete layout();
    
  if (_selectedGroup->layout())
    delete _selectedGroup->layout();
      
  if (_patternGroup->layout())
    delete _patternGroup->layout();
  
  if (pFixed)
  {
    setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed));
    QHBoxLayout * hLayout = new QHBoxLayout(_selectedGroup);
    hLayout->setSpacing(5);
    hLayout->setMargin(0);
    hLayout->addWidget(_selected);
    hLayout->addWidget(_items);
    _selectedGroup->setLayout(hLayout);

    hLayout = new QHBoxLayout(_patternGroup);
    hLayout->setSpacing(5);
    hLayout->setMargin(0);
    hLayout->addWidget(_usePattern);
    hLayout->addWidget(_pattern);
    _patternGroup->setLayout(hLayout);

    QVBoxLayout * vLayout = new QVBoxLayout(this);
    vLayout->setSpacing(0);
    vLayout->setMargin(5);
    vLayout->addWidget(_all);
    vLayout->addWidget(_selectedGroup);
    vLayout->addWidget(_patternGroup);
    setLayout(vLayout);
  }
  else
  {
    setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));
    QGridLayout * gridLayout = new QGridLayout(this);
    QGridLayout * gridLayout1 = new QGridLayout();
  #if defined Q_OS_MAC
    gridLayout1->setRowMinimumHeight(0,24);
  #endif
    
    gridLayout1->addWidget(_all, 0, 0, 1, 2);
    
    gridLayout1->addWidget(_selected, 1, 0, 1, 1);

    QHBoxLayout * hboxLayout = new QHBoxLayout();
    hboxLayout->setSpacing(5);
    hboxLayout->addWidget(_items);
    QSpacerItem * spacerItem = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
    hboxLayout->addItem(spacerItem);
    gridLayout1->addLayout(hboxLayout, 1, 1, 1, 1);

    gridLayout1->addWidget(_usePattern, 2, 0, 1, 1);

    QHBoxLayout * hboxLayout1 = new QHBoxLayout();
    hboxLayout1->setSpacing(5);
    hboxLayout1->addWidget(_pattern);
    QSpacerItem * spacerItem1 = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
    hboxLayout1->addItem(spacerItem1);
    gridLayout1->addLayout(hboxLayout1, 2, 1, 1, 1);
    
    QVBoxLayout * vboxLayout1 = new QVBoxLayout();
    vboxLayout1->setSpacing(5);
    vboxLayout1->addLayout(gridLayout1);
    QSpacerItem * spacerItem2 = new QSpacerItem(20, 0, QSizePolicy::Minimum, QSizePolicy::Expanding);
    vboxLayout1->addItem(spacerItem2);

    gridLayout->addLayout(vboxLayout1, 0, 0, 1, 1);
  }
  _buttonGroup->addButton(_all);
  _buttonGroup->addButton(_selected);
  _buttonGroup->addButton(_usePattern);
  _fixed = pFixed;
}
コード例 #26
0
ファイル: bitcoingui.cpp プロジェクト: roscoin1/roscoin
BitcoinGUI::BitcoinGUI(QWidget *parent):
    QMainWindow(parent),
    clientModel(0),
    walletModel(0),
    encryptWalletAction(0),
    changePassphraseAction(0),
    unlockWalletAction(0),
    lockWalletAction(0),
    aboutQtAction(0),
    trayIcon(0),
    notificator(0),
    rpcConsole(0)
{
    resize(1000, 520);
    //setFixedSize(1040, 560);
    setWindowTitle(tr("Roscoin") + " - " + tr("Wallet"));


    qApp->setStyleSheet("QMainWindow { background:rgb(237,241,247);font-family:'Proxima Nova Rg'; }"

                           "#toolbar2 { border:none;width:28px;background-color:qlineargradient(x1: 0, y1: 0, x2: 0.5, y2: 0.5,stop: 0 rgb(35,35,35), stop: 1 rgb(0,232,204)) }"
                            "QMenu { background: rgb(35,35,35); color:white; padding-bottom:10px; } "
                            "QMenu::item { color:white; background-color: transparent; } "
                            "QMenu::item:selected { background-color:qlineargradient(x1: 0, y1: 0, x2: 0.5, y2: 0.5,stop: 0 rgb(35,35,35), stop: 1 rgb(0,232,204)); }"
                            "QMenuBar { background-color:qlineargradient(x1: 0, y1: 0, x2: 0.5, y2: 0.5,stop: 0 rgb(35,35,35), stop: 1 rgb(0,232,204));  color:white; }"
                            "QMenuBar::item { font-size:12px;padding-bottom:12px;padding-top:12px;padding-left:15px;padding-right:15px;color:white; background-color: transparent; }"
                            "QMenuBar::item:selected { background-color:qlineargradient(x1: 0, y1: 0, x2: 0.5, y2: 0.5,stop: 0 rgb(35,35,35), stop: 1 rgb(0,232,204)); }");

#ifndef Q_OS_MAC
    qApp->setWindowIcon(QIcon(":icons/bitcoin"));
    setWindowIcon(QIcon(":icons/bitcoin"));
#else
    setUnifiedTitleAndToolBarOnMac(true);
    QApplication::setAttribute(Qt::AA_DontShowIconsInMenus);
#endif
    // Accept D&D of URIs
    setAcceptDrops(true);

    // Create actions for the toolbar, menu bar and tray/dock icon
    createActions();

    // Create application menu bar
    createMenuBar();

    // Create the toolbars
   // createToolBars();

    createToolBars2();
    // Create the tray icon (or setup the dock icon)
    createTrayIcon();

    // Create tabs
    overviewPage = new OverviewPage();

    blockBrowser = new BlockBrowser(this);

    statisticsPage = new StatisticsPage(this);

    transactionsPage = new QWidget(this);
    QVBoxLayout *vbox = new QVBoxLayout();
    transactionView = new TransactionView(this);
    vbox->addWidget(transactionView);
    transactionsPage->setLayout(vbox);

    addressBookPage = new AddressBookPage(AddressBookPage::ForEditing, AddressBookPage::SendingTab);

    receiveCoinsPage = new AddressBookPage(AddressBookPage::ForEditing, AddressBookPage::ReceivingTab);

    sendCoinsPage = new SendCoinsDialog(this);

    signVerifyMessageDialog = new SignVerifyMessageDialog(this);

    centralWidget = new QStackedWidget(this);
    centralWidget->addWidget(overviewPage);
    centralWidget->addWidget(transactionsPage);
    centralWidget->addWidget(addressBookPage);
    centralWidget->addWidget(receiveCoinsPage);
    centralWidget->addWidget(sendCoinsPage);
    centralWidget->addWidget(blockBrowser);
    centralWidget->addWidget(statisticsPage);

    setCentralWidget(centralWidget);

    // Create status bar
    statusBar();

    // Status bar notification icons
    QFrame *frameBlocks = new QFrame();
    frameBlocks->setContentsMargins(0,0,0,0);
    frameBlocks->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Preferred);
    QHBoxLayout *frameBlocksLayout = new QHBoxLayout(frameBlocks);
    frameBlocksLayout->setContentsMargins(3,0,3,0);
    frameBlocksLayout->setSpacing(3);
    labelEncryptionIcon = new QLabel();
    labelStakingIcon = new QLabel();
    labelConnectionsIcon = new QLabel();
    labelBlocksIcon = new QLabel();
    frameBlocksLayout->addStretch();
    frameBlocksLayout->addWidget(labelEncryptionIcon);
    frameBlocksLayout->addStretch();
    frameBlocksLayout->addWidget(labelStakingIcon);
    frameBlocksLayout->addStretch();
    frameBlocksLayout->addWidget(labelConnectionsIcon);
    frameBlocksLayout->addStretch();
    frameBlocksLayout->addWidget(labelBlocksIcon);
    frameBlocksLayout->addStretch();

    if (GetBoolArg("-staking", true))
    {
        QTimer *timerStakingIcon = new QTimer(labelStakingIcon);
        connect(timerStakingIcon, SIGNAL(timeout()), this, SLOT(updateStakingIcon()));
        timerStakingIcon->start(30 * 1000);
        updateStakingIcon();
    }

    // Progress bar and label for blocks download
    progressBarLabel = new QLabel();
    progressBarLabel->setVisible(false);
    progressBar = new QProgressBar();
    progressBar->setAlignment(Qt::AlignCenter);
    progressBar->setVisible(false);

    // Override style sheet for progress bar for styles that have a segmented progress bar,
    // as they make the text unreadable (workaround for issue #1071)
    // See https://qt-project.org/doc/qt-4.8/gallery.html
    QString curStyle = qApp->style()->metaObject()->className();
    if(curStyle == "QWindowsStyle" || curStyle == "QWindowsXPStyle")
    {
        progressBar->setStyleSheet("QProgressBar { background-color: #e8e8e8; border: 1px solid grey; border-radius: 7px; padding: 1px; text-align: center; } QProgressBar::chunk { background: QLinearGradient(x1: 0, y1: 0, x2: 1, y2: 0, stop: 0 #FF8000, stop: 1 orange); border-radius: 7px; margin: 0px; }");
    }

    statusBar()->addWidget(progressBarLabel);
    statusBar()->addWidget(progressBar);
    statusBar()->addPermanentWidget(frameBlocks);
	
    statusBar()->setStyleSheet(  "QStatusBar{      background-color:qlineargradient(x1: 0, y1: 0, x2: 0.5, y2: 0.5,stop: 0 rgb(35,35,35), stop: 1 rgb(0,232,204));               }"    );
	
	
	//  "QMenuBar { background-color:qlineargradient(x1: 0, y1: 0, x2: 0.5, y2: 0.5,stop: 0 rgb(35,35,35), stop: 1 rgb(0,141,210));  color:white; }"
	
	
//statusBar()->setStyleSheet("QStatusBar{ background:rgb(0,141,210);}");

    syncIconMovie = new QMovie(":/movies/update_spinner", "mng", this);

    // Clicking on a transaction on the overview page simply sends you to transaction history page
    connect(overviewPage, SIGNAL(transactionClicked(QModelIndex)), this, SLOT(gotoHistoryPage()));
    connect(overviewPage, SIGNAL(transactionClicked(QModelIndex)), transactionView, SLOT(focusTransaction(QModelIndex)));

    // Double-clicking on a transaction on the transaction history page shows details
    connect(transactionView, SIGNAL(doubleClicked(QModelIndex)), transactionView, SLOT(showDetails()));

    rpcConsole = new RPCConsole(this);
    connect(openRPCConsoleAction, SIGNAL(triggered()), rpcConsole, SLOT(show()));

    // Clicking on "Verify Message" in the address book sends you to the verify message tab
    connect(addressBookPage, SIGNAL(verifyMessage(QString)), this, SLOT(gotoVerifyMessageTab(QString)));
    // Clicking on "Sign Message" in the receive coins page sends you to the sign message tab
    connect(receiveCoinsPage, SIGNAL(signMessage(QString)), this, SLOT(gotoSignMessageTab(QString)));

    gotoOverviewPage();
}
コード例 #27
0
ファイル: bitcoingui.cpp プロジェクト: Sorceror32/magi
BitcoinGUI::BitcoinGUI(QWidget *parent):
    QMainWindow(parent),
    clientModel(0),
    walletModel(0),
    encryptWalletAction(0),
    changePassphraseAction(0),
    lockWalletToggleAction(0),
    aboutQtAction(0),
    trayIcon(0),
    notificator(0),
    rpcConsole(0)
{
    resize(850, 550);
    setWindowTitle(tr("Coin Magi") + " - " + tr("Wallet"));
#ifndef Q_OS_MAC
    qApp->setWindowIcon(QIcon(":icons/bitcoin"));
    setWindowIcon(QIcon(":icons/bitcoin"));
#else
    setUnifiedTitleAndToolBarOnMac(true);
    QApplication::setAttribute(Qt::AA_DontShowIconsInMenus);
#endif
    // Accept D&D of URIs
    setAcceptDrops(true);

    setObjectName("MagiWallet");
    setStyleSheet("#MagiWallet { background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:1, stop:0 #eeeeee, stop:1.0 #fefefe); } QToolTip { color: #cecece; background-color: #333333;  border:0px;} ");

    // Create actions for the toolbar, menu bar and tray/dock icon
    createActions();

    // Create application menu bar
    createMenuBar();

    // Create the toolbars
    createToolBars();

    // Create the tray icon (or setup the dock icon)
    createTrayIcon();

    // Create tabs
    overviewPage = new OverviewPage();

    transactionsPage = new QWidget(this);
    QVBoxLayout *vbox = new QVBoxLayout();
    transactionView = new TransactionView(this);
    vbox->addWidget(transactionView);
    transactionsPage->setLayout(vbox);

    addressBookPage = new AddressBookPage(AddressBookPage::ForEditing, AddressBookPage::SendingTab);

    receiveCoinsPage = new AddressBookPage(AddressBookPage::ForEditing, AddressBookPage::ReceivingTab);

    sendCoinsPage = new SendCoinsDialog(this);

    signVerifyMessageDialog = new SignVerifyMessageDialog(this);

    centralWidget = new QStackedWidget(this);
    centralWidget->addWidget(overviewPage);
    centralWidget->addWidget(transactionsPage);
    centralWidget->addWidget(addressBookPage);
    centralWidget->addWidget(receiveCoinsPage);
    centralWidget->addWidget(sendCoinsPage);
    setCentralWidget(centralWidget);

    // Create status bar
    statusBar();

    // Status bar notification icons
    QFrame *frameBlocks = new QFrame();
    frameBlocks->setContentsMargins(0,0,0,0);
    frameBlocks->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Preferred);
    QHBoxLayout *frameBlocksLayout = new QHBoxLayout(frameBlocks);
    frameBlocksLayout->setContentsMargins(3,0,3,0);
    frameBlocksLayout->setSpacing(3);
    labelEncryptionIcon = new QLabel();
    labelMintingIcon = new QLabel();
    labelConnectionsIcon = new QLabel();
    labelBlocksIcon = new QLabel();
    frameBlocksLayout->addStretch();
    frameBlocksLayout->addWidget(labelEncryptionIcon);
    frameBlocksLayout->addStretch();
    frameBlocksLayout->addWidget(labelMintingIcon);
    frameBlocksLayout->addStretch();
    frameBlocksLayout->addWidget(labelConnectionsIcon);
    frameBlocksLayout->addStretch();
    frameBlocksLayout->addWidget(labelBlocksIcon);
    frameBlocksLayout->addStretch();

    labelEncryptionIcon->setObjectName("labelEncryptionIcon");
    labelConnectionsIcon->setObjectName("labelConnectionsIcon");
    labelBlocksIcon->setObjectName("labelBlocksIcon");
    labelMintingIcon->setObjectName("labelMintingIcon");
    labelEncryptionIcon->setStyleSheet("#labelEncryptionIcon QToolTip {color:#cecece;background-color:#333333;border:0px;}");
    labelConnectionsIcon->setStyleSheet("#labelConnectionsIcon QToolTip {color:#cecece;background-color:#333333;border:0px;}");
    labelBlocksIcon->setStyleSheet("#labelBlocksIcon QToolTip {color:#cecece;background-color:#333333;border:0px;}");
    labelMintingIcon->setStyleSheet("#labelMintingIcon QToolTip {color:#cecece;background-color:#333333;border:0px;}");

    // Set minting pixmap
    labelMintingIcon->setPixmap(QIcon(":/icons/minting").pixmap(STATUSBAR_ICONSIZE,STATUSBAR_ICONSIZE));
    labelMintingIcon->setEnabled(false);
    // Add timer to update minting icon
    QTimer *timerMintingIcon = new QTimer(labelMintingIcon);
    timerMintingIcon->start(MODEL_UPDATE_DELAY);
    connect(timerMintingIcon, SIGNAL(timeout()), this, SLOT(updateMintingIcon()));
    // Add timer to update minting weights
    QTimer *timerMintingWeights = new QTimer(labelMintingIcon);
    timerMintingWeights->start(30 * 1000);
    connect(timerMintingWeights, SIGNAL(timeout()), this, SLOT(updateMintingWeights()));
    // Set initial values for user and network weights
    nWeight = 0, nNetworkWeight = 0;

    // Progress bar and label for blocks download
    progressBarLabel = new QLabel();
    progressBarLabel->setVisible(false);
    progressBar = new QProgressBar();
    progressBar->setAlignment(Qt::AlignCenter);
    progressBar->setVisible(false);

    // Override style sheet for progress bar for styles that have a segmented progress bar,
    // as they make the text unreadable (workaround for issue #1071)
    // See https://qt-project.org/doc/qt-4.8/gallery.html
    QString curStyle = qApp->style()->metaObject()->className();
    if(curStyle == "QWindowsStyle" || curStyle == "QWindowsXPStyle")
    {
        progressBar->setStyleSheet("QProgressBar { background-color: #e8e8e8; border: 1px solid grey; border-radius: 7px; padding: 1px; text-align: center; } QProgressBar::chunk { background: QLinearGradient(x1: 0, y1: 0, x2: 1, y2: 0, stop: 0 #FF8000, stop: 1 orange); border-radius: 7px; margin: 0px; }");
    }

    statusBar()->addWidget(progressBarLabel);
    statusBar()->addWidget(progressBar);
    statusBar()->addPermanentWidget(frameBlocks);
    statusBar()->setObjectName("MagiStatusBar");
    statusBar()->setStyleSheet("#MagiStatusBar { border-top-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #4B4F52, stop:0.5 #8B8F92, stop:1.0 #8B8F92); border-top-width: 2px; border-top-style: inset; background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #666666, stop:0.5 #323232, stop:1.0 #111111); background-image: url(:images/shadowbar); background-repeat: repeat-x; background-position: bottom center; color: #ffffff; } QToolTip { color: #ffffff; background-color: #9D0000; border-width: 1px;border-color:#CA0D0D;}");

    syncIconMovie = new QMovie(":/movies/update_spinner", "mng", this);
    // this->setStyleSheet("background-color: #effbef;");

    // Clicking on a transaction on the overview page simply sends you to transaction history page
    connect(overviewPage, SIGNAL(transactionClicked(QModelIndex)), this, SLOT(gotoHistoryPage()));
    connect(overviewPage, SIGNAL(transactionClicked(QModelIndex)), transactionView, SLOT(focusTransaction(QModelIndex)));

    // Double-clicking on a transaction on the transaction history page shows details
    connect(transactionView, SIGNAL(doubleClicked(QModelIndex)), transactionView, SLOT(showDetails()));

    rpcConsole = new RPCConsole(this);
    connect(openRPCConsoleAction, SIGNAL(triggered()), rpcConsole, SLOT(show()));

    // Clicking on "Verify Message" in the address book sends you to the verify message tab
    connect(addressBookPage, SIGNAL(verifyMessage(QString)), this, SLOT(gotoVerifyMessageTab(QString)));
    // Clicking on "Sign Message" in the receive coins page sends you to the sign message tab
    connect(receiveCoinsPage, SIGNAL(signMessage(QString)), this, SLOT(gotoSignMessageTab(QString)));

    gotoOverviewPage();
}
コード例 #28
0
ファイル: quaternion_demo.cpp プロジェクト: OSVR/eigen-kalman
QWidget* RenderingWidget::createNavigationControlWidget()
{
  QWidget* panel = new QWidget();
  QVBoxLayout* layout = new QVBoxLayout();

  {
    QPushButton* but = new QPushButton("reset");
    but->setToolTip("move the camera to initial position (with animation)");
    layout->addWidget(but);
    connect(but, SIGNAL(clicked()), this, SLOT(resetCamera()));
  }
  {
    // navigation mode
    QGroupBox* box = new QGroupBox("navigation mode");
    QVBoxLayout* boxLayout = new QVBoxLayout;
    QButtonGroup* group = new QButtonGroup(panel);
    QRadioButton* but;
    but = new QRadioButton("turn around");
    but->setToolTip("look around an object");
    group->addButton(but, NavTurnAround);
    boxLayout->addWidget(but);
    but = new QRadioButton("fly");
    but->setToolTip("free navigation like a spaceship\n(this mode can also be enabled pressing the \"shift\" key)");
    group->addButton(but, NavFly);
    boxLayout->addWidget(but);
    group->button(mNavMode)->setChecked(true);
    connect(group, SIGNAL(buttonClicked(int)), this, SLOT(setNavMode(int)));
    box->setLayout(boxLayout);
    layout->addWidget(box);
  }
  {
    // track ball, rotation mode
    QGroupBox* box = new QGroupBox("rotation mode");
    QVBoxLayout* boxLayout = new QVBoxLayout;
    QButtonGroup* group = new QButtonGroup(panel);
    QRadioButton* but;
    but = new QRadioButton("stable trackball");
    group->addButton(but, RotationStable);
    boxLayout->addWidget(but);
    but->setToolTip("use the stable trackball implementation mapping\nthe 2D coordinates to 3D points on a sphere");
    but = new QRadioButton("standard rotation");
    group->addButton(but, RotationStandard);
    boxLayout->addWidget(but);
    but->setToolTip("standard approach mapping the x and y displacements\nas rotations around the camera's X and Y axes");
    group->button(mRotationMode)->setChecked(true);
    connect(group, SIGNAL(buttonClicked(int)), this, SLOT(setRotationMode(int)));
    box->setLayout(boxLayout);
    layout->addWidget(box);
  }
  {
    // interpolation mode
    QGroupBox* box = new QGroupBox("spherical interpolation");
    QVBoxLayout* boxLayout = new QVBoxLayout;
    QButtonGroup* group = new QButtonGroup(panel);
    QRadioButton* but;
    but = new QRadioButton("quaternion slerp");
    group->addButton(but, LerpQuaternion);
    boxLayout->addWidget(but);
    but->setToolTip("use quaternion spherical interpolation\nto interpolate orientations");
    but = new QRadioButton("euler angles");
    group->addButton(but, LerpEulerAngles);
    boxLayout->addWidget(but);
    but->setToolTip("use Euler angles to interpolate orientations");
    group->button(mNavMode)->setChecked(true);
    connect(group, SIGNAL(buttonClicked(int)), this, SLOT(setLerpMode(int)));
    box->setLayout(boxLayout);
    layout->addWidget(box);
  }
  layout->addItem(new QSpacerItem(0,0,QSizePolicy::Minimum,QSizePolicy::Expanding));
  panel->setLayout(layout);
  return panel;
}
コード例 #29
0
ファイル: digisettingsdialog.cpp プロジェクト: Qucs/qucs
DigiSettingsDialog::DigiSettingsDialog(TextDoc *Doc_)
                  : QDialog(Doc_) 
{
  Doc = Doc_;
  setWindowTitle(tr("Document Settings"));

  Expr.setPattern("[0-9][0-9a-zA-Z ]+"); // valid expression for LineEdit
  Validator = new QRegExpValidator(Expr, this);

  QVBoxLayout *all = new QVBoxLayout(this);
  all->setMargin(5);

  QGroupBox *setGroup = new QGroupBox(tr("Digital Simulation Settings"));
  all->addWidget(setGroup);
 
  QVBoxLayout *group = new QVBoxLayout();
  setGroup->setLayout(group);
   
  QButtonGroup *toggleGroup = new QButtonGroup();
  simRadio = new QRadioButton(tr("Simulation"));
  group->addWidget(simRadio);
  simRadio->setChecked(Doc->simulation);

  QHBoxLayout *hb1 = new QHBoxLayout();
  hb1->setSpacing(5);
  TimeLabel = new QLabel(tr("Duration of Simulation:"));
  hb1->addWidget(TimeLabel);
  Doc->loadSimulationTime(SimTime);
  TimeEdit = new QLineEdit();
  hb1->addWidget(TimeEdit);
  TimeEdit->setValidator(Validator);
  TimeEdit->setText(SimTime);
  group->addLayout(hb1);

  QRadioButton *comRadio = new QRadioButton(tr("Precompile Module"));
  group->addWidget(comRadio);
  toggleGroup->addButton(simRadio);
  toggleGroup->addButton(comRadio);
  connect(toggleGroup, SIGNAL(buttonClicked(int)), SLOT(slotChangeMode(int)));

  QHBoxLayout *hb3 = new QHBoxLayout();
  hb3->setSpacing(5);
  NameLabel = new QLabel(tr("Library Name:"));
  hb3->addWidget(NameLabel);
  NameEdit = new QLineEdit();
  hb3->addWidget(NameEdit);
  NameEdit->setText(Doc->Library);
  group->addLayout(hb3);

  group->addSpacing(15);
  
  QHBoxLayout *hb2 = new QHBoxLayout();
  hb2->setSpacing(5);
  LibLabel = new QLabel(tr("Libraries:"));
  hb2->addWidget(LibLabel);
  LibEdit = new QLineEdit();
  hb2->addWidget(LibEdit);
  LibEdit->setText(Doc->Libraries);
  group->addLayout(hb2);

  all->addSpacing(5);
  all->addStretch();
  QHBoxLayout *Buttons = new QHBoxLayout();
  QPushButton *ButtonOk = new QPushButton(tr("Ok"));
  QPushButton *ButtonCancel = new QPushButton(tr("Cancel"));
  Buttons->addWidget(ButtonOk);
  Buttons->addWidget(ButtonCancel);
  connect(ButtonOk, SIGNAL(clicked()), SLOT(slotOk()));
  connect(ButtonCancel, SIGNAL(clicked()), SLOT(reject()));
  all->addLayout(Buttons);

  simRadio->setChecked(Doc->simulation);
  Doc->SimOpenDpl = Doc->simulation ? true : false;
  comRadio->setChecked(!Doc->simulation);
  slotChangeMode(!Doc->simulation);

  ButtonOk->setDefault(true);
  if(Doc->simulation) {
    setFocusProxy(TimeEdit);
    TimeEdit->setFocus();
  }
  else {
    setFocusProxy(NameEdit);
    NameEdit->setFocus();
  }
}
コード例 #30
0
ファイル: Downloader.cpp プロジェクト: wdastru/FantaCalcGui
Downloader::Downloader(QWidget *parent, std::vector<QUrl>* _urls,
		std::vector<QString>* _savePaths, bool _silent) :
	QDialog(parent) {

	DEBUG("");

	for (int i = 0; i < _savePaths->size(); ++i) {
		DEBUG("_savePaths.at(" << i << ") = " << _savePaths->at(i).toStdString().c_str());
	}

	this->setFont(THE_REPO->fontVariableWidthSmall);

	this->silent = _silent; // per evitare di notificare l'avvenuto download in
	this->resize(600, 0);
	this->setMinimumSize(600, 0);

	this->savePaths = _savePaths;
	this->urls = _urls;
	this->statusLabelText = "";
	this->hasBeenQuitted = false;
	this->httpRequestSucceded = false;
	this->httpClients.resize(urls->size());

	for (size_t i = 0; i < this->urls->size(); i++) {
		this->urlLineEditVector.push_back(
				new QLineEdit(this->urls->at(i).path()));
		this->urlLineEditVector.at(i)->setReadOnly(true);
		this->urlLineEditVector.at(i)->setStyleSheet(
				"border-color: rgb(255, 0, 0); background-color: rgb(255, 200, 200);");
		this->urlLineEditVector.at(i)->setFont(THE_REPO->fontVariableWidthSmall);
		this->urlLabelVector.push_back(new QLabel(tr("URL:")));
	}

	statusLabel = new QLabel(tr("Please enter the URL of a file you want to download."));

	downloadButton = new QPushButton(tr("Download"));
	downloadButton->setDefault(true);
	quitButton = new QPushButton(tr("Cancel"));
	quitButton->setAutoDefault(false);

	buttonBox = new QDialogButtonBox;
	buttonBox->addButton(downloadButton, QDialogButtonBox::ActionRole);
	buttonBox->addButton(quitButton, QDialogButtonBox::RejectRole);

	connect(downloadButton, SIGNAL(clicked()), this, SLOT(downloadFiles()));
	connect(quitButton, SIGNAL(clicked()), this, SLOT(quit()));

	QVBoxLayout *vLayout = new QVBoxLayout;
	for (size_t i = 0; i < this->urls->size(); i++) {
		QHBoxLayout *hLayout = new QHBoxLayout;
		hLayout->addWidget(this->urlLabelVector.at(i));
		hLayout->addWidget(this->urlLineEditVector.at(i));
		vLayout->addLayout(hLayout);
	}

	QVBoxLayout *mainLayout = new QVBoxLayout;
	mainLayout->addLayout(vLayout);
	mainLayout->addWidget(buttonBox);

	setLayout(mainLayout);
	this->setWindowTitle("FantaCalcGui - Download");

	if (silent) {
		this->downloadFiles();
		/*
		 * TODO:
		 * indagare cosa succede se silent == FALSE
		 * eventualmente aggiungere un else
		 *
		 * * * * * * * * * * * * * * * * * * * * */
	}
}