コード例 #1
0
ファイル: prefswages.cpp プロジェクト: KDE/kraft
PrefsWages::PrefsWages(QWidget* parent)
  : QWidget(parent)
{
  QVBoxLayout *vboxLay = new QVBoxLayout;

  mWagesModel = new QSqlTableModel(this);
  mWagesModel->setTable("stdSaetze");
  mWagesModel->setSort(3, Qt::AscendingOrder);
  mWagesModel->setEditStrategy(QSqlTableModel::OnManualSubmit);
  mWagesModel->select();
  mWagesModel->setHeaderData(0, Qt::Horizontal, tr("ID"));
  mWagesModel->setHeaderData(1, Qt::Horizontal, tr("Code"));
  mWagesModel->setHeaderData(2, Qt::Horizontal, tr("Price"));
  mWagesModel->setHeaderData(3, Qt::Horizontal, tr("Sortkey"));

  mProxyModel = new QSortFilterProxyModel(this);
  mProxyModel->setSourceModel(mWagesModel);

  mWagesTreeView = new ImpTreeView;
  vboxLay->addWidget( mWagesTreeView );
  mWagesTreeView->setModel(mProxyModel);
  mWagesTreeView->setItemDelegate(new WagesItemDelegate());
  mWagesTreeView->hideColumn(0);
  mWagesTreeView->hideColumn(3);
  mWagesTreeView->header()->stretchLastSection();
  mWagesTreeView->setColumnWidth(1, 200);
  mWagesTreeView->resizeColumnToContents(2);
  mWagesTreeView->resizeColumnToContents(1);
  mWagesTreeView->setEditTriggers(ImpTreeView::NoEditTriggers);

  connect( mWagesTreeView, SIGNAL(clicked(QModelIndex)),
           SLOT( slotWageSelected(QModelIndex) ) );

  connect( mWagesTreeView, SIGNAL(doubleClicked(QModelIndex)),
           SLOT(slotEditWage(QModelIndex)));

  QHBoxLayout *butLay = new QHBoxLayout;
  butLay->addStretch( 1 );

  mUp = new KPushButton( KIcon("arrow-up"), i18n( "Up" ));
  connect( mUp, SIGNAL( clicked() ), SLOT( slotUp() ) );
  butLay->addWidget( mUp );
  mUp->setEnabled(false);

  mDown = new KPushButton( KIcon("arrow-down"), i18n( "Down" ));
  connect( mDown, SIGNAL( clicked() ), SLOT( slotDown() ) );
  butLay->addWidget( mDown );
  mDown->setEnabled(false);

  KPushButton *but = new KPushButton( KIcon("list-add"), i18n( "Add" ));
  connect( but, SIGNAL( clicked() ), SLOT( slotAddWage() ) );
  butLay->addWidget( but );

  mEditWage = new KPushButton( KIcon("document-edit"), i18n( "Edit" ));
  connect( mEditWage, SIGNAL( clicked() ), SLOT( slotEditWage() ) );
  butLay->addWidget( mEditWage );
  mEditWage->setEnabled(false);

  mDelWage = new KPushButton( KIcon("list-remove"), i18n( "Remove" ) );
  connect( mDelWage, SIGNAL( clicked() ), SLOT( slotDeleteWage() ) );
  butLay->addWidget( mDelWage );
  mDelWage->setEnabled( false );

  vboxLay->addLayout( butLay );
  this->setLayout( vboxLay );
}
コード例 #2
0
DayScreen::DayScreen(QWidget *parent) : QFrame(parent)
{
    formalBellEffect.setSource(QUrl("qrc:/sounds/FormalTimerBell.wav"));
    formalBellEffect.setVolume(0.80f);

    dayBellEffect.setSource(QUrl("qrc:/sounds/DayTimerBell.wav"));
    dayBellEffect.setVolume(0.80f);



    // Label showing day number with button to restart (send to character screen) in same row
    dayLabel = new QLabel;
    restartButton = new QPushButton("Restart");
    restartButton->setFocusPolicy(Qt::NoFocus);

    // Sends user to info screen
    infoButton = new InfoButton;

    QHBoxLayout *dayLayout = new QHBoxLayout;
    dayLayout->addWidget(dayLabel);
    dayLayout->addStretch();
    dayLayout->addWidget(restartButton);
    dayLayout->addWidget(infoButton);


    // Labels displaying day timer
    dayTimerButton = new QPushButton("Timer");
    dayTimerButton->setCheckable(true);
    dayTimerButton->setFocusPolicy(Qt::NoFocus);
    dayTimerLabel = new QLabel;
    dayTimerLabel->setObjectName("dayTimerLabel");
    dayTimer = new QTimer(this);

    /*
    QHBoxLayout *dayTimerLayout = new QHBoxLayout;
    dayTimerLayout->addWidget(dayTimerButton);
    dayTimerLayout->addStretch();
    dayTimerLayout->addWidget(dayTimerLabel);
    dayTimerLayout->addStretch();
    */

    // Button which when pushed, starts the formal timer
    formalTimerButton = new QPushButton("Formal");
    formalTimerButton->setCheckable(true);
    formalTimerButton->setFocusPolicy(Qt::NoFocus);
    formalTimerLabel = new QLabel;
    formalTimerLabel->setObjectName("formalTimerLabel");
    formalTimer = new QTimer(this);
    resetTimers();

    /*
    QHBoxLayout *formalTimerLayout = new QHBoxLayout;
    formalTimerLayout->addWidget(formalTimerButton);
    formalTimerLayout->addStretch();
    formalTimerLayout->addWidget(formalTimerLabel);
    formalTimerLayout->addStretch();
    */

    QGridLayout *timersLayout = new QGridLayout;
    timersLayout->addWidget(dayTimerButton, 0, 0);
    timersLayout->addWidget(dayTimerLabel, 0, 2);
    timersLayout->addWidget(formalTimerButton, 2, 0);
    timersLayout->addWidget(formalTimerLabel, 2, 2);
    //timersLayout->setContentsMargins(30, 30, 30, 30);
    timersLayout->setColumnMinimumWidth(1, 40);
    timersLayout->setRowMinimumHeight(1, 40);

    // Buttons for navigating to the morning phase, or start a new night phase
    prevButton = new QPushButton("Previous");
    prevButton->setFocusPolicy(Qt::NoFocus);
    nightButton = new QPushButton("Night");
    nightButton->setFocusPolicy(Qt::NoFocus);

    QHBoxLayout *navigBtnLayout = new QHBoxLayout;

    navigBtnLayout->addWidget(prevButton);
    navigBtnLayout->addStretch();
    navigBtnLayout->addWidget(nightButton);

    QVBoxLayout *dayScreenLayout = new QVBoxLayout;
    dayScreenLayout->addLayout(dayLayout);
    dayScreenLayout->addStretch();
    dayScreenLayout->addLayout(timersLayout);
    //dayScreenLayout->addLayout(dayTimerLayout);
    //dayScreenLayout->addLayout(formalTimerLayout);
    dayScreenLayout->addStretch();
    dayScreenLayout->addLayout(navigBtnLayout);

    setLayout(dayScreenLayout);

    connect(dayTimer, &QTimer::timeout, this, &DayScreen::updateDayTimer);
    connect(dayTimerButton, &QPushButton::clicked, this, &DayScreen::startDayTimer);

    connect(formalTimer, &QTimer::timeout, this, &DayScreen::updateFormalTimer);
    connect(formalTimerButton, &QPushButton::clicked, this, &DayScreen::startFormalTimer);
}
コード例 #3
0
QWidget *ServerDialog::createAdvancedTab(){
    QVBoxLayout *layout = new QVBoxLayout;

    contest_mode_checkbox = new QCheckBox(tr("Contest mode"));
    contest_mode_checkbox->setChecked(Config.ContestMode);
    contest_mode_checkbox->setToolTip(tr("Requires password to login, hide screen name and disable kicking"));

    free_choose_checkbox = new QCheckBox(tr("Choose generals and cards freely"));
    free_choose_checkbox->setToolTip(tr("This option enables the cheat menu"));
    free_choose_checkbox->setChecked(Config.FreeChoose);

    free_assign_checkbox = new QCheckBox(tr("Assign role and seat freely"));
    free_assign_checkbox->setChecked(Config.value("FreeAssign").toBool());

    free_assign_self_checkbox = new QCheckBox(tr("Assign only your own role"));
    free_assign_self_checkbox->setChecked(Config.FreeAssignSelf);
    free_assign_self_checkbox->setEnabled(free_assign_checkbox->isChecked());
    connect(free_assign_checkbox,SIGNAL(toggled(bool)), free_assign_self_checkbox, SLOT(setEnabled(bool)));

    maxchoice_spinbox = new QSpinBox;
    maxchoice_spinbox->setRange(3, 10);
    maxchoice_spinbox->setValue(Config.value("MaxChoice", 5).toInt());

    forbid_same_ip_checkbox = new QCheckBox(tr("Forbid same IP with multiple connection"));
    forbid_same_ip_checkbox->setChecked(Config.ForbidSIMC);

    disable_chat_checkbox = new QCheckBox(tr("Disable chat"));
    disable_chat_checkbox->setChecked(Config.DisableChat);

    second_general_checkbox = new QCheckBox(tr("Enable second general"));

    scene_checkbox  = new QCheckBox(tr("Enable Scene"));

    scene_checkbox->setChecked(Config.EnableScene);	//changjing

    same_checkbox  = new QCheckBox(tr("Enable Same"));
    same_checkbox->setChecked(Config.EnableSame);

    max_hp_label = new QLabel(tr("Max HP scheme"));
    max_hp_scheme_combobox = new QComboBox;
    max_hp_scheme_combobox->addItem(tr("Sum - 3"));
    max_hp_scheme_combobox->addItem(tr("Minimum"));
    max_hp_scheme_combobox->addItem(tr("Average"));
    max_hp_scheme_combobox->setCurrentIndex(Config.MaxHpScheme);
    second_general_checkbox->setChecked(Config.Enable2ndGeneral);

    basara_checkbox = new QCheckBox(tr("Enable Basara"));
    basara_checkbox->setChecked(Config.EnableBasara);
    updateButtonEnablility(mode_group->checkedButton());
    connect(mode_group,SIGNAL(buttonClicked(QAbstractButton*)),this,SLOT(updateButtonEnablility(QAbstractButton*)));

    hegemony_checkbox = new QCheckBox(tr("Enable Hegemony"));
    hegemony_checkbox->setChecked(Config.EnableHegemony);
    hegemony_checkbox->setEnabled(basara_checkbox->isChecked());
    connect(basara_checkbox,SIGNAL(toggled(bool)),hegemony_checkbox, SLOT(setEnabled(bool)));

    announce_ip_checkbox = new QCheckBox(tr("Annouce my IP in WAN"));
    announce_ip_checkbox->setChecked(Config.AnnounceIP);
    announce_ip_checkbox->setEnabled(false); // not support now

    address_edit = new QLineEdit;
    address_edit->setText(Config.Address);

    #if QT_VERSION >= 0x040700
    address_edit->setPlaceholderText(tr("Public IP or domain"));
    #endif

    QPushButton *detect_button = new QPushButton(tr("Detect my WAN IP"));
    connect(detect_button, SIGNAL(clicked()), this, SLOT(onDetectButtonClicked()));

    //address_edit->setEnabled(announce_ip_checkbox->isChecked());
    // connect(announce_ip_checkbox, SIGNAL(toggled(bool)), address_edit, SLOT(setEnabled(bool)));

    port_edit = new QLineEdit;
    port_edit->setText(QString::number(Config.ServerPort));
    port_edit->setValidator(new QIntValidator(1, 9999, port_edit));

    layout->addWidget(contest_mode_checkbox);
    layout->addWidget(forbid_same_ip_checkbox);
    layout->addWidget(disable_chat_checkbox);
    layout->addLayout(HLay(free_choose_checkbox, free_assign_checkbox));
    layout->addWidget(free_assign_self_checkbox);
    layout->addLayout(HLay(new QLabel(tr("Upperlimit for general")), maxchoice_spinbox));
    layout->addWidget(second_general_checkbox);
    layout->addLayout(HLay(max_hp_label, max_hp_scheme_combobox));
    layout->addLayout(HLay(basara_checkbox, hegemony_checkbox));
    layout->addLayout(HLay(scene_checkbox, same_checkbox));
    layout->addWidget(announce_ip_checkbox);
    layout->addLayout(HLay(new QLabel(tr("Address")), address_edit));
    layout->addWidget(detect_button);
    layout->addLayout(HLay(new QLabel(tr("Port")), port_edit));
    layout->addStretch();

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

    max_hp_label->setVisible(Config.Enable2ndGeneral);
    connect(second_general_checkbox, SIGNAL(toggled(bool)), max_hp_label, SLOT(setVisible(bool)));
    max_hp_scheme_combobox->setVisible(Config.Enable2ndGeneral);
    connect(second_general_checkbox, SIGNAL(toggled(bool)), max_hp_scheme_combobox, SLOT(setVisible(bool)));

    return widget;
}
コード例 #4
0
MainOptionsPage::MainOptionsPage(QWidget *parent):
        QWidget(parent)
{
    QVBoxLayout *layout = new QVBoxLayout();

    bitcoin_at_startup = new QCheckBox(tr("&Start AudioCoin on window system startup"));
    bitcoin_at_startup->setToolTip(tr("Automatically start AudioCoin after the computer is turned on"));
    layout->addWidget(bitcoin_at_startup);

#ifndef Q_WS_MAC
    minimize_to_tray = new QCheckBox(tr("&Minimize to the tray instead of the taskbar"));
    minimize_to_tray->setToolTip(tr("Show only a tray icon after minimizing the window"));
    layout->addWidget(minimize_to_tray);

    minimize_on_close = new QCheckBox(tr("M&inimize on close"));
    minimize_on_close->setToolTip(tr("Minimize instead of exit the application when the window is closed. When this option is enabled, the application will be closed only after selecting Quit in the menu."));
    layout->addWidget(minimize_on_close);
#endif

    map_port_upnp = new QCheckBox(tr("Map port using &UPnP"));
    map_port_upnp->setToolTip(tr("Automatically open the AudioCoin client port on the router. This only works when your router supports UPnP and it is enabled."));
    layout->addWidget(map_port_upnp);

    connect_socks4 = new QCheckBox(tr("&Connect through SOCKS4 proxy:"));
    connect_socks4->setToolTip(tr("Connect to the Bitcon network through a SOCKS4 proxy (e.g. when connecting through Tor)"));
    layout->addWidget(connect_socks4);

    QHBoxLayout *proxy_hbox = new QHBoxLayout();
    proxy_hbox->addSpacing(18);
    QLabel *proxy_ip_label = new QLabel(tr("Proxy &IP: "));
    proxy_hbox->addWidget(proxy_ip_label);
    proxy_ip = new QLineEdit();
    proxy_ip->setMaximumWidth(140);
    proxy_ip->setEnabled(false);
    proxy_ip->setValidator(new QRegExpValidator(QRegExp("[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}"), this));
    proxy_ip->setToolTip(tr("IP address of the proxy (e.g. 127.0.0.1)"));
    proxy_ip_label->setBuddy(proxy_ip);
    proxy_hbox->addWidget(proxy_ip);
    QLabel *proxy_port_label = new QLabel(tr("&Port: "));
    proxy_hbox->addWidget(proxy_port_label);
    proxy_port = new QLineEdit();
    proxy_port->setMaximumWidth(55);
    proxy_port->setValidator(new QIntValidator(0, 65535, this));
    proxy_port->setEnabled(false);
    proxy_port->setToolTip(tr("Port of the proxy (e.g. 1234)"));
    proxy_port_label->setBuddy(proxy_port);
    proxy_hbox->addWidget(proxy_port);
    proxy_hbox->addStretch(1);

    layout->addLayout(proxy_hbox);
    QLabel *fee_help = new QLabel(tr("Optional transaction fee per kB that helps make sure your transactions are processed quickly. Most transactions are 1 kB. Fee 0.01 recommended."));
    fee_help->setWordWrap(true);
    layout->addWidget(fee_help);

    QHBoxLayout *fee_hbox = new QHBoxLayout();
    fee_hbox->addSpacing(18);
    QLabel *fee_label = new QLabel(tr("Pay transaction &fee"));
    fee_hbox->addWidget(fee_label);
    fee_edit = new BitcoinAmountField();

    fee_label->setBuddy(fee_edit);
    fee_hbox->addWidget(fee_edit);
    fee_hbox->addStretch(1);

    layout->addLayout(fee_hbox);

    detach_database = new QCheckBox(tr("Detach databases at shutdown"));
    detach_database->setToolTip(tr("Detach block and address databases at shutdown. This means they can be moved to another data directory, but it slows down shutdown. The wallet is always detached."));
    layout->addWidget(detach_database);

    layout->addStretch(1); // Extra space at bottom

    setLayout(layout);

    connect(connect_socks4, SIGNAL(toggled(bool)), proxy_ip, SLOT(setEnabled(bool)));
    connect(connect_socks4, SIGNAL(toggled(bool)), proxy_port, SLOT(setEnabled(bool)));

#ifndef USE_UPNP
    map_port_upnp->setDisabled(true);
#endif
}
コード例 #5
0
ファイル: dat_pnl.cpp プロジェクト: ClinicalGraphics/MathGL
//-----------------------------------------------------------------------------
void DatPanel::newdat()
{
	QLabel *l;
	QLineEdit *f1, *f2;
	QPushButton *b;
	QDialog *d = new QDialog(this);
	d->setWindowTitle(tr("UDAV - make new data"));
	QVBoxLayout *v = new QVBoxLayout(d);
	QComboBox *c = new QComboBox(d);	v->addWidget(c);
	c->addItem(tr("Sum along direction(s)"));
	c->addItem(tr("Min along direction(s)"));
	c->addItem(tr("Max along direction(s)"));
	c->addItem(tr("Momentum along 'x' for function"));
	c->addItem(tr("Momentum along 'y' for function"));
	c->addItem(tr("Momentum along 'z' for function"));
	c->setCurrentIndex(0);

	f1 = new QLineEdit("z",d);	v->addWidget(f1);
	QCheckBox *cb = new QCheckBox(tr("Put into this data array"), d);	v->addWidget(cb);
	l = new QLabel(tr("or enter name for new variable"), d);	v->addWidget(l);
	f2 = new QLineEdit(d);		v->addWidget(f2);
	QHBoxLayout *h = new QHBoxLayout();	v->addLayout(h);	h->addStretch(1);
	b = new QPushButton(tr("Cancel"), d);	h->addWidget(b);
	connect(b, SIGNAL(clicked()), d, SLOT(reject()));
	b = new QPushButton(tr("OK"), d);		h->addWidget(b);
	connect(b, SIGNAL(clicked()), d, SLOT(accept()));
	b->setDefault(true);
	// now execute dialog and get values
	bool res = d->exec();
	QString 	val = f1->text(), mgl;
	int k = c->currentIndex();
	QString self = QString::fromWCharArray(var->s.c_str());
	if(res)
	{
		if(k<0)
		{
			QMessageBox::warning(d, tr("UDAV - make new data"),
				tr("No action is selected. Do nothing."));
			return;
		}
		if(val.isEmpty())
		{
			QMessageBox::warning(d, tr("UDAV - make new data"),
				tr("No direction/formula is entered. Do nothing."));
			return;
		}
		if(cb->isChecked())	k += 6;
		QString name = f2->text();
		switch(k)
		{
		case 0:	mgl = "sum "+name+" "+self+" '"+val+"'";	break;
		case 1:	mgl = "min "+name+" "+self+" '"+val+"'";	break;
		case 2:	mgl = "max "+name+" "+self+" '"+val+"'";	break;
		case 3:	mgl = "momentum "+name+" "+self+" 'x' '"+val+"'";	break;
		case 4:	mgl = "momentum "+name+" "+self+" 'y' '"+val+"'";	break;
		case 5:	mgl = "momentum "+name+" "+self+" 'z' '"+val+"'";	break;
		case 6:	mgl = "copy "+self+" {sum "+self+" '"+val+"'}";	break;
		case 7:	mgl = "copy "+self+" {min "+self+" '"+val+"'}";	break;
		case 8:	mgl = "copy "+self+" {max "+self+" '"+val+"'}";	break;
		case 9:	mgl = "copy "+self+" {momentum "+self+" 'x' '"+val+"'}";	break;
		case 10:	mgl = "copy "+self+" {momentum "+self+" 'y' '"+val+"'}";	break;
		case 11:	mgl = "copy "+self+" {momentum "+self+" 'z' '"+val+"'}";	break;
		}
	}
	if(!mgl.isEmpty())
	{
		mglGraph gr;
		parser.Execute(&gr,mgl.toLocal8Bit().constData());
		if(k>=6)	opers += mgl+"\n";
		updateDataItems();
	}
}
コード例 #6
0
AerolabWindow::AerolabWindow(Context *context) :
  GcWindow(context), context(context) {
    setControls(NULL);

  // Aerolab tab layout:
  QVBoxLayout *vLayout      = new QVBoxLayout;
  QHBoxLayout *cLayout      = new QHBoxLayout;

  // Plot:
  aerolab = new Aerolab(this, context);

  // Left controls layout:
  QVBoxLayout *leftControls  =  new QVBoxLayout;
  QFontMetrics metrics(QApplication::font());
  int labelWidth1 = metrics.width("Crr") + 10;

  // Crr:
  QHBoxLayout *crrLayout = new QHBoxLayout;
  QLabel *crrLabel = new QLabel(tr("Crr"), this);
  crrLabel->setFixedWidth(labelWidth1);
  crrLineEdit = new QLineEdit();
  crrLineEdit->setFixedWidth(75);
  crrLineEdit->setText(QString("%1").arg(aerolab->getCrr()) );
  /*crrQLCDNumber    = new QLCDNumber(7);
  crrQLCDNumber->setMode(QLCDNumber::Dec);
  crrQLCDNumber->setSmallDecimalPoint(false);
  crrQLCDNumber->setSegmentStyle(QLCDNumber::Flat);
  crrQLCDNumber->display(QString("%1").arg(aerolab->getCrr()) );*/
  crrSlider = new QSlider(Qt::Horizontal);
  crrSlider->setTickPosition(QSlider::TicksBelow);
  crrSlider->setTickInterval(1000);
  crrSlider->setMinimum(1000);
  crrSlider->setMaximum(10000);
  crrSlider->setValue(aerolab->intCrr());
  crrLayout->addWidget( crrLabel );
  crrLayout->addWidget( crrLineEdit );
  //crrLayout->addWidget( crrQLCDNumber );
  crrLayout->addWidget( crrSlider );

  // CdA:
  QHBoxLayout *cdaLayout = new QHBoxLayout;
  QLabel *cdaLabel = new QLabel(tr("CdA"), this);
  cdaLabel->setFixedWidth(labelWidth1);
  cdaLineEdit = new QLineEdit();
  cdaLineEdit->setFixedWidth(75);
  cdaLineEdit->setText(QString("%1").arg(aerolab->getCda()) );
  /*cdaQLCDNumber    = new QLCDNumber(7);
  cdaQLCDNumber->setMode(QLCDNumber::Dec);
  cdaQLCDNumber->setSmallDecimalPoint(false);
  cdaQLCDNumber->setSegmentStyle(QLCDNumber::Flat);
  cdaQLCDNumber->display(QString("%1").arg(aerolab->getCda()) );*/
  cdaSlider = new QSlider(Qt::Horizontal);
  cdaSlider->setTickPosition(QSlider::TicksBelow);
  cdaSlider->setTickInterval(100);
  cdaSlider->setMinimum(1);
  cdaSlider->setMaximum(6000);
  cdaSlider->setValue(aerolab->intCda());
  cdaLayout->addWidget( cdaLabel );
  //cdaLayout->addWidget( cdaQLCDNumber );
  cdaLayout->addWidget( cdaLineEdit );
  cdaLayout->addWidget( cdaSlider );

  // Eta:
  QHBoxLayout *etaLayout = new QHBoxLayout;
  QLabel *etaLabel = new QLabel(tr("Eta"), this);
  etaLabel->setFixedWidth(labelWidth1);
  etaLineEdit = new QLineEdit();
  etaLineEdit->setFixedWidth(75);
  etaLineEdit->setText(QString("%1").arg(aerolab->getEta()) );
  /*etaQLCDNumber    = new QLCDNumber(7);
  etaQLCDNumber->setMode(QLCDNumber::Dec);
  etaQLCDNumber->setSmallDecimalPoint(false);
  etaQLCDNumber->setSegmentStyle(QLCDNumber::Flat);
  etaQLCDNumber->display(QString("%1").arg(aerolab->getEta()) );*/
  etaSlider = new QSlider(Qt::Horizontal);
  etaSlider->setTickPosition(QSlider::TicksBelow);
  etaSlider->setTickInterval(1000);
  etaSlider->setMinimum(8000);
  etaSlider->setMaximum(12000);
  etaSlider->setValue(aerolab->intEta());
  etaLayout->addWidget( etaLabel );
  etaLayout->addWidget( etaLineEdit );
  //etaLayout->addWidget( etaQLCDNumber );
  etaLayout->addWidget( etaSlider );


  // Add to leftControls:
  leftControls->addLayout( crrLayout );
  leftControls->addLayout( cdaLayout );
  leftControls->addLayout( etaLayout );

  // Right controls layout:
  QVBoxLayout *rightControls  =  new QVBoxLayout;
  int labelWidth2 = metrics.width("Total Mass (kg)") + 10;

  // Total mass:
  QHBoxLayout *mLayout = new QHBoxLayout;
  QLabel *mLabel = new QLabel(tr("Total Mass (kg)"), this);
  mLabel->setFixedWidth(labelWidth2);
  mLineEdit = new QLineEdit();
  mLineEdit->setFixedWidth(70);
  mLineEdit->setText(QString("%1").arg(aerolab->getTotalMass()) );
  /*mQLCDNumber    = new QLCDNumber(7);
  mQLCDNumber->setMode(QLCDNumber::Dec);
  mQLCDNumber->setSmallDecimalPoint(false);
  mQLCDNumber->setSegmentStyle(QLCDNumber::Flat);
  mQLCDNumber->display(QString("%1").arg(aerolab->getTotalMass()) );*/
  mSlider = new QSlider(Qt::Horizontal);
  mSlider->setTickPosition(QSlider::TicksBelow);
  mSlider->setTickInterval(1000);
  mSlider->setMinimum(3500);
  mSlider->setMaximum(15000);
  mSlider->setValue(aerolab->intTotalMass());
  mLayout->addWidget( mLabel );
  mLayout->addWidget( mLineEdit );
  //mLayout->addWidget( mQLCDNumber );
  mLayout->addWidget( mSlider );

  // Rho:
  QHBoxLayout *rhoLayout = new QHBoxLayout;
  QLabel *rhoLabel = new QLabel(tr("Rho (kg/m^3)"), this);
  rhoLabel->setFixedWidth(labelWidth2);
  rhoLineEdit = new QLineEdit();
  rhoLineEdit->setFixedWidth(70);
  rhoLineEdit->setText(QString("%1").arg(aerolab->getRho()) );
  /*rhoQLCDNumber    = new QLCDNumber(7);
  rhoQLCDNumber->setMode(QLCDNumber::Dec);
  rhoQLCDNumber->setSmallDecimalPoint(false);
  rhoQLCDNumber->setSegmentStyle(QLCDNumber::Flat);
  rhoQLCDNumber->display(QString("%1").arg(aerolab->getRho()) );*/
  rhoSlider = new QSlider(Qt::Horizontal);
  rhoSlider->setTickPosition(QSlider::TicksBelow);
  rhoSlider->setTickInterval(1000);
  rhoSlider->setMinimum(9000);
  rhoSlider->setMaximum(14000);
  rhoSlider->setValue(aerolab->intRho());
  rhoLayout->addWidget( rhoLabel );
  rhoLayout->addWidget( rhoLineEdit );
  //rhoLayout->addWidget( rhoQLCDNumber );
  rhoLayout->addWidget( rhoSlider );

  // Elevation offset:
  QHBoxLayout *eoffsetLayout = new QHBoxLayout;
  QLabel *eoffsetLabel = new QLabel(tr("Eoffset (m)"), this);
  eoffsetLabel->setFixedWidth(labelWidth2);
  eoffsetLineEdit = new QLineEdit();
  eoffsetLineEdit->setFixedWidth(70);
  eoffsetLineEdit->setText(QString("%1").arg(aerolab->getEoffset()) );
  /*eoffsetQLCDNumber    = new QLCDNumber(7);
  eoffsetQLCDNumber->setMode(QLCDNumber::Dec);
  eoffsetQLCDNumber->setSmallDecimalPoint(false);
  eoffsetQLCDNumber->setSegmentStyle(QLCDNumber::Flat);
  eoffsetQLCDNumber->display(QString("%1").arg(aerolab->getEoffset()) );*/
  eoffsetSlider = new QSlider(Qt::Horizontal);
  eoffsetSlider->setTickPosition(QSlider::TicksBelow);
  eoffsetSlider->setTickInterval(20000);
  eoffsetSlider->setMinimum(-30000);
  eoffsetSlider->setMaximum(250000);
  eoffsetSlider->setValue(aerolab->intEoffset());
  eoffsetLayout->addWidget( eoffsetLabel );
  eoffsetLayout->addWidget( eoffsetLineEdit );
  //eoffsetLayout->addWidget( eoffsetQLCDNumber );
  eoffsetLayout->addWidget( eoffsetSlider );

  QVBoxLayout *checkboxLayout = new QVBoxLayout;
  QCheckBox *eoffsetAuto = new QCheckBox(tr("eoffset auto"), this);
  eoffsetAuto->setCheckState(Qt::Checked);
  checkboxLayout->addWidget(eoffsetAuto);

  QCheckBox *constantAlt = new QCheckBox(tr("Constant altitude (velodrome,...)"), this);
  checkboxLayout->addWidget(constantAlt);

  eoffsetLayout->addLayout(checkboxLayout);


  QHBoxLayout *smoothLayout = new QHBoxLayout;
  QComboBox *comboDistance = new QComboBox();
  comboDistance->addItem(tr("X Axis Shows Time"));
  comboDistance->addItem(tr("X Axis Shows Distance"));
  comboDistance->setCurrentIndex(1);
  smoothLayout->addWidget(comboDistance);

  QPushButton *btnEstCdACrr = new QPushButton(tr("&Estimate CdA and Crr"), this);
  smoothLayout->addWidget(btnEstCdACrr);

  // Add to leftControls:
  rightControls->addLayout( mLayout );
  rightControls->addLayout( rhoLayout );
  rightControls->addLayout( eoffsetLayout );
  rightControls->addLayout( smoothLayout );


  // Assemble controls layout:
  cLayout->addLayout(leftControls);
  cLayout->addLayout(rightControls);

  // Zoomer:
  allZoomer = new QwtPlotZoomer(aerolab->canvas());
  allZoomer->setRubberBand(QwtPicker::RectRubberBand);
  allZoomer->setTrackerMode(QwtPicker::AlwaysOff);
  allZoomer->setEnabled(true);
  allZoomer->setMousePattern( QwtEventPattern::MouseSelect2, Qt::RightButton, Qt::ControlModifier );
  allZoomer->setMousePattern( QwtEventPattern::MouseSelect3, Qt::RightButton );

  // SIGNALs to SLOTs:
  connect(this, SIGNAL(rideItemChanged(RideItem*)), this, SLOT(rideSelected()));
  connect(crrSlider, SIGNAL(valueChanged(int)),this, SLOT(setCrrFromSlider()));
  connect(crrLineEdit, SIGNAL(textChanged(const QString)), this, SLOT(setCrrFromText(const QString)));
  connect(cdaSlider, SIGNAL(valueChanged(int)), this, SLOT(setCdaFromSlider()));
  connect(cdaLineEdit, SIGNAL(textChanged(const QString)), this, SLOT(setCdaFromText(const QString)));
  connect(mSlider, SIGNAL(valueChanged(int)),this, SLOT(setTotalMassFromSlider()));
  connect(mLineEdit, SIGNAL(textChanged(const QString)), this, SLOT(setTotalMassFromText(const QString)));
  connect(rhoSlider, SIGNAL(valueChanged(int)), this, SLOT(setRhoFromSlider()));
  connect(rhoLineEdit, SIGNAL(textChanged(const QString)), this, SLOT(setRhoFromText(const QString)));
  connect(etaSlider, SIGNAL(valueChanged(int)), this, SLOT(setEtaFromSlider()));
  connect(etaLineEdit, SIGNAL(textChanged(const QString)), this, SLOT(setEtaFromText(const QString)));
  connect(eoffsetSlider, SIGNAL(valueChanged(int)), this, SLOT(setEoffsetFromSlider()));
  connect(eoffsetLineEdit, SIGNAL(textChanged(const QString)), this, SLOT(setEoffsetFromText(const QString)));
  connect(eoffsetAuto, SIGNAL(stateChanged(int)), this, SLOT(setAutoEoffset(int)));
  connect(constantAlt, SIGNAL(stateChanged(int)), this, SLOT(setConstantAlt(int)));
  connect(comboDistance, SIGNAL(currentIndexChanged(int)), this, SLOT(setByDistance(int)));
  connect(btnEstCdACrr, SIGNAL(clicked()), this, SLOT(doEstCdACrr()));
  connect(context, SIGNAL(configChanged()), aerolab, SLOT(configChanged()));
  connect(context, SIGNAL(configChanged()), this, SLOT(configChanged()));
  connect(context, SIGNAL(intervalSelected() ), this, SLOT(intervalSelected()));
  connect(context, SIGNAL(intervalZoom(IntervalItem*) ), this, SLOT(zoomInterval(IntervalItem*)));
  connect(allZoomer, SIGNAL( zoomed(const QRectF) ), this, SLOT(zoomChanged()));


  // Build the tab layout:
  vLayout->addWidget(aerolab);
  vLayout->addLayout(cLayout);
  setLayout(vLayout);


  // tooltip on hover over point
  //************************************
    aerolab->tooltip = new LTMToolTip( QwtPlot::xBottom,
                                       QwtPlot::yLeft,
                                       QwtPicker::VLineRubberBand,
                                       QwtPicker::AlwaysOn,
                                       aerolab->canvas(),
                                       ""
                                     );
    aerolab->tooltip->setRubberBand( QwtPicker::VLineRubberBand );
    aerolab->tooltip->setMousePattern( QwtEventPattern::MouseSelect1, Qt::LeftButton, Qt::ShiftModifier );
    aerolab->tooltip->setTrackerPen( QColor( Qt::black ) );
    QColor inv( Qt::white );
    inv.setAlpha( 0 );
    aerolab->tooltip->setRubberBandPen( inv );
    aerolab->tooltip->setEnabled( true );
    aerolab->_canvasPicker = new LTMCanvasPicker( aerolab );

    connect( aerolab->_canvasPicker, SIGNAL( pointHover( QwtPlotCurve*, int ) ),
             aerolab,                SLOT  ( pointHover( QwtPlotCurve*, int ) ) );


  configChanged(); // pickup colors etc
}
コード例 #7
0
MouseSettingsPage::MouseSettingsPage(AntiMicroSettings *settings, QWidget *parent) :
    QWizardPage(parent)
{
    this->settings = settings;

    setTitle(tr("Mouse Settings"));
    setSubTitle(tr("Customize settings used for mouse emulation"));
    QVBoxLayout *tempMainLayout = new QVBoxLayout;
    setLayout(tempMainLayout);

#ifdef Q_OS_WIN
    QCheckBox *disablePrecision = new QCheckBox(tr("Disable Enhance Pointer Precision"));
    disablePrecision->setToolTip(tr("Disable the \"Enhanced Pointer Precision\" Windows setting\n"
                                    "while antimicro is running. Disabling \"Enhanced Pointer Precision\"\n"
                                    "will allow mouse movement within antimicro to be more\n"
                                    "precise."));
    tempMainLayout->addWidget(disablePrecision);
    tempMainLayout->addSpacerItem(new QSpacerItem(10, 10));
    registerField("disableEnhancePrecision", disablePrecision);
#endif

    QGroupBox *smoothingGroupBox = new QGroupBox(tr("Smoothing"));
    smoothingGroupBox->setCheckable(true);
    smoothingGroupBox->setChecked(false);
    registerField("mouseSmoothing", smoothingGroupBox, "checked", SIGNAL(toggled(bool)));

    layout()->addWidget(smoothingGroupBox);

    QVBoxLayout *tempVLayout = new QVBoxLayout;

    QHBoxLayout *tempHLayout = new QHBoxLayout;
    QLabel *tempLabel = new QLabel(tr("History Buffer:"));
    QSpinBox *tempSpinBox = new QSpinBox;
    tempSpinBox->setMinimum(1);
    tempSpinBox->setMaximum(30);
    tempSpinBox->setValue(10);
    tempLabel->setBuddy(tempSpinBox);
    registerField("historyBuffer", tempSpinBox);

    tempHLayout->addWidget(tempLabel);
    tempHLayout->addWidget(tempSpinBox);
    tempVLayout->addLayout(tempHLayout);

    tempHLayout = new QHBoxLayout;
    tempLabel = new QLabel(tr("Weight Modifier:"));
    QDoubleSpinBox *tempDoubleSpinBox = new QDoubleSpinBox;
    tempDoubleSpinBox->setMinimum(0.0);
    tempDoubleSpinBox->setMaximum(1.0);
    tempDoubleSpinBox->setValue(0.20);
    tempDoubleSpinBox->setSingleStep(0.10);
    tempLabel->setBuddy(tempDoubleSpinBox);
    registerField("weightModifier", tempDoubleSpinBox);

    tempHLayout->addWidget(tempLabel);
    tempHLayout->addWidget(tempDoubleSpinBox);
    tempVLayout->addLayout(tempHLayout);

    smoothingGroupBox->setLayout(tempVLayout);

    tempHLayout = new QHBoxLayout;
    tempLabel = new QLabel(tr("Refresh Rate:"));
    QComboBox *tempComboBox = new QComboBox;

    for (int i = 1; i <= JoyButton::MAXIMUMMOUSEREFRESHRATE; i++)
    {
        tempComboBox->addItem(QString("%1 ms").arg(i), i);
    }

    int refreshIndex = tempComboBox->findData(JoyButton::getMouseRefreshRate());
    if (refreshIndex >= 0)
    {
        tempComboBox->setCurrentIndex(refreshIndex);
    }

    tempComboBox->setToolTip(tr("The refresh rate is the amount of time that will elapse\n"
                                "in between mouse events. Please be cautious when\n"
                                "editing this setting as it will cause the program to use\n"
                                "more CPU power. Setting this value too low can cause\n"
                                "system instability. Please test the setting before using\n"
                                "it unattended."));
    tempLabel->setBuddy(tempComboBox);
    registerField("mouseRefreshRate", tempComboBox);

    tempHLayout->addWidget(tempLabel);
    tempHLayout->addWidget(tempComboBox);
    tempMainLayout->addSpacerItem(new QSpacerItem(10, 10));
    tempMainLayout->addLayout(tempHLayout);
}
コード例 #8
0
ファイル: PageRecord.cpp プロジェクト: KarolS/ssr
PageRecord::PageRecord(MainWindow* main_window)
	: QWidget(main_window->centralWidget()) {

	m_main_window = main_window;

	m_page_started = false;
	m_input_started = false;
	m_output_started = false;
	m_previewing = false;

	QGroupBox *group_recording = new QGroupBox(tr("Recording"), this);
	{
		m_pushbutton_start_pause = new QPushButton(group_recording);

		m_checkbox_hotkey_enable = new QCheckBox(tr("Enable recording hotkey"), group_recording);
		QLabel *label_hotkey = new QLabel(tr("Hotkey:"), group_recording);
		m_checkbox_hotkey_ctrl = new QCheckBox(tr("Ctrl +"), group_recording);
		m_checkbox_hotkey_shift = new QCheckBox(tr("Shift +"), group_recording);
		m_checkbox_hotkey_alt = new QCheckBox(tr("Alt +"), group_recording);
		m_checkbox_hotkey_super = new QCheckBox(tr("Super +"), group_recording);
		m_combobox_hotkey_key = new QComboBox(group_recording);
		m_combobox_hotkey_key->setToolTip(tr("The key that you have to press (combined with the given modifiers) to start or pause recording.\n"
											 "The program that you are recording will not receive the key press."));
		// Note: The choice of keys is currently rather limited, because capturing key presses session-wide is a bit harder than it looks.
		// For example, applications are not allowed to capture the F1-F12 keys (on Ubuntu at least). The A-Z keys don't have this limitation apparently.
		for(unsigned int i = 0; i < 26; ++i) {
			m_combobox_hotkey_key->addItem(QString('A' + i));
		}

		connect(m_pushbutton_start_pause, SIGNAL(clicked()), this, SLOT(OnRecordStartPause()));
		connect(m_checkbox_hotkey_enable, SIGNAL(clicked()), this, SLOT(OnUpdateHotkeyFields()));
		connect(m_checkbox_hotkey_ctrl, SIGNAL(clicked()), this, SLOT(OnUpdateHotkey()));
		connect(m_checkbox_hotkey_shift, SIGNAL(clicked()), this, SLOT(OnUpdateHotkey()));
		connect(m_checkbox_hotkey_alt, SIGNAL(clicked()), this, SLOT(OnUpdateHotkey()));
		connect(m_checkbox_hotkey_super, SIGNAL(clicked()), this, SLOT(OnUpdateHotkey()));
		connect(m_combobox_hotkey_key, SIGNAL(activated(int)), this, SLOT(OnUpdateHotkey()));

		QVBoxLayout *layout = new QVBoxLayout(group_recording);
		layout->addWidget(m_pushbutton_start_pause);
		layout->addWidget(m_checkbox_hotkey_enable);
		{
			QHBoxLayout *layout2 = new QHBoxLayout();
			layout->addLayout(layout2);
			layout2->addWidget(label_hotkey);
			layout2->addWidget(m_checkbox_hotkey_ctrl);
			layout2->addWidget(m_checkbox_hotkey_shift);
			layout2->addWidget(m_checkbox_hotkey_alt);
			layout2->addWidget(m_checkbox_hotkey_super);
			layout2->addWidget(m_combobox_hotkey_key);
		}
	}
	QSplitter *splitter_vertical = new QSplitter(Qt::Vertical, this);
	{
		QSplitter *splitter_horizontal = new QSplitter(Qt::Horizontal, splitter_vertical);
		{
			QGroupBox *group_information = new QGroupBox(tr("Information"), splitter_horizontal);
			{
				QLabel *label_total_time = new QLabel(tr("Total time:"), group_information);
				m_label_info_total_time = new QLabel(group_information);
				QLabel *label_frame_rate_in = new QLabel(tr("FPS in:"), group_information);
				m_label_info_frame_rate_in = new QLabel(group_information);
				QLabel *label_frame_rate_out = new QLabel(tr("FPS out:"), group_information);
				m_label_info_frame_rate_out = new QLabel(group_information);
				QLabel *label_size_in = new QLabel(tr("Size in:"), group_information);
				m_label_info_size_in = new QLabel(group_information);
				QLabel *label_size_out = new QLabel(tr("Size out:"), group_information);
				m_label_info_size_out = new QLabel(group_information);
				QLabel *label_file_name = new QLabel(tr("File name:"), group_information);
				m_label_info_file_name = new ElidedLabel(QString(), Qt::ElideMiddle, group_information);
				m_label_info_file_name->setMinimumWidth(100);
				QLabel *label_file_size = new QLabel(tr("File size:"), group_information);
				m_label_info_file_size = new QLabel(group_information);
				QLabel *label_bit_rate = new QLabel(tr("Bit rate:"), group_information);
				m_label_info_bit_rate = new QLabel(group_information);

				QGridLayout *layout = new QGridLayout(group_information);
				layout->addWidget(label_total_time, 0, 0);
				layout->addWidget(m_label_info_total_time, 0, 1);
				layout->addWidget(label_frame_rate_in, 1, 0);
				layout->addWidget(m_label_info_frame_rate_in, 1, 1);
				layout->addWidget(label_frame_rate_out, 2, 0);
				layout->addWidget(m_label_info_frame_rate_out, 2, 1);
				layout->addWidget(label_size_in, 3, 0);
				layout->addWidget(m_label_info_size_in, 3, 1);
				layout->addWidget(label_size_out, 4, 0);
				layout->addWidget(m_label_info_size_out, 4, 1);
				layout->addWidget(label_file_name, 5, 0);
				layout->addWidget(m_label_info_file_name, 5, 1);
				layout->addWidget(label_file_size, 6, 0);
				layout->addWidget(m_label_info_file_size, 6, 1);
				layout->addWidget(label_bit_rate, 7, 0);
				layout->addWidget(m_label_info_bit_rate, 7, 1);
				layout->setColumnStretch(1, 1);
				layout->setRowStretch(8, 1);
			}
			QGroupBox *group_preview = new QGroupBox(tr("Preview"), splitter_horizontal);
			{
				m_preview_page1 = new QWidget(group_preview);
				{
					QLabel *label_preview_frame_rate = new QLabel(tr("Preview frame rate:"), m_preview_page1);
					m_spinbox_preview_frame_rate = new QSpinBox(m_preview_page1);
					m_spinbox_preview_frame_rate->setRange(1, 1000);
					m_spinbox_preview_frame_rate->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
					QLabel *label_preview_note = new QLabel(tr("Note: Previewing requires extra CPU time (especially at high frame rates)."), m_preview_page1);
					label_preview_note->setWordWrap(true);
					label_preview_note->setAlignment(Qt::AlignLeft | Qt::AlignTop);
					label_preview_note->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::MinimumExpanding);

					QGridLayout *layout = new QGridLayout(m_preview_page1);
					layout->setMargin(0);
					layout->addWidget(label_preview_frame_rate, 0, 0);
					layout->addWidget(m_spinbox_preview_frame_rate, 0, 1);
					layout->addWidget(label_preview_note, 1, 0, 1, 2);
				}
				m_preview_page2 = new QWidget(group_preview);
				{
					m_video_previewer = new VideoPreviewer(m_preview_page2);
					m_label_mic_icon = new QLabel(m_preview_page2);
					m_label_mic_icon->setPixmap(QIcon::fromTheme("audio-input-microphone").pixmap(24, 24));
					m_audio_previewer = new AudioPreviewer(m_preview_page2);

					QVBoxLayout *layout = new QVBoxLayout(m_preview_page2);
					layout->setMargin(0);
					layout->addWidget(m_video_previewer);
					{
						QHBoxLayout *layout2 = new QHBoxLayout();
						layout->addLayout(layout2);
						layout2->addStretch();
						layout2->addWidget(m_label_mic_icon);
						layout2->addWidget(m_audio_previewer);
						layout2->addStretch();
					}
				}
				m_pushbutton_preview_start_stop = new QPushButton(group_preview);

				connect(m_pushbutton_preview_start_stop, SIGNAL(clicked()), this, SLOT(OnPreviewStartStop()));

				QVBoxLayout *layout = new QVBoxLayout(group_preview);
				{
					m_stacked_layout_preview = new QStackedLayout();
					layout->addLayout(m_stacked_layout_preview);
					m_stacked_layout_preview->addWidget(m_preview_page1);
					m_stacked_layout_preview->addWidget(m_preview_page2);
				}
				layout->addWidget(m_pushbutton_preview_start_stop);
			}

			splitter_horizontal->addWidget(group_information);
			splitter_horizontal->addWidget(group_preview);
			splitter_horizontal->setStretchFactor(0, 1);
			splitter_horizontal->setStretchFactor(1, 3);
		}
		QGroupBox *group_log = new QGroupBox(tr("Log"), splitter_vertical);
		{
			m_textedit_log = new QTextEditSmall(group_log);
			m_textedit_log->setReadOnly(true);

			QVBoxLayout *layout = new QVBoxLayout(group_log);
			layout->addWidget(m_textedit_log);
		}

		splitter_vertical->addWidget(splitter_horizontal);
		splitter_vertical->addWidget(group_log);
		splitter_vertical->setStretchFactor(0, 3);
		splitter_vertical->setStretchFactor(1, 1);
	}

	QPushButton *button_cancel = new QPushButton(QIcon::fromTheme("process-stop"), tr("Cancel recording"), this);
	QPushButton *button_save = new QPushButton(QIcon::fromTheme("document-save"), tr("Save recording"), this);

	m_systray_icon = new QSystemTrayIcon(m_main_window);
	{
		QMenu *menu = new QMenu(m_main_window);
		m_systray_action_start_pause = menu->addAction(QString(), this, SLOT(OnRecordStartPause()));
		m_systray_action_save = menu->addAction(tr("Save recording"), this, SLOT(OnSave()));
		m_systray_action_cancel = menu->addAction(tr("Cancel recording"), this, SLOT(OnCancel()));
		menu->addSeparator();
		menu->addAction("Quit", m_main_window, SLOT(close()));
		m_systray_icon->setContextMenu(menu);
	}

	connect(button_cancel, SIGNAL(clicked()), this, SLOT(OnCancel()));
	connect(button_save, SIGNAL(clicked()), this, SLOT(OnSave()));
	connect(m_systray_icon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(OnSysTrayActivated(QSystemTrayIcon::ActivationReason)));

	QVBoxLayout *layout = new QVBoxLayout(this);
	layout->addWidget(group_recording);
	layout->addWidget(splitter_vertical);
	{
		QHBoxLayout *layout2 = new QHBoxLayout();
		layout->addLayout(layout2);
		layout2->addWidget(button_cancel);
		layout2->addWidget(button_save);
	}

	UpdateSysTray();
	UpdateRecordPauseButton();
	UpdatePreview();

	m_info_timer = new QTimer(this);
	m_glinject_event_timer = new QTimer(this);
	connect(m_info_timer, SIGNAL(timeout()), this, SLOT(OnUpdateInformation()));
	connect(m_glinject_event_timer, SIGNAL(timeout()), this, SLOT(OnCheckGLInjectEvents()));
	connect(&g_hotkey_listener, SIGNAL(Triggered()), this, SLOT(OnRecordStartPause()));
	connect(Logger::GetInstance(), SIGNAL(NewLine(Logger::enum_type,QString)), this, SLOT(OnNewLogLine(Logger::enum_type,QString)), Qt::QueuedConnection);

	m_systray_icon->show();

}
コード例 #9
0
ファイル: tselectclef.cpp プロジェクト: SeeLook/nootka
TselectClefPrivate::TselectClefPrivate(bool isMenu, QWidget* parent) :
  QWidget(parent)
{
  treble = new TradioClef(Tclef(Tclef::e_treble_G), parent, isMenu);
  treble_8 = new TradioClef(Tclef(Tclef::e_treble_G_8down), parent, isMenu);
  bass = new TradioClef(Tclef(Tclef::e_bass_F), parent, isMenu);
  bass_8 = new TradioClef(Tclef(Tclef::e_bass_F_8down), parent, isMenu);
  alto = new TradioClef(Tclef(Tclef::e_alto_C), parent, isMenu);
  tenor = new TradioClef(Tclef(Tclef::e_tenor_C), parent, isMenu);
  piano = new TradioClef(Tclef(Tclef::e_pianoStaff), parent, isMenu);

  QButtonGroup *clefsGroup = new QButtonGroup(this);
    clefsGroup->addButton(treble->radio());
    clefsGroup->addButton(treble_8->radio());
    clefsGroup->addButton(bass->radio());
    clefsGroup->addButton(bass_8->radio());
    clefsGroup->addButton(alto->radio());
    clefsGroup->addButton(tenor->radio());
    clefsGroup->addButton(piano->radio());

  if (isMenu) {
      QVBoxLayout *leftLay = new QVBoxLayout;
      QVBoxLayout *rightLay = new QVBoxLayout;
      leftLay->addWidget(treble);
      leftLay->addWidget(treble_8);
      leftLay->addWidget(bass);
      leftLay->addWidget(bass_8);
      rightLay->addWidget(alto);
      rightLay->addWidget(tenor);
      rightLay->addWidget(piano);
      QHBoxLayout *lay = new QHBoxLayout;
      lay->addLayout(leftLay);
      lay->addLayout(rightLay);
      setLayout(lay);
  } else {
#if defined (Q_OS_ANDROID)
      QVBoxLayout *upLay = new QVBoxLayout;
      QVBoxLayout *lowLay = new QVBoxLayout;
#else
      QHBoxLayout *upLay = new QHBoxLayout;
      QHBoxLayout *lowLay = new QHBoxLayout;
#endif
      upLay->addWidget(treble);
#if defined (Q_OS_ANDROID)
      static_cast<QHBoxLayout*>(treble->layout())->insertWidget(2, getLabelFromStatus(treble, false));
#endif
      lowLay->addWidget(treble_8);
#if defined (Q_OS_ANDROID)
      static_cast<QHBoxLayout*>(treble_8->layout())->insertWidget(2, getLabelFromStatus(treble_8, false));
#endif
      upLay->addWidget(bass);
#if defined (Q_OS_ANDROID)
      static_cast<QHBoxLayout*>(bass->layout())->insertWidget(2, getLabelFromStatus(bass, false, true));
#endif
      lowLay->addWidget(bass_8);
#if defined (Q_OS_ANDROID)
      static_cast<QHBoxLayout*>(bass_8->layout())->insertWidget(2, getLabelFromStatus(bass_8, false));
#endif
      upLay->addWidget(alto);
#if defined (Q_OS_ANDROID)
      static_cast<QHBoxLayout*>(alto->layout())->insertWidget(2, getLabelFromStatus(alto, false));
#endif
      lowLay->addWidget(tenor);
#if defined (Q_OS_ANDROID)
      static_cast<QHBoxLayout*>(tenor->layout())->insertWidget(2, getLabelFromStatus(tenor, false));
#endif
      QVBoxLayout *upLowLay = new QVBoxLayout;
      upLowLay->addLayout(upLay);
      upLowLay->addLayout(lowLay);
#if defined (Q_OS_ANDROID)
      QVBoxLayout *lay = new QVBoxLayout;
#else
      QHBoxLayout *lay = new QHBoxLayout;
#endif
      lay->addLayout(upLowLay);
      lay->addWidget(piano);
#if defined (Q_OS_ANDROID)
      static_cast<QHBoxLayout*>(piano->layout())->insertWidget(2, getLabelFromStatus(piano, false));
#endif

      setLayout(lay);
  }
  connect(treble, SIGNAL(selectedClef(Tclef)), this, SLOT(clefWasSelected(Tclef)));
  connect(treble_8, SIGNAL(selectedClef(Tclef)), this, SLOT(clefWasSelected(Tclef)));
  connect(bass, SIGNAL(selectedClef(Tclef)), this, SLOT(clefWasSelected(Tclef)));
  connect(bass_8, SIGNAL(selectedClef(Tclef)), this, SLOT(clefWasSelected(Tclef)));
  connect(alto, SIGNAL(selectedClef(Tclef)), this, SLOT(clefWasSelected(Tclef)));
  connect(tenor, SIGNAL(selectedClef(Tclef)), this, SLOT(clefWasSelected(Tclef)));
  connect(piano, SIGNAL(selectedClef(Tclef)), this, SLOT(clefWasSelected(Tclef)));

  connect(treble, SIGNAL(statusTipWanted(QString)), this, SLOT(onStatusTip(QString)));
  connect(treble_8, SIGNAL(statusTipWanted(QString)), this, SLOT(onStatusTip(QString)));
  connect(bass, SIGNAL(statusTipWanted(QString)), this, SLOT(onStatusTip(QString)));
  connect(bass_8, SIGNAL(statusTipWanted(QString)), this, SLOT(onStatusTip(QString)));
  connect(alto, SIGNAL(statusTipWanted(QString)), this, SLOT(onStatusTip(QString)));
  connect(tenor, SIGNAL(statusTipWanted(QString)), this, SLOT(onStatusTip(QString)));
  connect(piano, SIGNAL(statusTipWanted(QString)), this, SLOT(onStatusTip(QString)));
}
コード例 #10
0
ファイル: terminalwindow.cpp プロジェクト: seyfarth/ebe
TerminalWindow::TerminalWindow(QWidget *parent)
    : QFrame(parent)
{
    setObjectName("Terminal");

    setFrameStyle(QFrame::Panel | QFrame::Raised);
    setLineWidth(4);

#ifdef Q_WS_WIN
    SECURITY_ATTRIBUTES attr;
    attr.nLength = sizeof(SECURITY_ATTRIBUTES);
    attr.lpSecurityDescriptor = 0;
    attr.bInheritHandle = TRUE;
    if ( !CreatePipe(&childStdin,&toChild,&attr,4096) )
    {
        qDebug() << "Could not create pipe to child";
        return;
    }
    SetHandleInformation(toChild,HANDLE_FLAG_INHERIT,4096);
    if ( !CreatePipe(&fromChild,&childStdout,&attr,1) )
    {
        qDebug() << "Could not create pipe from child";
        return;
    }
    SetHandleInformation(fromChild,HANDLE_FLAG_INHERIT,0);
#else
    pty = posix_openpt(O_RDWR);
    grantpt(pty);
    unlockpt(pty);
#endif

    QVBoxLayout *layout = new QVBoxLayout;
    layout->setContentsMargins(10, 10, 10, 10);

    edit = new TerminalEdit(pty, this);
    edit->setReadOnly(true);

    layout->addWidget(edit);

    lineEdit = new InputEdit;
    QLabel *label = new QLabel(tr("Input"));
    clearButton = new QPushButton(tr("Clear output"));
    QHBoxLayout *lineLayout = new QHBoxLayout;
    lineLayout->addWidget(label);
    lineLayout->addWidget(lineEdit);
    lineLayout->addWidget(clearButton);
    lineEdit->setToolTip(
        tr("Terminal input will only work from this input box.\n"
            "Press Control-D to send end of file."));

    layout->addLayout(lineLayout);
    setLayout(layout);

#ifdef Q_WS_WIN
    ptyReader = new PtyReader(fromChild);
#else
    ptyName = ptsname(pty);
    //qDebug() << "pty" << ptyName;
    ptyReader = new PtyReader(pty);
    ptySlave = open(ptsname(pty), O_RDWR);
#endif
    connect(lineEdit, SIGNAL(returnPressed()), this, SLOT(lineEditReady()));
    connect(ptyReader, SIGNAL(dataReady(QString)), this,
        SLOT(dataReady(QString)));
    connect(lineEdit, SIGNAL(sendEOF()), gdb, SLOT(setEOF()));
    connect(clearButton, SIGNAL(clicked()), this, SLOT(clearTerminalWindow()));
    ptyReader->start();
}
コード例 #11
0
HtmlInfoView::HtmlInfoView(QWidget * parent) : QScrollArea(parent) 
{
    this->setWidgetResizable(true);
	this->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    QFrame * mainFrame = new QFrame(this);
	mainFrame->setObjectName("infoViewMainFrame");

	m_lastTitleItemBase = NULL;
	m_lastTagsModelPart = NULL;
	m_lastConnectorItem = NULL;
	m_lastIconModelPart = NULL;
	m_lastPropsModelPart = NULL;
	m_lastPropsItemBase = NULL;

	m_partTitle = NULL;
	m_partUrl = NULL;
	m_partVersion = NULL;
	m_lockCheckbox = NULL;
	m_connDescr = NULL;
	m_tagsTextLabel = NULL;
	m_lastSwappingEnabled = false;
	m_lastItemBase = NULL;
	m_infoGraphicsView = NULL;
	m_setContentTimer.setSingleShot(true);
	m_setContentTimer.setInterval(10);
	connect(&m_setContentTimer, SIGNAL(timeout()), this, SLOT(setContent()));
	QVBoxLayout *vlo = new QVBoxLayout(mainFrame);
	vlo->setSpacing(0);
	vlo->setContentsMargins(0, 0, 0, 0);
	vlo->setSizeConstraint( QLayout::SetMinAndMaxSize );

        /* Part Title */

	m_titleEdit = new FLineEdit(mainFrame);
	m_titleEdit->setObjectName("instanceTitleEditor");
	m_titleEdit->setToolTip(tr("Change the part label here"));
	m_titleEdit->setAlignment(Qt::AlignLeft);

	connect(m_titleEdit, SIGNAL(editingFinished()), this, SLOT(setInstanceTitle()));
	connect(m_titleEdit, SIGNAL(mouseEnter()), this, SLOT(instanceTitleEnter()));
	connect(m_titleEdit, SIGNAL(mouseLeave()), this, SLOT(instanceTitleLeave()));
	connect(m_titleEdit, SIGNAL(editable(bool)), this, SLOT(instanceTitleEditable(bool)));

	setInstanceTitleColors(m_titleEdit, QColor(0xaf, 0xaf, 0xb4), QColor(0x00, 0x00, 0x00)); //b3b3b3, 575757
	m_titleEdit->setAutoFillBackground(true);
	vlo->addWidget(m_titleEdit);

        /* Part Icons */

	if (NoIcon == NULL) {
		NoIcon = new QPixmap(":/resources/images/icons/noicon.png");
	}

	QFrame * iconFrame = new QFrame(mainFrame);
	iconFrame->setObjectName("iconFrame");

	QHBoxLayout * hboxLayout = new QHBoxLayout();
	hboxLayout->setContentsMargins(0, 0, 0, 0);
	hboxLayout->addSpacing(IconSpace);
	m_icon1 = addLabel(hboxLayout, NoIcon);
	m_icon1->setToolTip(tr("Part breadboard view image"));
	m_icon2 = addLabel(hboxLayout, NoIcon);
	m_icon2->setToolTip(tr("Part schematic view image"));
	m_icon3 = addLabel(hboxLayout, NoIcon);
	m_icon3->setToolTip(tr("Part pcb view image"));

	QVBoxLayout * versionLayout = new QVBoxLayout();

	QHBoxLayout * subVersionLayout = new QHBoxLayout();
	m_partVersion = new QLabel();
	m_partVersion->setObjectName("infoViewPartVersion");
	m_partVersion->setToolTip(tr("Part version number"));
	subVersionLayout->addWidget(m_partVersion, 0, Qt::AlignLeft);
	subVersionLayout->addStretch(1);
	versionLayout->addLayout(subVersionLayout);
	
	m_lockCheckbox = new QCheckBox(tr("Locked"));
	m_lockCheckbox->setObjectName("infoViewLockCheckbox");
	m_lockCheckbox->setToolTip(tr("Change the locked state of the part in this view.  A locked part can't be moved"));
	connect(m_lockCheckbox, SIGNAL(clicked(bool)), this, SLOT(changeLock(bool)));
	versionLayout->addWidget(m_lockCheckbox);

	hboxLayout->addLayout(versionLayout);
	
	hboxLayout->addSpacerItem(new QSpacerItem(IconSpace, 1, QSizePolicy::Expanding));
	iconFrame->setLayout(hboxLayout);
	vlo->addWidget(iconFrame);

	m_partUrl = new TagLabel(this);
	m_partUrl->setWordWrap(false);
	m_partUrl->setObjectName("infoViewPartUrl");
	m_partUrl->setOpenExternalLinks(true);
	vlo->addWidget(m_partUrl);

	m_partTitle = new TagLabel(this);
	m_partTitle->setWordWrap(true);
	m_partTitle->setObjectName("infoViewPartTitle");
	m_partTitle->setOpenExternalLinks(true);
	vlo->addWidget(m_partTitle);

	m_proplabel = new QLabel(tr("Properties"), NULL);
	m_proplabel->setObjectName("expandableViewLabel");
	vlo->addWidget(m_proplabel);

	m_propFrame = new QFrame(this);
	m_propFrame->setObjectName("infoViewPropertyFrame");
	m_propLayout = new QGridLayout(m_propFrame);
	m_propLayout->setSpacing(0);
	m_propLayout->setContentsMargins(0, 0, 0, 0);
	m_propFrame->setLayout(m_propLayout);
	vlo->addWidget(m_propFrame);

	m_taglabel = new QLabel(tr("Tags"), NULL);
	m_taglabel->setObjectName("expandableViewLabel");
	vlo->addWidget(m_taglabel);

	m_tagsTextLabel = new TagLabel(this);
	m_tagsTextLabel->setWordWrap(true);
	m_tagsTextLabel->setObjectName("tagsValue");
	vlo->addWidget(m_tagsTextLabel);

	m_connLabel = new QLabel(tr("Connections"), NULL);
	m_connLabel->setObjectName("expandableViewLabel");
	vlo->addWidget(m_connLabel);

	m_connFrame = new QFrame(this);
	m_connFrame->setObjectName("connectionsFrame");

    QGridLayout * connLayout = new QGridLayout(m_connFrame);
	connLayout->setSpacing(0);
	connLayout->setContentsMargins(0, 0, 0, 0);
	m_connFrame->setLayout(connLayout);

	QLabel * descrLabel = new QLabel(tr("conn."), this);
	descrLabel->setObjectName("connectionsLabel");
	m_connDescr = new QLabel(this);
	m_connDescr->setObjectName("connectionsValue");
    connLayout->addWidget(descrLabel, 0, 0);
    connLayout->addWidget(m_connDescr, 0, 1);

	QLabel * nameLabel = new QLabel(tr("name"), this);
	nameLabel->setObjectName("connectionsLabel");
	m_connName = new QLabel(this);
	m_connName->setObjectName("connectionsValue");
    connLayout->addWidget(nameLabel, 1, 0);
    connLayout->addWidget(m_connName, 1, 1);

	QLabel * typeLabel = new QLabel(tr("type"), this);
	typeLabel->setObjectName("connectionsLabel");
	m_connType = new QLabel(this);
	m_connType->setObjectName("connectionsValue");
	connLayout->addWidget(typeLabel, 2, 0);
    connLayout->addWidget(m_connType, 2, 1);

	vlo->addWidget(m_connFrame);

	vlo->addSpacerItem(new QSpacerItem(1, 1, QSizePolicy::Minimum, QSizePolicy::Expanding));

	mainFrame->setLayout(vlo);

	this->setWidget(mainFrame);

	m_currentItem = NULL;
	m_currentSwappingEnabled = false;

}
コード例 #12
0
void RenderOptions::setUpConfigurator()
{
    auto tr = [](const char *s, const char *c = 0, int n = -1) { return QObject::tr(s, c, n); };

    _configurator = new QWidget();
    QFormLayout* formLayout = new QFormLayout();


    QHBoxLayout* fileLayout = new QHBoxLayout();
    QLineEdit* filePathEdit = new QLineEdit(filePath(), _configurator);
    QPushButton* browseButton = new QPushButton("...", _configurator);
    fileLayout->addWidget(filePathEdit);
    fileLayout->addWidget(browseButton);
    QPushButton* dontSaveButton = new QPushButton(dontSaveButtonCaption[1], _configurator);
    dontSaveButton->setCheckable(true);
    dontSaveButton->setChecked(true);
    formLayout->addRow(dontSaveButton);
    formLayout->addRow(tr("File:"), fileLayout);

    //== Resolution ==
    QHBoxLayout* resolutionLayout = new QHBoxLayout();
    QSpinBox* xResolutionSpinBox = new QSpinBox(_configurator);
    xResolutionSpinBox->setRange(0,300000);
    xResolutionSpinBox->setValue(resolution().width());
    QSpinBox* yResolutionSpinBox = new QSpinBox(_configurator);
    yResolutionSpinBox->setRange(0,300000);
    yResolutionSpinBox->setValue(resolution().height());
    resolutionLayout->addWidget(xResolutionSpinBox);
    resolutionLayout->addWidget(yResolutionSpinBox);
    formLayout->addRow(tr("Resolution:"), resolutionLayout);

    QVBoxLayout* layout = new QVBoxLayout();
    layout->addLayout(formLayout);

    _configurator->setLayout(layout);

    QObject::connect(filePathEdit, &QLineEdit::editingFinished, [=](){
       _filePath = filePathEdit->text();
    });
    QObject::connect(browseButton, &QPushButton::clicked, [=]() {
        QString newFilePath = QFileDialog::getSaveFileName(_configurator, tr("Save image"), _filePath);
        if (!newFilePath.isEmpty()) {
            _filePath = newFilePath;
        }
    });
    QObject::connect(dontSaveButton, &QPushButton::clicked, [=](bool checked) {
        if (checked) {
            dontSaveButton->setText(dontSaveButtonCaption[1]);
            _saveFile = true;
        } else {
            dontSaveButton->setText(dontSaveButtonCaption[0]);
            _saveFile = false;
        }
        filePathEdit->setEnabled(_saveFile);
        browseButton->setEnabled(_saveFile);
    });
    QObject::connect(xResolutionSpinBox, &QSpinBox::editingFinished, [=]() {
        _resolution.setWidth(xResolutionSpinBox->value());
    });
    QObject::connect(yResolutionSpinBox, &QSpinBox::editingFinished, [=]() {
        _resolution.setHeight(yResolutionSpinBox->value());
    });
}
コード例 #13
0
ファイル: mydialog.cpp プロジェクト: yjdwbj/ui-tools
ImageFileDialog::ImageFileDialog(const QVariantList &old, QString imgpath, QWidget *parent)
    :QDialog(parent),
      sellist(new QListWidget()),
      flistview(new QListWidget()),
      treefile(new QTreeView()),
      statusBar(new QLabel(this)),
      okbtn(new QPushButton("确定",this))
{

    mWindow = (MainWindow*)parent;
    setWindowFlags(Qt::Widget | Qt::FramelessWindowHint);
    setModal(true);
    treefile->header()->setHidden(true);
    flistview->setProperty(DKEY_EXTMAP,extMap);
    /* 填弃上一次的数据 */
    dirModel = new QFileSystemModel(this);
    fileModel = new QFileSystemModel(this);
    this->setFixedSize(1000,600);

    sellist->setSelectionMode(QAbstractItemView::ExtendedSelection);
    sellist->setAlternatingRowColors(true);
    flistview->setSelectionMode(QAbstractItemView::ExtendedSelection);
    flistview->setAlternatingRowColors(true);

    flistview->setIconSize(QSize(80,60));
    sellist->setIconSize(QSize(80,60));


    QMap<QString,QString> navigator;
    navigator[UP] = ":/icon/icons/go-up.png";
    navigator[DOWN] = ":/icon/icons/go-down.png";
    navigator[LEFT] = ":/icon/icons/go-previous.png";
    navigator[RIGHT] = ":/icon/icons/go-next.png";


    QVBoxLayout *mainLayout = new QVBoxLayout();

    QHBoxLayout *mh = new QHBoxLayout();
    this->setLayout(mainLayout);
    mainLayout->addLayout(mh);
    this->setWindowTitle(tr("图片编辑"));
    QVBoxLayout *v = new QVBoxLayout();
    v->setSizeConstraint(QLayout::SetFixedSize);


    QMapIterator<QString,QString> itmap(navigator);
    while(itmap.hasNext())
    {
        itmap.next();
        QPushButton *btn = new QPushButton();
        QPixmap p(itmap.value());
        btn->setIconSize(p.size());
        p.setMask(p.createMaskFromColor(Qt::white));
        btn->setIcon(QIcon(p));

        btn->setObjectName(itmap.key());
        btn->setFixedSize(btn->iconSize());
        v->addWidget(btn);
        if(!LEFT.compare(itmap.key()))
        {
            connect(btn,SIGNAL(clicked(bool)),SLOT(onAddSelectedItems()));
        }else if(!UP.compare(itmap.key()))
        {
            connect(btn,SIGNAL(clicked(bool)),SLOT(onUp()));
        }else if(!DOWN.compare(itmap.key()))
        {
            connect(btn,SIGNAL(clicked(bool)),SLOT(onDown()));
        }else if(!RIGHT.compare(itmap.key()))
        {
            connect(btn,SIGNAL(clicked(bool)),SLOT(onDelSelectedItems()));
        }
    }

    dirModel->setRootPath(imgpath);
    dirModel->removeColumn(3);
    dirModel->removeColumn(2);
    dirModel->setFilter(QDir::NoDotAndDotDot | QDir::AllDirs);


    filters << "*.bmp" << "*.png" << "*.jpg";
    dirModel->setNameFilters(filters);


    treefile->setModel(dirModel);
    treefile->setRootIndex(dirModel->index(imgpath));
    treefile->setAlternatingRowColors(true);

    treefile->hideColumn(3);
    treefile->hideColumn(2);
    treefile->hideColumn(1);


    fileModel->setRootPath(imgpath);
    fileModel->setNameFilters(filters);
    fileModel->setFilter(QDir::Files);

    connect(sellist,&QListWidget::clicked,
            [=](QModelIndex index){
        sellist->clearSelection();
        sellist->setCurrentIndex(index);
        findChild<QPushButton*>(UP)->setEnabled(index.row() == 0 ? false : true);
        findChild<QPushButton*>(DOWN)->setEnabled(index.row()
                                                  == sellist->count() -1 ? false : true);
    });
    connect(flistview,SIGNAL(doubleClicked(QModelIndex)),
            SLOT(onListViewDoubleClicked(QModelIndex)));

    connect(treefile,SIGNAL(clicked(QModelIndex)),
            SLOT(onTreeViewClicked(QModelIndex)));

    /* 主布局是水平布局,左(QListWidget),中(垂直布局),右(文件系统) */
    mh->addWidget(sellist);
    mh->addLayout(v);
    mh->addWidget(flistview);
    mh->addWidget(treefile);


    QHBoxLayout *mlayout = new QHBoxLayout();
    mlayout->setSizeConstraint(QLayout::SetMaximumSize);
    QLabel *msg  = new QLabel("已经添加的图片数:");
    statusBar->setText("0");
    mlayout->addWidget(msg);
    mlayout->addWidget(statusBar);
    mlayout->addWidget(okbtn);
    statusBar->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed);

    mainLayout->addLayout(mlayout);

    foreach (QVariant v, old) {
        // example for v "config/images/digital-0.png"
        QString str = v.toString();
        QString fpath = QDir::currentPath() + BACKSLASH + str;
        QPixmap pic = mWindow->mImgMap[fpath];
        if(pic.isNull())
        {
            pic = mWindow->mImgMap[fpath] = QPixmap(fpath);
        }
        QString sname = str.mid(str.lastIndexOf(BACKSLASH)+1);
        QListWidgetItem *nitem = new QListWidgetItem(pic,sname);
        sellist->addItem(nitem);
        selectedMap[sname] = fpath;
    }
コード例 #14
0
ファイル: UIProgressDialog.cpp プロジェクト: mcenirm/vbox
UIProgressDialog::UIProgressDialog(CProgress &progress,
                                   const QString &strTitle,
                                   QPixmap *pImage /* = 0 */,
                                   int cMinDuration /* = 2000 */,
                                   QWidget *pParent /* = 0 */)
    : QIWithRetranslateUI2<QIDialog>(pParent, Qt::MSWindowsFixedSizeDialogHint | Qt::WindowTitleHint)
    , m_progress(progress)
    , m_pImageLbl(0)
    , m_fCancelEnabled(false)
    , m_cOperations(m_progress.GetOperationCount())
    , m_iCurrentOperation(m_progress.GetOperation() + 1)
    , m_fEnded(false)
{
    /* Setup dialog: */
    setWindowTitle(QString("%1: %2").arg(strTitle, m_progress.GetDescription()));
    setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);

    /* Create main layout: */
    QHBoxLayout *pMainLayout = new QHBoxLayout(this);

#ifdef Q_WS_MAC
    ::darwinSetHidesAllTitleButtons(this);
    if (pImage)
        pMainLayout->setContentsMargins(30, 15, 30, 15);
    else
        pMainLayout->setContentsMargins(6, 6, 6, 6);
#endif /* Q_WS_MAC */

    /* Create image: */
    if (pImage)
    {
        m_pImageLbl = new QLabel(this);
        m_pImageLbl->setPixmap(*pImage);
        pMainLayout->addWidget(m_pImageLbl);
    }

    /* Create description: */
    m_pDescriptionLbl = new QILabel(this);
    if (m_cOperations > 1)
        m_pDescriptionLbl->setText(QString(m_spcszOpDescTpl)
                                   .arg(m_progress.GetOperationDescription())
                                   .arg(m_iCurrentOperation).arg(m_cOperations));
    else
        m_pDescriptionLbl->setText(QString("%1 ...")
                                   .arg(m_progress.GetOperationDescription()));

    /* Create progress-bar: */
    m_pProgressBar = new QProgressBar(this);
    m_pProgressBar->setMaximum(100);
    m_pProgressBar->setValue(0);

    /* Create cancel button: */
    m_fCancelEnabled = m_progress.GetCancelable();
    m_pCancelBtn = new UIMiniCancelButton(this);
    m_pCancelBtn->setEnabled(m_fCancelEnabled);
    m_pCancelBtn->setFocusPolicy(Qt::ClickFocus);
    connect(m_pCancelBtn, SIGNAL(clicked()), this, SLOT(sltCancelOperation()));

    /* Create estimation label: */
    m_pEtaLbl = new QILabel(this);

    /* Create proggress layout: */
    QHBoxLayout *pProgressLayout = new QHBoxLayout;
    pProgressLayout->setMargin(0);
    pProgressLayout->addWidget(m_pProgressBar, 0, Qt::AlignVCenter);
    pProgressLayout->addWidget(m_pCancelBtn, 0, Qt::AlignVCenter);

    /* Create description layout: */
    QVBoxLayout *pDescriptionLayout = new QVBoxLayout;
    pDescriptionLayout->setMargin(0);
    pDescriptionLayout->addStretch(1);
    pDescriptionLayout->addWidget(m_pDescriptionLbl, 0, Qt::AlignHCenter);
    pDescriptionLayout->addLayout(pProgressLayout);
    pDescriptionLayout->addWidget(m_pEtaLbl, 0, Qt::AlignLeft | Qt::AlignVCenter);
    pDescriptionLayout->addStretch(1);
    pMainLayout->addLayout(pDescriptionLayout);

    /* Translate finally: */
    retranslateUi();

    /* The progress dialog will be shown automatically after
     * the duration is over if progress is not finished yet. */
    QTimer::singleShot(cMinDuration, this, SLOT(show()));
}
コード例 #15
0
SessionWidget::SessionWidget ( bool newSession, QString id, ONMainWindow * mw,
                               QWidget * parent, Qt::WindowFlags f )
    : ConfigWidget ( id,mw,parent,f )
{
    QVBoxLayout* sessLay=new QVBoxLayout ( this );
#ifdef Q_WS_HILDON
    sessLay->setMargin ( 2 );
#endif
    this->parent=mw;
    this->newSession=newSession;

    sessName=new QLineEdit ( this );
    icon=new QPushButton ( QString::null,this );
    if ( !miniMode )
    {
        icon->setIconSize ( QSize ( 100,100 ) );
        icon->setFixedSize ( 100,100 );
    }
    else
    {
        icon->setIconSize ( QSize ( 48,48 ) );
        icon->setFixedSize ( 48,48 );
    }
    icon->setFlat ( true );

    QHBoxLayout* slay=new QHBoxLayout();
    slay->addWidget ( new QLabel ( tr ( "Session name:" ),this ) );
    slay->addWidget ( sessName );

    QHBoxLayout* ilay=new QHBoxLayout();
    ilay->addWidget ( icon );
    ilay->addWidget ( new QLabel ( tr ( "<< change icon" ),this ) );

    lPath=new QLabel(this);
    lPath->setFrameStyle(QFrame::StyledPanel);
    QPushButton* pathButton=new QPushButton("...",this);
    QHBoxLayout* pathLay=new QHBoxLayout();
    pathLay->addWidget(new QLabel(tr("Path:"), this),0);
    pathLay->addWidget(lPath,1);
    pathLay->addWidget(pathButton,0);

#ifndef Q_WS_HILDON
    QGroupBox *sgb=new QGroupBox ( tr ( "&Server" ),this );
#else
    QFrame* sgb=this;
#endif
    server=new QLineEdit ( sgb );
    uname=new QLineEdit ( sgb );
    sshPort=new QSpinBox ( sgb );
    sshPort->setValue ( mainWindow->getDefaultSshPort().toInt() );
    sshPort->setMinimum ( 1 );
    sshPort->setMaximum ( 999999999 );
#ifdef Q_OS_LINUX
    rdpPort=new QSpinBox ( sgb );
    rdpPort->setValue ( mainWindow->getDefaultSshPort().toInt() );
    rdpPort->setMinimum ( 1 );
    rdpPort->setMaximum ( 999999999 );
#endif
    key=new QLineEdit ( sgb );

#ifndef Q_WS_HILDON
    openKey=new QPushButton (
        QIcon ( mainWindow->iconsPath (
                    "/32x32/file-open.png" ) ),
        QString::null,sgb );
    QVBoxLayout *sgbLay = new QVBoxLayout ( sgb );
#else
    QPushButton* openKey=new QPushButton (
        QIcon ( mainWindow->iconsPath ( "/16x16/file-open.png" ) ),
        QString::null,sgb );
    QVBoxLayout *sgbLay = new QVBoxLayout ();
#endif
    QHBoxLayout *suLay =new QHBoxLayout();
    QVBoxLayout *slLay =new QVBoxLayout();
    QVBoxLayout *elLay =new QVBoxLayout();
    slLay->addWidget ( new QLabel ( tr ( "Host:" ),sgb ) );
    slLay->addWidget ( new QLabel ( tr ( "Login:"******"SSH port:" ),sgb );
    slLay->addWidget ( lPort );
    elLay->addWidget ( server );
    elLay->addWidget ( uname );
    elLay->addWidget ( sshPort );
#ifdef Q_OS_LINUX
    elLay->addWidget ( rdpPort );
#endif
    suLay->addLayout ( slLay );
    suLay->addLayout ( elLay );
#ifdef Q_WS_HILDON
    sshPort->setFixedHeight ( int ( sshPort->sizeHint().height() *1.5 ) );
#endif

    QHBoxLayout *keyLay =new QHBoxLayout();
    lKey=new QLabel ( tr ( "Use RSA/DSA key for ssh connection:" ),sgb );
    keyLay->addWidget (lKey );
    keyLay->addWidget ( key );
    keyLay->addWidget ( openKey );

    sgbLay->addLayout ( suLay );
    sgbLay->addLayout ( keyLay );
    cbAutoLogin=new QCheckBox(tr("Try auto login (via SSH Agent or default SSH key)"),sgb);
    cbKrbLogin=new QCheckBox(tr("Kerberos 5 (GSSAPI) authentication"),sgb);
    cbKrbDelegation=new QCheckBox(tr("Delegation of GSSAPI credentials to the server"),sgb);
    sgbLay->addWidget(cbAutoLogin);
    sgbLay->addWidget(cbKrbLogin);
    sgbLay->addWidget(cbKrbDelegation);
    cbProxy=new QCheckBox(tr("Use Proxy server for SSH connection"),sgb);
    proxyBox=new QGroupBox(tr("Proxy server"),sgb);
    sgbLay->addWidget(cbProxy);
    sgbLay->addWidget(proxyBox);
    QGridLayout* proxyLaout=new QGridLayout(proxyBox);
    QButtonGroup* proxyType=new QButtonGroup(proxyBox);
    proxyType->setExclusive(true);
    rbSshProxy=new QRadioButton(tr("SSH"),proxyBox);
    rbHttpProxy=new QRadioButton(tr("HTTP"),proxyBox);
    proxyType->addButton(rbSshProxy);
    proxyType->addButton(rbHttpProxy);
    proxyHost=new QLineEdit(proxyBox);
    proxyPort=new QSpinBox(proxyBox);
    proxyPort->setMinimum ( 1 );
    proxyPort->setMaximum ( 999999999 );

    cbProxySameUser=new QCheckBox(tr("Same login as on X2Go Server"), proxyBox);
    proxyLogin=new QLineEdit(proxyBox);
    cbProxySamePass=new QCheckBox(tr("Same password as on X2Go Server"), proxyBox);

    proxyKeyLabel=new QLabel( tr ( "RSA/DSA key:" ), proxyBox);
    proxyKey=new QLineEdit(proxyBox);
    pbOpenProxyKey=new QPushButton (
        QIcon ( mainWindow->iconsPath ( "/16x16/file-open.png" ) ),
        QString::null,proxyBox );
    cbProxyAutologin=new QCheckBox(tr("SSH Agent or default SSH key"),proxyBox);
    cbProxyKrbLogin=new QCheckBox(tr("Kerberos 5 (GSSAPI) authentication"),proxyBox);


    proxyLaout->addWidget(new QLabel(tr("Type:"),proxyBox),0,0,1,2);
    proxyLaout->addWidget(rbSshProxy,1,0,1,2);
    proxyLaout->addWidget(rbHttpProxy,2,0,1,2);
    proxyLaout->addWidget(new QLabel(tr("Host:"),proxyBox),3,0);
    proxyLaout->addWidget(new QLabel(tr("Port:"),proxyBox),4,0);
    proxyLaout->addWidget(proxyHost,3,1);
    proxyLaout->addWidget(proxyPort,4,1);

    proxyLaout->addWidget(cbProxySameUser,0,3,1,3);
    proxyLaout->addWidget(lProxyLogin=new QLabel(tr("Login:"******"&Session type" ),this );
    QGridLayout* cmdLay=new QGridLayout ( deskSess );
#else
    QFrame* deskSess=this;
    QHBoxLayout* cmdLay=new QHBoxLayout ();
    cmdLay->addWidget ( new QLabel ( tr ( "Session type:" ),this ) );
#endif
    sessBox=new QComboBox ( deskSess );
    cmd=new QLineEdit ( deskSess );
    cmdCombo=new QComboBox ( deskSess );
    cmdCombo->setEditable ( true );
    sessBox->addItem ( "KDE" );
    sessBox->addItem ( "GNOME" );
    sessBox->addItem ( "LXDE" );
    sessBox->addItem ( "XFCE" );
    sessBox->addItem ( "MATE" );
    sessBox->addItem ( "UNITY" );
    sessBox->addItem ( "CINNAMON" );
    sessBox->addItem ( "TRINITY" );
    sessBox->addItem ( "OPENBOX" );
    sessBox->addItem ( "ICEWM" );
    sessBox->addItem ( tr ( "Connect to Windows Terminal Server" ) );
    sessBox->addItem ( tr ( "XDMCP" ) );
    sessBox->addItem ( tr ( "Connect to local desktop" ) );
    sessBox->addItem ( tr ( "Custom desktop" ) );
    sessBox->addItem ( tr ( "Single application" ) );
    sessBox->addItem ( tr ( "Published applications" ) );
    cmdLay->addWidget ( sessBox,0,1,Qt::AlignLeft );
    leCmdIp=new QLabel ( tr ( "Command:" ),deskSess );
    pbAdvanced=new QPushButton ( tr ( "Advanced options..." ),deskSess );
    cmdLay->addWidget ( leCmdIp,0,2 );
    cmdLay->setColumnStretch(6,1);
    cmdLay->addWidget ( cmd ,0,3);
    cmdLay->addWidget ( cmdCombo,0,4 );
    cmdLay->addWidget ( pbAdvanced ,0,5);
    cmdCombo->setSizePolicy ( QSizePolicy::Expanding,
                              QSizePolicy::Preferred );
    cmdCombo->hide();
    pbAdvanced->hide();
    cmdCombo->addItem ( "" );
    cmdCombo->addItems ( mainWindow->transApplicationsNames() );
    cmdCombo->lineEdit()->setText ( tr ( "Path to executable" ) );
    cmdCombo->lineEdit()->selectAll();
#ifndef Q_WS_HILDON
    sessLay->addLayout ( slay );
    sessLay->addLayout ( ilay );
    sessLay->addLayout ( pathLay );
    if ( !miniMode )
        sessLay->addSpacing ( 15 );
    sessLay->addWidget ( sgb );
    sessLay->addWidget ( deskSess );
#ifdef Q_OS_LINUX
    cbDirectRDP=new QCheckBox(tr("Direct RDP connection"), deskSess);
    cmdLay->addWidget(cbDirectRDP,1,0,1,6);
    cbDirectRDP->hide();
    connect(cbDirectRDP,SIGNAL(clicked()), this, SLOT(slot_rdpDirectClicked()));
#endif

#else
    QVBoxLayout* sHildILay = new QVBoxLayout();
    sHildILay->addLayout ( slay );
    sHildILay->addLayout ( ilay );
    sHildILay->addStretch();
    QHBoxLayout* sHildLay = new QHBoxLayout();
    sHildLay->addLayout ( sHildILay );

    QFrame* vl=new QFrame;
    vl->setLineWidth ( 0 );
    vl->setFrameStyle ( QFrame::VLine|QFrame::Plain );
    sHildLay->addWidget ( vl );
    sHildLay->setSpacing ( 6 );
    sHildLay->addLayout ( sgbLay );
    sessLay->addLayout ( sHildLay );
    sessLay->addStretch();
    sessLay->addLayout ( cmdLay );
#endif
    sessLay->addStretch();

    connect ( icon,SIGNAL ( clicked() ),this,SLOT ( slot_getIcon() ) );
    connect ( openKey,SIGNAL ( clicked() ),this,SLOT ( slot_getKey() ) );
    connect ( pbAdvanced,SIGNAL ( clicked() ),this,
              SLOT ( slot_rdpOptions() ) );
    connect ( sessBox,SIGNAL ( activated ( int ) ),this,
              SLOT ( slot_changeCmd ( int ) ) );
    connect ( sessName,SIGNAL ( textChanged ( const QString & ) ),this,
              SIGNAL ( nameChanged ( const QString & ) ) );
    connect (server, SIGNAL(textChanged(const QString&)),this, SLOT(slot_emitSettings()));
    connect (uname, SIGNAL(textChanged(const QString&)),this, SLOT(slot_emitSettings()));
    connect (cbKrbLogin, SIGNAL(clicked(bool)), this, SLOT(slot_krbChecked()));
#ifdef Q_OS_LINUX
    connect (rdpPort, SIGNAL(valueChanged(int)),this, SLOT(slot_emitSettings()));
#endif

    connect ( pbOpenProxyKey,SIGNAL ( clicked() ),this,SLOT ( slot_proxyGetKey()) );
    connect ( proxyType, SIGNAL ( buttonClicked(int)) ,this,SLOT ( slot_proxyType()));
    connect (cbProxy, SIGNAL(clicked(bool)), this, SLOT(slot_proxyOptions()));
    connect (cbProxySameUser, SIGNAL(clicked(bool)), this, SLOT(slot_proxySameLogin()));
    connect ( pathButton, SIGNAL(clicked(bool)), this, SLOT(slot_openFolder()));

    readConfig();
}
コード例 #16
0
/*!
 * Control creation for VorbitalDlg
 */
void VorbitalDlg::CreateControls()
{
    qDebug() << "CreateControls.";
    setAcceptDrops(true);

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

    QHBoxLayout* firstRowLayout = new QHBoxLayout();
    rootLayout->addLayout(firstRowLayout);

    firstRowLayout->setContentsMargins(QMargins(0,0,0,0));
    firstRowLayout->setSpacing(2);

	_btnBrowse = new QPushButton( this );
    _btnBrowse->setIcon(QPixmap(add_xpm));
	_btnBrowse->setToolTip("Add file to playlist.");
    connect(_btnBrowse, SIGNAL(released()), this, SLOT(OnButtonBrowseClick()));
    firstRowLayout->addWidget(_btnBrowse);

    _btnBrowseFolder = new QPushButton( this );
    _btnBrowseFolder->setIcon(QPixmap(folder_xpm));
	_btnBrowseFolder->setToolTip("Add folder to playlist.");
    connect(_btnBrowseFolder, SIGNAL(released()), this, SLOT(OnButtonBrowseFolderClick()));
    firstRowLayout->addWidget(_btnBrowseFolder);

    _btnRemove = new QPushButton( this );
    _btnRemove->setIcon(QPixmap(remove_xpm));
	_btnRemove->setToolTip("Remove selected item from playlist.");
    connect(_btnRemove, SIGNAL(released()), this, SLOT(OnButtonRemoveClick()));
    firstRowLayout->addWidget(_btnRemove);

    _btnClear = new QPushButton( this );
    _btnClear->setIcon(QPixmap(null_xpm));
	_btnClear->setToolTip("Clear playlist.");
    connect(_btnClear, SIGNAL(released()), this, SLOT(OnButtonClearClick()));
    firstRowLayout->addWidget(_btnClear);

	_btnReverse = new QPushButton( this );
    _btnReverse->setIcon(QPixmap(reverse_xpm));
	_btnReverse->setToolTip("Previous track.");
    connect(_btnReverse, SIGNAL(released()), this, SLOT(OnButtonReverseClick()));
    firstRowLayout->addWidget(_btnReverse);

	_btnPause = new QPushButton( this );
    _btnPause->setIcon(QPixmap(pause_xpm));
	_btnPause->setToolTip("Pause.");
    connect(_btnPause, SIGNAL(released()), this, SLOT(OnButtonPauseClick()));
    firstRowLayout->addWidget(_btnPause);

	_btnStop = new QPushButton( this );
    _btnStop->setIcon(QPixmap(stop_xpm));
	_btnStop->setToolTip("Stop.");
    connect(_btnStop, SIGNAL(released()), this, SLOT(OnButtonStopClick()));
    firstRowLayout->addWidget(_btnStop);

	_btnPlay = new QPushButton( this );
    _btnPlay->setIcon(QPixmap(play_xpm));
	_btnPlay->setToolTip("Play.");
    connect(_btnPlay, SIGNAL(released()), this, SLOT(OnButtonPlayClick()));
    firstRowLayout->addWidget(_btnPlay);

    _btnForward = new QPushButton( this );
    _btnForward->setIcon(QPixmap(forward_xpm));
	_btnForward->setToolTip("Next track.");
    connect(_btnForward, SIGNAL(released()), this, SLOT(OnButtonForwardClick()));
    firstRowLayout->addWidget(_btnForward);

    _btnRandomize = new QPushButton( this );
    _btnRandomize->setIcon(QPixmap(normal_xpm));
	_btnRandomize->setToolTip("Turn shuffle on or off.");
    connect(_btnRandomize, SIGNAL(released()), this, SLOT(OnButtonRandomizeClick()));
    firstRowLayout->addWidget(_btnRandomize);

	_btnAbout = new QPushButton( this );
    _btnAbout->setIcon(QPixmap(question_xpm));
	_btnAbout->setToolTip("About Vorbital Player.");
    connect(_btnAbout, SIGNAL(released()), this, SLOT(OnAbout()));
    firstRowLayout->addWidget(_btnAbout);

    QHBoxLayout* secondRowLayout = new QHBoxLayout();
    rootLayout->addLayout(secondRowLayout);

    secondRowLayout->insertSpacing(6, 6);

	QLabel* itemStaticText16 = new QLabel(this);
    itemStaticText16->setText("SR:");
	itemStaticText16->setToolTip("Sample rate.");
    secondRowLayout->addWidget(itemStaticText16);

    _txtSampleRate = new QLabel(this);
    _txtSampleRate->setText("0");
    secondRowLayout->addWidget(_txtSampleRate);

	secondRowLayout->insertSpacing(4, 4);

	QLabel* itemStaticText20 = new QLabel(this);
    itemStaticText20->setText("BR:");
	itemStaticText20->setToolTip("Bit rate.");
    secondRowLayout->addWidget(itemStaticText20);

    _txtBitRate = new QLabel(this);
    _txtBitRate->setText("0");
    secondRowLayout->addWidget(_txtBitRate);

    secondRowLayout->insertSpacing(4, 4);

    _txtChannels = new QLabel(this);
    _txtChannels->setText("Stereo");
    secondRowLayout->addWidget(_txtChannels);

	secondRowLayout->insertSpacing(10, 10);

    _volumeSlider = new QSlider(Qt::Horizontal, this);
    _volumeSlider->setMinimum(0);
    _volumeSlider->setMaximum(100);
    _volumeSlider->setValue(100);
    _volumeSlider->setMaximumSize(100, 24);
    connect(_volumeSlider, SIGNAL(valueChanged(int)), this, SLOT(OnVolume(int)));
    secondRowLayout->addWidget(_volumeSlider);

	secondRowLayout->insertSpacing(10, 10);

	_txtTime = new QLabel(this);
    _txtTime->setText("0:00");
    secondRowLayout->addWidget(_txtTime);

	QBitmap* bitmap = new QBitmap(120, 120);
	_albumArt = new QLabel(this);
    _albumArt->setPixmap(*bitmap);
	rootLayout->addWidget(_albumArt);
	_albumArt->setVisible(false);

	_lstPlaylist = new QListWidget( this );
	rootLayout->addWidget(_lstPlaylist);
	connect(_lstPlaylist, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(OnPlaylistDoubleClick(QListWidgetItem*)), Qt::AutoConnection);

    connect(this, SIGNAL(bitrateChanged(int)), this, SLOT(OnBitrate(int)), Qt::AutoConnection);
    connect(this, SIGNAL(numchannelsChanged(int)), this, SLOT(OnNumChannels(int)), Qt::AutoConnection);
    connect(this, SIGNAL(samplerateChanged(int)), this, SLOT(OnSampleRate(int)), Qt::AutoConnection);
    connect(this, SIGNAL(timeChanged(int)), this, SLOT(OnTime(int)), Qt::AutoConnection);
}
コード例 #17
0
TransactionView::TransactionView(QWidget *parent) :
    QWidget(parent), model(0), transactionProxyModel(0),
    transactionView(0)
{
    setContentsMargins(0,0,0,0);
    QHBoxLayout *hlayout = new QHBoxLayout();
    hlayout->setContentsMargins(0,0,0,0);

#ifdef Q_OS_MAC
    hlayout->setSpacing(5);
    hlayout->addSpacing(26);
#else
    hlayout->setSpacing(0);
    hlayout->addSpacing(23);
#endif

    // Build filter row
    dateWidget = new QComboBox(this);
#ifdef Q_OS_MAC
    dateWidget->setFixedWidth(151);
#else
    dateWidget->setFixedWidth(150);
#endif
    dateWidget->addItem(tr("All"), All);
    dateWidget->addItem(tr("Today"), Today);
    dateWidget->addItem(tr("This week"), ThisWeek);
    dateWidget->addItem(tr("This month"), ThisMonth);
    dateWidget->addItem(tr("Last month"), LastMonth);
    dateWidget->addItem(tr("This year"), ThisYear);
    dateWidget->addItem(tr("Range..."), Range);
    hlayout->addWidget(dateWidget);

    typeWidget = new QComboBox(this);
#ifdef Q_OS_MAC
    typeWidget->setFixedWidth(121);
#else
    typeWidget->setFixedWidth(120);
#endif

    typeWidget->addItem(tr("All"), TransactionFilterProxy::ALL_TYPES);
    typeWidget->addItem(tr("Received with"), TransactionFilterProxy::TYPE(TransactionRecord::RecvWithAddress) |
                                        TransactionFilterProxy::TYPE(TransactionRecord::RecvFromOther));
    typeWidget->addItem(tr("Sent to"), TransactionFilterProxy::TYPE(TransactionRecord::SendToAddress) |
                                  TransactionFilterProxy::TYPE(TransactionRecord::SendToOther));
    typeWidget->addItem(tr("To yourself"), TransactionFilterProxy::TYPE(TransactionRecord::SendToSelf));
    typeWidget->addItem(tr("Interest"), TransactionFilterProxy::TYPE(TransactionRecord::Generated));
    typeWidget->addItem(tr("Other"), TransactionFilterProxy::TYPE(TransactionRecord::Other));

    hlayout->addWidget(typeWidget);

    addressWidget = new QLineEdit(this);
#if QT_VERSION >= 0x040700
    /* Do not move this to the XML file, Qt before 4.7 will choke on it */
    addressWidget->setPlaceholderText(tr("Enter address or label to search"));
#endif
    hlayout->addWidget(addressWidget);

    amountWidget = new QLineEdit(this);
#if QT_VERSION >= 0x040700
    /* Do not move this to the XML file, Qt before 4.7 will choke on it */
    amountWidget->setPlaceholderText(tr("Min amount"));
#endif
    amountWidget->setFixedWidth(100);
    amountWidget->setValidator(new QDoubleValidator(0, 1e20, 8, this));
    hlayout->addWidget(amountWidget);

    QVBoxLayout *vlayout = new QVBoxLayout(this);
    vlayout->setContentsMargins(0,0,0,0);
    vlayout->setSpacing(0);

    QTableView *view = new QTableView(this);
    view->setFont(qFont);
    view->setMouseTracking(true);
    view->viewport()->setAttribute(Qt::WA_Hover, true);
    view->horizontalHeader()->setHighlightSections(false);
    vlayout->addLayout(hlayout);
    vlayout->addWidget(createDateRangeWidget());
    vlayout->addWidget(view);
    vlayout->setSpacing(0);
    int width = view->verticalScrollBar()->sizeHint().width();
    // Cover scroll bar width with spacing
#ifdef Q_OS_MAC
    hlayout->addSpacing(width+2);
#else
    hlayout->addSpacing(width);
#endif
    // Always show scroll bar
    view->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
    view->setTabKeyNavigation(false);
    view->setContextMenuPolicy(Qt::CustomContextMenu);

    transactionView = view;

    totalWidget = new QLabel(this);
    totalWidget->setFont(qFont);
    totalWidget->setAlignment(Qt::AlignBottom | Qt::AlignRight);
    totalWidget->setLayoutDirection(Qt::RightToLeft);
    totalWidget->setFixedHeight(25);
    totalWidget->setFixedWidth(500);
    totalWidget->setText(tr("Total: "));
    totalWidget->setToolTip(tr("Total of displayed transactions.\nHidden decimals are not totaled."));
    vlayout->addWidget(totalWidget);

    // Actions
    QAction *copyAddressAction = new QAction(tr("Copy address"), this);
    QAction *copyLabelAction = new QAction(tr("Copy label"), this);
    QAction *copyAmountAction = new QAction(tr("Copy amount"), this);
    QAction *copyTxIDAction = new QAction(tr("Copy transaction ID"), this);
    QAction *editLabelAction = new QAction(tr("Edit label"), this);
    QAction *showDetailsAction = new QAction(tr("Show transaction details"), this);

    contextMenu = new QMenu();
    contextMenu->addAction(copyAddressAction);
    contextMenu->addAction(copyLabelAction);
    contextMenu->addAction(copyAmountAction);
    contextMenu->addAction(copyTxIDAction);
    contextMenu->addAction(editLabelAction);
    contextMenu->addAction(showDetailsAction);

    // Connect actions
    connect(dateWidget, SIGNAL(activated(int)), this, SLOT(chooseDate(int)));
    connect(typeWidget, SIGNAL(activated(int)), this, SLOT(chooseType(int)));
    connect(addressWidget, SIGNAL(textChanged(QString)), this, SLOT(changedPrefix(QString)));
    connect(amountWidget, SIGNAL(textChanged(QString)), this, SLOT(changedAmount(QString)));

    connect(view, SIGNAL(doubleClicked(QModelIndex)), this, SIGNAL(doubleClicked(QModelIndex)));
    connect(view, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextualMenu(QPoint)));

    connect(copyAddressAction, SIGNAL(triggered()), this, SLOT(copyAddress()));
    connect(copyLabelAction, SIGNAL(triggered()), this, SLOT(copyLabel()));
    connect(copyAmountAction, SIGNAL(triggered()), this, SLOT(copyAmount()));
    connect(copyTxIDAction, SIGNAL(triggered()), this, SLOT(copyTxID()));
    connect(editLabelAction, SIGNAL(triggered()), this, SLOT(editLabel()));
    connect(showDetailsAction, SIGNAL(triggered()), this, SLOT(showDetails()));
}
コード例 #18
0
ファイル: loginWidget.cpp プロジェクト: KhuramAli/pcbsd
LoginWidget::LoginWidget(QWidget* parent) : QGroupBox(parent)
{
  //Set the default values for the current item
  idL.clear(); //Clear the login names available
  userSelected = FALSE; //focus on the username first
  pwVisible = FALSE; //Have the password box hide the input behind dots
  allowPWVisible = TRUE; //Allow the password button to show the password text
  showUsers = true; //Display the available users on the system
	
  //Create the Grid layout
  QHBoxLayout* hlayout1 = new QHBoxLayout();
  QHBoxLayout* hlayout2 = new QHBoxLayout();
  QHBoxLayout* hlayout3 = new QHBoxLayout();
  QVBoxLayout* vlayout = new QVBoxLayout();
  QFormLayout* flayout = new QFormLayout();
  //Create the items
  userIcon = new QToolButton;
  	QAction* tmp = new QAction(this);
	userIcon->setDefaultAction( tmp );
	userIcon->setFocusPolicy(Qt::NoFocus);
  listUserBig = new QListWidget;
  	listUserBig->setFocusPolicy(Qt::StrongFocus);
  	listUserBig->setSelectionMode(QAbstractItemView::SingleSelection);
  listUsers = new QComboBox;
  	listUsers->setFocusPolicy(Qt::NoFocus); //big one gets keyboard focus instead
  linePassword = new QLineEdit;
  	linePassword->setFocusPolicy(Qt::StrongFocus);
  lineUsername = new QLineEdit;
	lineUsername->setFocusPolicy(Qt::StrongFocus);
  pushLogin = new QToolButton;
	QAction* tmp1 = new QAction(this);
	pushLogin->setDefaultAction( tmp1 );
	pushLogin->setFocusPolicy(Qt::StrongFocus);
  pushViewPassword = new QToolButton;
	QAction* tmp2 = new QAction(this);
	pushViewPassword->setDefaultAction( tmp2 );
	pushViewPassword->setFocusPolicy(Qt::NoFocus);
  pushUserIcon = new QToolButton;
	QAction* tmp3 = new QAction(this);
	pushUserIcon->setDefaultAction( tmp3 );
	pushUserIcon->setFocusPolicy(Qt::NoFocus);
  listDE = new QComboBox;
  deIcon = new QLabel;
	
  //Add the items to the grid
    //user not yet selected widgets
      hlayout1->addWidget(userIcon);
    vlayout->addLayout(hlayout1);
    vlayout->addWidget(listUserBig);
    //User selected widgets
        hlayout3->addWidget(listUsers);
        hlayout3->addWidget(lineUsername);
      flayout->addRow(pushUserIcon, hlayout3);
      flayout->addRow(pushViewPassword, linePassword);
      flayout->addRow(deIcon,listDE);
    vlayout->addSpacing(15);
    vlayout->addLayout(flayout);
    vlayout->addSpacing(20);
      hlayout2->addWidget(pushLogin);
    vlayout->addLayout(hlayout2);
    
  //Setup the Signals/Slots
  connect(pushLogin,SIGNAL(clicked()),this,SLOT(slotTryLogin()));
  connect(pushUserIcon,SIGNAL(triggered(QAction*)), this, SLOT(slotUserActivated()));
  connect(userIcon,SIGNAL(triggered(QAction*)), this, SLOT(slotUserActivated()));
  connect(listUsers,SIGNAL(activated(int)),this,SLOT(slotChooseUser(int)));
  connect(listUserBig,SIGNAL(itemClicked(QListWidgetItem*)),this,SLOT(slotUserSelected()) );
  connect(listUserBig,SIGNAL(currentRowChanged(int)),this,SLOT(slotUserHighlighted(int)) );
  connect(listDE,SIGNAL(currentIndexChanged(int)),this,SLOT(slotDesktopChanged(int)) );
  allowPasswordView(allowPWVisible); //setup signal/slots for pushViewPassword
  //Set this layout for the loginWidget
  this->setLayout(vlayout);
  
  //Run the display setup to ensure appropriate visiblility/usage
  updateWidget();
  
}
コード例 #19
0
ScheduleScreen::ScheduleScreen(QWidget *parent) :
    QWidget(parent)
{
    setObjectName("ScheduleScreen");
    //get an instance of the global configuration
    m_globalSettings = GlobalSettings::getInstance();

    // seqNumber will track the number of points that have been created
    seqNumber = 0;

    // allow user to click off points to remove blur and see all
    connect(this, SIGNAL(clicked()), this, SLOT(unselectDay()));
    //allow valueChanged signal to trigger updateData() slot
    connect(this, SIGNAL(valueChanged()), this, SLOT(updateData()));
    // create title
    QLabel *title = new QLabel("Set your WEEKLY SCHEDULE");
    title->setObjectName("title");

    // create time represented by current point
    currentTime = new QLabel();
    currentTime->setObjectName("currentTime");
    currentTime->setMinimumWidth(80);

    // create back button
    QPushButton *backButton = new QPushButton();
    backButton->setIcon(QIcon(":/Images/glossy-blue-orb-icon-arrowback.png"));
    backButton->setIconSize(QSize(40,40));
    backButton->setFocusPolicy(Qt::NoFocus);
    backButton->setObjectName("backButton");
    connect(backButton,SIGNAL(clicked()),this,SLOT(close()));

    // create layout for top of screen
    QHBoxLayout *topLayout = new QHBoxLayout;
    topLayout->addWidget(currentTime);
    topLayout->addStretch();
    topLayout->addWidget(title);
    topLayout->addStretch();
    topLayout->addWidget(backButton);

    view = new QGraphicsView();
    view->setBackgroundBrush(QBrush(Qt::black));
    view->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    view->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    view->setRenderHints(QPainter::Antialiasing | QPainter::TextAntialiasing);
    view->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);


    // create final layout

    QVBoxLayout *mainLayout = new QVBoxLayout;
    mainLayout->addLayout(topLayout);
    QHBoxLayout* viewLayout = new QHBoxLayout;
    viewLayout->addWidget(view);
    viewLayout->setContentsMargins(0,0,0,0);
    viewLayout->setSpacing(0);
    mainLayout->addLayout(viewLayout);
    mainLayout->setContentsMargins(0,0,0,0);
    mainLayout->setSpacing(0);

    QWidget *sizeLimiterWidget = new QWidget;
    sizeLimiterWidget->setMaximumSize(800, 450);

    sizeLimiterWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    sizeLimiterWidget->setLayout(mainLayout);
    sizeLimiterWidget->setContentsMargins(0,0,0,0);
    QHBoxLayout* contentsBox = new QHBoxLayout;
    contentsBox->setContentsMargins(0,0,0,0);
    contentsBox->addWidget(sizeLimiterWidget);

    // show final layout
    setLayout(contentsBox);

    resize(qApp->desktop()->size());
    updateGeometry();

    scene = NULL;
    m_initialized = false;
    currentPoint  = NULL;
}
コード例 #20
0
ファイル: eresumen.cpp プロジェクト: chungote/gestotux
EResumen::EResumen( QWidget *parent, tipo que )
: EVentana( parent )
{
 setObjectName( "selectorResumen" );
 setWindowTitle( "Seleccione el Resumen" );
 setAttribute( Qt::WA_DeleteOnClose );
 generar = que;
 QVBoxLayout *layoutPrincipal = new QVBoxLayout( this );
 layoutPrincipal->setMargin( 3 );
 layoutPrincipal->setSpacing( 3 );
 switch( que )
 {
  case diario:
  {
   QGroupBox *g = new QGroupBox( this );
   g->setTitle( "Elija la fecha del resumen" );
   g->setAlignment( Qt::AlignHCenter );
   g->setSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum );
   QVBoxLayout *v = new QVBoxLayout( g );
   CWfecha = new QCalendarWidget( g );
   CWfecha->setGridVisible( false );
   CWfecha->setMaximumDate( QDate::currentDate() );
   CWfecha->setSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum );
   v->addWidget( CWfecha );
   g->adjustSize();
   layoutPrincipal->addWidget( g );
   break;
  }
  case mensual:
  {
    QGroupBox *groupBox = new QGroupBox( this );
    groupBox->setObjectName(QString::fromUtf8("groupBox"));
    groupBox->setTitle( "Elija el mes para el resumen" );
    groupBox->setAlignment( Qt::AlignCenter );
    groupBox->setSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum );

    QVBoxLayout *v = new QVBoxLayout(groupBox);
    v->setObjectName( "vLayout" );
    QHBoxLayout *h1 = new QHBoxLayout();
    h1->setObjectName("hLayout1");

    QLabel *Lmes = new QLabel(groupBox);
    Lmes->setObjectName(QString::fromUtf8("labelMes"));
    Lmes->setText( tr( "Mes:" ) );
    h1->addWidget(Lmes);

    CBMes = new QComboBox(groupBox);
    CBMes->setObjectName(QString::fromUtf8("CBMes"));
    // Inserto los meses
    QLocale locale;
    for( int i = 1; i<=12; i++ )
    {
     CBMes->insertItem( i, locale.monthName( i ) );
    }
    CBMes->setCurrentIndex( QDate::currentDate().month() );
    h1->addWidget(CBMes);


    v->addLayout(h1);

    QHBoxLayout *horizontalLayout_2 = new QHBoxLayout();
    horizontalLayout_2->setObjectName(QString::fromUtf8("horizontalLayout_2"));

    QLabel *Lano = new QLabel(groupBox);
    Lano->setObjectName(QString::fromUtf8("lano"));
    Lano->setText( tr( "Año:" ) );
    horizontalLayout_2->addWidget(Lano);

    SBAno = new QSpinBox(groupBox);
    SBAno->setObjectName(QString::fromUtf8("SBAno"));
    SBAno->setMaximum( QDate::currentDate().year() );
    SBAno->setSingleStep( 1 );
    SBAno->setValue( QDate::currentDate().year() );

    horizontalLayout_2->addWidget(SBAno);

    v->addLayout(horizontalLayout_2);

   layoutPrincipal->addWidget( groupBox );
   break;
  }
  case anual:
  {
   QHBoxLayout *layout = new QHBoxLayout( this );
   QLabel *etiqueta = new QLabel( this );
   etiqueta->setText( QString( "Año:" ) );
   seleccion = new QSpinBox( this );
   seleccion->setRange( 0, QDate::currentDate().year() );
   seleccion->setSingleStep( 1 );
   seleccion->setValue( QDate::currentDate().year() );
   layout->addWidget( etiqueta );
   layout->addWidget( seleccion );
   layoutPrincipal->addLayout( layout );
   break;
  }
  case semanal:
  {
   QGroupBox *g = new QGroupBox( this );
   g->setTitle( "Elija un dia de la semana para el resumen" );
   g->setAlignment( Qt::AlignHCenter );
   g->setSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum );
   QVBoxLayout *v = new QVBoxLayout( g );
   CWfecha = new QCalendarWidget( g );
   CWfecha->setGridVisible( true );
   CWfecha->setSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum );
   v->addWidget( CWfecha );
   g->adjustSize();
   layoutPrincipal->addWidget( g );
   break;
  }
  case entrefechas:
  {
    QHBoxLayout *horizontalLayout = new QHBoxLayout();
    horizontalLayout->setObjectName( "horizontalLayout" );
    horizontalLayout->setContentsMargins(0, 0, 0, 0);
    QLabel *LInicio = new QLabel(this);
    LInicio->setObjectName( "LInicio" );
    LInicio->setText( "Fecha de inicio:" );

    horizontalLayout->addWidget(LInicio);

    DEInicio = new QDateEdit(this);
    DEInicio->setObjectName( "DEInicio" );
    DEInicio->setCalendarPopup(true);

    horizontalLayout->addWidget(DEInicio);

    QHBoxLayout *horizontalLayout_2 = new QHBoxLayout();
    horizontalLayout_2->setObjectName( "horizontalLayout_2" );
    horizontalLayout_2->setContentsMargins(0, 0, 0, 0);
    QLabel *LFin = new QLabel(this);
    LFin->setObjectName( "LFin" );
    LFin->setText( "Fecha de Fin:" );

    horizontalLayout_2->addWidget(LFin);

    DEFin = new QDateEdit(this);
    DEFin->setObjectName( "DEFin" );
    DEFin->setCalendarPopup(true);
    DEFin->setMaximumDate( QDate::currentDate() );

    horizontalLayout_2->addWidget(DEFin);

    layoutPrincipal->addItem( horizontalLayout );
    layoutPrincipal->addItem( horizontalLayout_2 );
  }
 }
 QAction *ActGenerar = new QAction( "Generar Reporte", this );
 ActGenerar->setIcon( QIcon( ":/imagenes/reporte.png" ) );
 connect( ActGenerar, SIGNAL( triggered() ), this, SLOT( generarResumen() ) );
 addAction( ActGenerar );
 EActCerrar *ActCerrar = new EActCerrar( this );
 connect( ActCerrar, SIGNAL( triggered() ), this, SLOT( close() ) );
 addAction( ActCerrar );
 this->adjustSize();
}
コード例 #21
0
comment::comment( QWidget* parent, const char* name, bool modal, Qt::WindowFlags fl ) :
  QDialog( parent, fl )
{
  if(name)
    setObjectName(name);
  setWindowTitle(tr("Comment"));
  if(modal)
    setWindowModality(Qt::WindowModal);

  _commentid = -1;
  _targetId = -1;
  _mode = cNew;

  if (!name)
    setObjectName("comment");

  QVBoxLayout *moreLayout = new QVBoxLayout(this);
  moreLayout->setContentsMargins(5, 5, 5, 5);
  moreLayout->setSpacing(7);
  moreLayout->setObjectName("moreLayout");

  QHBoxLayout *commentLayout = new QHBoxLayout(this);
  commentLayout->setContentsMargins(5, 5, 5, 5);
  commentLayout->setSpacing(7);
  commentLayout->setObjectName("commentLayout");

  QVBoxLayout *layout11  = new QVBoxLayout(this);
  layout11->setSpacing(5);
  layout11->setObjectName("layout11");

  QHBoxLayout *layout9   = new QHBoxLayout(this);
  layout9->setObjectName("layout9");

  QBoxLayout *layout8    = new QHBoxLayout(this);
  layout8->setSpacing(5);
  layout8->setObjectName("layout8");

  QVBoxLayout *layout181 = new QVBoxLayout(this);
  layout181->setObjectName("layout181");

  QVBoxLayout *layout180 = new QVBoxLayout(this);
  layout180->setSpacing(5);
  layout180->setObjectName("layout180");


  QLabel *_cmnttypeLit = new QLabel(tr("Comment Type:"), this);
  _cmnttypeLit->setObjectName("_cmnttypeLit");
  layout8->addWidget( _cmnttypeLit );

  _cmnttype = new XComboBox( FALSE, this);
  _cmnttype->setObjectName("_cmnttype" );
  layout8->addWidget( _cmnttype );
  layout9->addLayout( layout8 );

  QSpacerItem* spacer = new QSpacerItem( 66, 10, QSizePolicy::Expanding, QSizePolicy::Minimum );
  layout9->addItem( spacer );
  layout11->addLayout( layout9 );

  _comment = new QTextEdit( this);
  _comment->setObjectName("_comment" );
  layout11->addWidget( _comment );
  commentLayout->addLayout( layout11 );

  _close = new QPushButton(tr("&Cancel"), this);
  _close->setObjectName("_close");
  layout180->addWidget( _close );

  _save = new QPushButton(tr("&Save"), this);
  _save->setObjectName("_save");
  layout180->addWidget( _save );

  _prev = new QPushButton(tr("&Previous"), this);
  _prev->setObjectName("_prev");
  layout180->addWidget( _prev );

  _next = new QPushButton(tr("&Next"), this);
  _next->setObjectName("_next");
  layout180->addWidget( _next );

  layout181->addLayout( layout180 );
  QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding );
  layout181->addItem( spacer_2 );

  _more = new QPushButton(tr("Show &More"), this);
  _more->setObjectName("_more");
  _more->setCheckable(true);
  layout181->addWidget(_more);

  commentLayout->addLayout( layout181 );

  moreLayout->addLayout(commentLayout);

  _comments = new Comments(this);
  _comments->setObjectName("_comments");
  _comments->setReadOnly(true);
  _comments->findChild<XCheckBox*>("_verbose")->setForgetful(true);
  _comments->findChild<XCheckBox*>("_verbose")->hide();
  _comments->findChild<XCheckBox*>("_verbose")->setChecked(false);
  _comments->_newComment->setVisible(false);
  _comments->setVerboseCommentList(true);
  _comments->setVisible(false);
  _comments->setEditable(false);
  moreLayout->addWidget(_comments);

  resize( QSize(524, 270).expandedTo(minimumSizeHint()) );
  //clearWState( WState_Polished );

// signals and slots connections
  connect(_save, SIGNAL(clicked()), this, SLOT(sSave()));
  connect(_close, SIGNAL(clicked()), this, SLOT(reject()));
  connect(_next, SIGNAL(clicked()), this, SLOT(sNextComment()));
  connect(_prev, SIGNAL(clicked()), this, SLOT(sPrevComment()));
  connect(_more, SIGNAL(toggled(bool)), _comments, SLOT(setVisible(bool)));

// tab order
  setTabOrder( _cmnttype, _comment );
  setTabOrder( _comment, _save );
  setTabOrder( _save, _close );

  _source = Comments::Uninitialized;
  _cmnttype->setAllowNull(TRUE);
}
コード例 #22
0
OpenDialog::OpenDialog(
   QWidget* pParent, const QString& n1, const QString& n2, const QString& n3,
   bool bMerge, const QString& outputName, const char* slotConfigure, OptionDialog* pOptions )
: QDialog( pParent )
{
   setObjectName("OpenDialog");
   setModal(true);
   m_pOptions = pOptions;

   QVBoxLayout* v = new QVBoxLayout( this );
   v->setMargin(5);
   QGridLayout* h = new QGridLayout();
   v->addLayout(h);
   h->setSpacing( 5 );
   h->setColumnStretch( 1, 10 );

   QLabel* label  = new QLabel( i18n("A (Base):"), this );

   m_pLineA = new QComboBox();
   m_pLineA->setEditable(true);
   m_pLineA->insertItems( 0, m_pOptions->m_recentAFiles );
   m_pLineA->setEditText( KUrl(n1).prettyUrl() );
   m_pLineA->setMinimumWidth( 200 );
   QPushButton * button = new QPushButton( i18n("File..."), this );
   connect( button, SIGNAL(clicked()), this, SLOT( selectFileA() ) );
   QPushButton * button2 = new QPushButton( i18n("Dir..."), this );
   connect( button2, SIGNAL(clicked()), this, SLOT( selectDirA() ) );
   connect( m_pLineA, SIGNAL(editTextChanged(const QString&)), this, SLOT(inputFilenameChanged() ) );

   h->addWidget( label,    0, 0 );
   h->addWidget( m_pLineA,  0, 1 );
   h->addWidget( button,   0, 2 );
   h->addWidget( button2,  0, 3 );

   label    = new QLabel( "B:", this );
   m_pLineB  = new QComboBox();
   m_pLineB->setEditable(true);
   m_pLineB->insertItems( 0, m_pOptions->m_recentBFiles );
   m_pLineB->setEditText( KUrl(n2).prettyUrl() );
   m_pLineB->setMinimumWidth( 200 );
   button   = new QPushButton( i18n("File..."), this );
   connect( button, SIGNAL(clicked()), this, SLOT( selectFileB() ) );
   button2   = new QPushButton( i18n("Dir..."), this );
   connect( button2, SIGNAL(clicked()), this, SLOT( selectDirB() ) );
   connect( m_pLineB, SIGNAL(editTextChanged(const QString&)), this, SLOT(inputFilenameChanged() ) );

   h->addWidget( label,     1, 0 );
   h->addWidget( m_pLineB,  1, 1 );
   h->addWidget( button,    1, 2 );
   h->addWidget( button2,   1, 3 );

   label  = new QLabel( i18n("C (Optional):"), this );
   m_pLineC= new QComboBox();
   m_pLineC->setEditable(true);
   m_pLineC->insertItems( 0, m_pOptions->m_recentCFiles );
   m_pLineC->setEditText( KUrl(n3).prettyUrl() );
   m_pLineC->setMinimumWidth( 200 );
   button = new QPushButton( i18n("File..."), this );
   connect( button, SIGNAL(clicked()), this, SLOT( selectFileC() ) );
   button2   = new QPushButton( i18n("Dir..."), this );
   connect( button2, SIGNAL(clicked()), this, SLOT( selectDirC() ) );
   connect( m_pLineC, SIGNAL(editTextChanged(const QString&)), this, SLOT(inputFilenameChanged() ) );

   h->addWidget( label,     2, 0 );
   h->addWidget( m_pLineC,   2, 1 );
   h->addWidget( button,    2, 2 );
   h->addWidget( button2,   2, 3 );

   m_pMerge = new QCheckBox( i18n("Merge"), this );
   h->addWidget( m_pMerge, 3, 0 );

   QHBoxLayout* hl = new QHBoxLayout();
   h->addLayout( hl, 3, 1 );
   hl->addStretch(2);
   button = new QPushButton(i18n("Swap/Copy Names ..."), this);
   //button->setToggleButton(false);
   hl->addWidget( button );

   QMenu* m = new QMenu(this);
   m->addAction( i18n("Swap %1<->%2", QString("A"),QString("B") ));
   m->addAction( i18n("Swap %1<->%2",QString("B"),QString("C") ));
   m->addAction( i18n("Swap %1<->%2",QString("C"),QString("A") ));
   m->addAction( i18n("Copy %1->Output",QString("A")  ));
   m->addAction( i18n("Copy %1->Output",QString("B")  ));
   m->addAction( i18n("Copy %1->Output",QString("C")  ));
   m->addAction( i18n("Swap %1<->Output",QString("A") ));
   m->addAction( i18n("Swap %1<->Output",QString("B") ));
   m->addAction( i18n("Swap %1<->Output",QString("C") ));
   connect( m, SIGNAL(triggered(QAction*)), this, SLOT(slotSwapCopyNames(QAction*)));
   button->setMenu(m);


   hl->addStretch(2);

   label  = new QLabel( i18n("Output (optional):"), this );
   m_pLineOut = new QComboBox();
   m_pLineOut->setEditable(true);
   m_pLineOut->insertItems( 0, m_pOptions->m_recentOutputFiles );
   m_pLineOut->setEditText( KUrl(outputName).prettyUrl() );
   m_pLineOut->setMinimumWidth( 200 );
   button = new QPushButton( i18n("File..."), this );
   connect( button, SIGNAL(clicked()), this, SLOT( selectOutputName() ) );
   button2   = new QPushButton( i18n("Dir..."), this );
   connect( button2, SIGNAL(clicked()), this, SLOT( selectOutputDir() ) );
   connect( m_pMerge, SIGNAL(stateChanged(int)), this, SLOT(internalSlot(int)) );
   connect( this, SIGNAL(internalSignal(bool)), m_pLineOut, SLOT(setEnabled(bool)) );
   connect( this, SIGNAL(internalSignal(bool)), button, SLOT(setEnabled(bool)) );
   connect( this, SIGNAL(internalSignal(bool)), button2, SLOT(setEnabled(bool)) );

   m_pMerge->setChecked( !bMerge );
   m_pMerge->setChecked( bMerge );
//   m_pLineOutput->setEnabled( bMerge );

//   button->setEnabled( bMerge );

   h->addWidget( label,          4, 0 );
   h->addWidget( m_pLineOut,      4, 1 );
   h->addWidget( button,         4, 2 );
   h->addWidget( button2,        4, 3 );

   h->addItem(new QSpacerItem(200, 0), 0, 1);

   QHBoxLayout* l = new QHBoxLayout();
   v->addLayout( l );
   l->setSpacing(5);

   button = new QPushButton( i18n("Configure..."), this );
   connect( button, SIGNAL(clicked()), pParent, slotConfigure );
   l->addWidget( button, 1 );

   l->addStretch(1);

   button = new QPushButton( i18n("&OK"), this );
   button->setDefault( true );
   connect( button, SIGNAL(clicked()), this, SLOT( accept() ) );
   l->addWidget( button, 1 );

   button = new QPushButton( i18n("&Cancel"), this );
   connect( button, SIGNAL(clicked()), this, SLOT( reject() ) );
   l->addWidget( button,1 );

   QSize sh = sizeHint();
   setFixedHeight( sh.height() );
   m_bInputFileNameChanged = false;

#ifdef KREPLACEMENTS_H
   m_pLineA->lineEdit()->installEventFilter( this );
   m_pLineB->lineEdit()->installEventFilter( this );
   m_pLineC->lineEdit()->installEventFilter( this );
   m_pLineOut->lineEdit()->installEventFilter( this );
#endif
}
コード例 #23
0
ファイル: ProjectToolBox.cpp プロジェクト: rouming/FermaNext
CreateTrussDialog::CreateTrussDialog ( TrussUnitWindowManager& mng,
                                       QWidget* parent /* = 0 */ ) :
    QDialog( parent ),
    wndMng( mng )
{
    QVBoxLayout* parenLayout = new QVBoxLayout( this );

    QVBoxLayout* nameLayout = new QVBoxLayout;
    QLabel* nameLabel = new QLabel( tr( "Enter truss name:" ) );
    nameEdit = new QLineEdit;
    connect( nameEdit, SIGNAL(textEdited(const QString&)),
                          SLOT(checkDialogState()) );
    
    nameLayout->addWidget( nameLabel );
    nameLayout->addWidget( nameEdit );

    QHBoxLayout* sizeLayout = new QHBoxLayout;
    QGroupBox* sizeGroupBox = new QGroupBox( tr( "Area size" ), this );
    QLabel* xSizeLabel = new QLabel( tr( "Size by X:" ), sizeGroupBox );
    QLabel* ySizeLabel = new QLabel( tr( "Size by Y:" ), sizeGroupBox );
    xSizeEdit = new QDoubleSpinBox;
    xSizeEdit->setMaximum( Global::areaMaxDimension );
    xSizeEdit->setValue( 300.0 );
    connect( xSizeEdit, SIGNAL(valueChanged(double)),
                          SLOT(checkDialogState()) );

    ySizeEdit = new QDoubleSpinBox;
    ySizeEdit->setMaximum( Global::areaMaxDimension );
    ySizeEdit->setValue( 300.0 );
    connect( ySizeEdit, SIGNAL(valueChanged(double)),
                          SLOT(checkDialogState()) );

    sizeLayout->addWidget( sizeGroupBox );

    QGridLayout *grid = new QGridLayout( sizeGroupBox );
    grid->addWidget( xSizeLabel, 0, 0 );
    grid->addWidget( ySizeLabel, 1, 0 );
    grid->addWidget( xSizeEdit, 0, 1 );
    grid->addWidget( ySizeEdit, 1, 1 );
    grid->setSpacing( 5 );
    grid->setMargin( 15 );

    QHBoxLayout* buttonLayout = new QHBoxLayout;
    okButton = new QPushButton( tr( "OK" ) );
    connect( okButton, SIGNAL(clicked()),
                          SLOT(onOk()) );
    okButton->setEnabled( false );
    
    QPushButton* cancelButton = new QPushButton( tr( "Cancel" ) );
    connect( cancelButton, SIGNAL(clicked()),
                             SLOT(onCancel()) );
    buttonLayout->addStretch( 1 );
    buttonLayout->addWidget( okButton );
    buttonLayout->addWidget( cancelButton );

    parenLayout->addLayout( nameLayout );
    parenLayout->addWidget( sizeGroupBox );
    parenLayout->addLayout( buttonLayout );
    parenLayout->addStretch( 1 );
    parenLayout->setMargin( 10 );

    setWindowTitle( tr( "Create truss unit" ) );
    nameEdit->setFocus( Qt::OtherFocusReason );
}
コード例 #24
0
void MonitorSettingDialog::init()
{
    setWindowFlags(windowFlags() | Qt::X11BypassWindowManagerHint);

    DThemeManager::instance()->setTheme(this, "light");

    m_fullIndication = std::unique_ptr<MonitorIndicator>(new MonitorIndicator(this));

    setBackgroundColor(QColor(Qt::white));
    setBorderColor(QColor(0, 0, 0, 0.2 * 255));

    m_resolutionsModel = new BasicListModel;

    BasicListView *resolutionView = new BasicListView;
    resolutionView->setModel(m_resolutionsModel);
    resolutionView->setItemDelegate(new BasicListDelegate);

    connect(resolutionView, &BasicListView::entered, m_resolutionsModel, &BasicListModel::setHoveredIndex);

    if (m_primary)
    {
        resolutionView->setAutoFitHeight(false);
        resolutionView->setFixedHeight(36 * 3);
    }

    resolutionView->setMinimumWidth(448);

    QLabel *resoLabel = new QLabel;
    resoLabel->setObjectName("Resolution");
    resoLabel->setText(tr("Resolution"));

    QHBoxLayout *hlayout = new QHBoxLayout;
    hlayout->setMargin(0);
    hlayout->setSpacing(0);
    hlayout->addSpacing(30);
    hlayout->addWidget(resoLabel);

    QVBoxLayout *resoLayout = new QVBoxLayout;
    resoLayout->addLayout(hlayout);
    resoLayout->addWidget(resolutionView);
    resoLayout->setSpacing(5);
    resoLayout->setContentsMargins(10, 0, 10, 0);

#ifndef DCC_DISABLE_ROTATE
    m_rotateBtn = new DImageButton;
    m_rotateBtn->setNormalPic(":/display/themes/dark/icons/rotate_normal.png");
    m_rotateBtn->setHoverPic(":/display/themes/dark/icons/rotate_hover.png");
    m_rotateBtn->setPressPic(":/display/themes/dark/icons/rotate_press.png");
#endif

    m_btnsLayout = new QHBoxLayout;
    m_btnsLayout->addSpacing(15);
#ifndef DCC_DISABLE_ROTATE
    m_btnsLayout->addWidget(m_rotateBtn);
#endif
    m_btnsLayout->addStretch();
    m_btnsLayout->setSpacing(10);
    m_btnsLayout->setContentsMargins(10, 0, 10, 0);

    m_mainLayout = new QVBoxLayout;
    m_mainLayout->setMargin(0);
    m_mainLayout->setSpacing(10);

    m_mainLayout->addSpacing(40);
    m_mainLayout->addLayout(resoLayout);
    m_mainLayout->addSpacing(10);
    m_mainLayout->addLayout(m_btnsLayout);
    m_mainLayout->addSpacing(10);

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

    setContentsMargins(0, 0, 0, 0);

    setLayout(m_mainLayout);

    m_positionWatcher->setSingleShot(false);
    m_positionWatcher->setInterval(1000);
    m_positionWatcher->start();

    connect(resolutionView, &BasicListView::clicked, [=](const QModelIndex &index) { onMonitorResolutionSelected(index.row()); });
#ifndef DCC_DISABLE_ROTATE
    connect(m_rotateBtn, &DImageButton::clicked, this, &MonitorSettingDialog::onRotateBtnClicked);
#endif
    connect(m_positionWatcher, &QTimer::timeout, this, &MonitorSettingDialog::onMonitorRectChanged);
}
コード例 #25
0
ファイル: dat_pnl.cpp プロジェクト: ClinicalGraphics/MathGL
//-----------------------------------------------------------------------------
void DatPanel::oper()
{
	QLineEdit *f1;
	QPushButton *b;
	QDialog *d = new QDialog(this);
	d->setWindowTitle(tr("UDAV - change data"));
	QVBoxLayout *v = new QVBoxLayout(d);
	QComboBox *c = new QComboBox(d);	v->addWidget(c);
	c->addItem(tr("Fill data by formula"));
	c->addItem(tr("Transpose data with new dimensions"));
	c->addItem(tr("Smooth data along direction(s)"));
	c->addItem(tr("Summarize data along direction(s)"));
	c->addItem(tr("Integrate data along direction(s)"));
	c->addItem(tr("Differentiate data along direction(s)"));
	c->addItem(tr("Laplace transform along direction(s)"));
	c->addItem(tr("Swap data along direction(s)"));
	c->addItem(tr("Mirror data along direction(s)"));
	c->addItem(tr("Sin-Fourier transform along direction(s)"));
	c->addItem(tr("Cos-Fourier transform along direction(s)"));
	c->addItem(tr("Hankel transform along direction(s)"));
	c->addItem(tr("Sew data along direction(s)"));
	c->addItem(tr("Find envelope along direction(s)"));
	c->setCurrentIndex(0);

	f1 = new QLineEdit("z",d);	v->addWidget(f1);
	QHBoxLayout *h = new QHBoxLayout();	v->addLayout(h);	h->addStretch(1);
	b = new QPushButton(tr("Cancel"), d);	h->addWidget(b);
	connect(b, SIGNAL(clicked()), d, SLOT(reject()));
	b = new QPushButton(tr("OK"), d);		h->addWidget(b);
	connect(b, SIGNAL(clicked()), d, SLOT(accept()));
	b->setDefault(true);
	// now execute dialog and get values
	bool res = d->exec();
	QString 	val = f1->text(), mgl;
	int k = c->currentIndex();
	QString self = QString::fromWCharArray(var->s.c_str());
	if(res)
	{
		if(k<0)
		{
			QMessageBox::warning(d, tr("UDAV - make new data"),
				tr("No action is selected. Do nothing."));
			return;
		}
		switch(k)
		{
		case 0:	mgl = "modify "+self+" '"+val+"'";	break;
		case 1:	mgl = "transpose "+self+" '"+val+"'";	break;
		case 2:	mgl = "smooth "+self+" '"+val+"'";	break;
		case 3:	mgl = "cumsum "+self+" '"+val+"'";	break;
		case 4:	mgl = "integrate "+self+" '"+val+"'";	break;
		case 5:	mgl = "diff "+self+" '"+val+"'";	break;
		case 6:	mgl = "diff2 "+self+" '"+val+"'";	break;
		case 7:	mgl = "swap "+self+" '"+val+"'";	break;
		case 8:	mgl = "mirror "+self+" '"+val+"'";	break;
		case 9:	mgl = "sinfft "+self+" '"+val+"'";	break;
		case 10:	mgl = "cosfft "+self+" '"+val+"'";	break;
		case 11:	mgl = "hankel "+self+" '"+val+"'";	break;
		case 12:	mgl = "sew "+self+" '"+val+"'";	break;
		case 13:	mgl = "envelop "+self+" '"+val+"'";	break;
		}
	}
	if(!mgl.isEmpty())
	{
		mglGraph gr;
		parser.Execute(&gr,mgl.toLocal8Bit().constData());
		opers += mgl+"\n";
		updateDataItems();
	}
}
コード例 #26
0
ファイル: mainwin.cpp プロジェクト: mjs513/orca-robotics
MainWindow::MainWindow( orcaprobe::IBrowser *browser,
                        orcaqcm::OcmModel        *model,
                        const std::vector<std::string> & supportedInterfaces,
                        QWidget *parent, Qt::WFlags flags)
    : QMainWindow(parent, flags),
      browser_(browser),
      model_(model),
      supportedInterfaces_(supportedInterfaces)
{
    assert(browser_ || "null pointer to browser");
    assert(model_ || "null pointer to model");

    setWindowTitle("Orca: Probe");
    setWindowIcon ( QPixmap(orcaqt::orca2_2x3_yellow_130_xpm) );
    QFont f;
    f.setPointSize( 7 );
    setFont( f );
    resize( qApp->desktop()->availableGeometry(0).width(), 400 );

    pathLabel_ = new QLabel;
    QLabel *movLabel = new QLabel;
    movie_ = new QMovie(this);
    movie_->setCacheMode(QMovie::CacheAll);
    movie_->setFileName("/opt/orca2/images/working.mng");
    movLabel->setMovie(movie_);
    
    QHBoxLayout *labelLayout = new QHBoxLayout;
    labelLayout->addWidget(pathLabel_, 0, Qt::AlignLeft );
    labelLayout->addWidget(movLabel, 0, Qt::AlignRight );

    QSplitter* split = new QSplitter();
    split->setOrientation(Qt::Horizontal);
    split->setMinimumWidth( 400 );

    ProbeView::config( browser_, pathLabel_, statusBar() );

    regView_    = new ProbeView( "Regisry", model_, split );
    platfView_  = new ProbeView( "Platform", model_, split );
    compView_   = new ProbeView( "Component", model_, split );
    ifaceView_  = new ProbeView( "Interface", model_, split );
    operView_   = new ProbeView( "Operation", model_, split );

    split->setStretchFactor( 0, 1 );
    split->setStretchFactor( 1, 1 );
    split->setStretchFactor( 2, 1 );
    split->setStretchFactor( 3, 1 );
    split->setStretchFactor( 4, 2 );

    regView_->setNeighbors( 0, platfView_ );
    platfView_->setNeighbors( regView_, compView_ );
    compView_->setNeighbors( platfView_, ifaceView_ );
    ifaceView_->setNeighbors( compView_, operView_ );
    operView_->setNeighbors( ifaceView_, 0 );

    QWidget *centralWidget = new QWidget;
    QVBoxLayout *layout = new QVBoxLayout;
    layout->addLayout( labelLayout, 0 );
    layout->addWidget( split, 1 );

    centralWidget->setLayout( layout );
    setCentralWidget( centralWidget );

    setupMenuBar();

    statusBar()->showMessage( "Initialized", 2000 );
}
コード例 #27
0
TransactionView::TransactionView(QWidget *parent) :
    QWidget(parent), model(0), transactionProxyModel(0),
    transactionView(0)
{
    // Build filter row
    setContentsMargins(0,0,0,0);

    QHBoxLayout *hlayout = new QHBoxLayout();
    hlayout->setContentsMargins(0,0,0,0);
#ifdef Q_OS_MAC
    hlayout->setSpacing(5);
    hlayout->addSpacing(26);
#else
    hlayout->setSpacing(0);
    hlayout->addSpacing(23);
#endif

    watchOnlyWidget = new QComboBox(this);
    watchOnlyWidget->setFixedWidth(24);
    watchOnlyWidget->addItem("", TransactionFilterProxy::WatchOnlyFilter_All);
    watchOnlyWidget->addItem(SingleColorIcon(":/icons/eye_plus"), "", TransactionFilterProxy::WatchOnlyFilter_Yes);
    watchOnlyWidget->addItem(SingleColorIcon(":/icons/eye_minus"), "", TransactionFilterProxy::WatchOnlyFilter_No);
    hlayout->addWidget(watchOnlyWidget);

    dateWidget = new QComboBox(this);
#ifdef Q_OS_MAC
    dateWidget->setFixedWidth(121);
#else
    dateWidget->setFixedWidth(120);
#endif
    dateWidget->addItem(tr("All"), All);
    dateWidget->addItem(tr("Today"), Today);
    dateWidget->addItem(tr("This week"), ThisWeek);
    dateWidget->addItem(tr("This month"), ThisMonth);
    dateWidget->addItem(tr("Last month"), LastMonth);
    dateWidget->addItem(tr("This year"), ThisYear);
    dateWidget->addItem(tr("Range..."), Range);
    hlayout->addWidget(dateWidget);

    typeWidget = new QComboBox(this);
#ifdef Q_OS_MAC
    typeWidget->setFixedWidth(121);
#else
    typeWidget->setFixedWidth(120);
#endif

    typeWidget->addItem(tr("All"), TransactionFilterProxy::ALL_TYPES);
    typeWidget->addItem(tr("Received with"), TransactionFilterProxy::TYPE(TransactionRecord::RecvWithAddress) |
                                        TransactionFilterProxy::TYPE(TransactionRecord::RecvFromOther));
    typeWidget->addItem(tr("Sent to"), TransactionFilterProxy::TYPE(TransactionRecord::SendToAddress) |
                                  TransactionFilterProxy::TYPE(TransactionRecord::SendToOther));
    typeWidget->addItem(tr("To yourself"), TransactionFilterProxy::TYPE(TransactionRecord::SendToSelf));
    typeWidget->addItem(tr("Mined"), TransactionFilterProxy::TYPE(TransactionRecord::Generated));
    typeWidget->addItem(tr("Other"), TransactionFilterProxy::TYPE(TransactionRecord::Other));

    hlayout->addWidget(typeWidget);

    addressWidget = new QLineEdit(this);
#if QT_VERSION >= 0x040700
    addressWidget->setPlaceholderText(tr("Enter address or label to search"));
#endif
    hlayout->addWidget(addressWidget);

    amountWidget = new QLineEdit(this);
#if QT_VERSION >= 0x040700
    amountWidget->setPlaceholderText(tr("Min amount"));
#endif
#ifdef Q_OS_MAC
    amountWidget->setFixedWidth(97);
#else
    amountWidget->setFixedWidth(100);
#endif
    amountWidget->setValidator(new QDoubleValidator(0, 1e20, 8, this));
    hlayout->addWidget(amountWidget);

    QVBoxLayout *vlayout = new QVBoxLayout(this);
    vlayout->setContentsMargins(0,0,0,0);
    vlayout->setSpacing(0);

    QTableView *view = new QTableView(this);
    vlayout->addLayout(hlayout);
    vlayout->addWidget(createDateRangeWidget());
    vlayout->addWidget(view);
    vlayout->setSpacing(0);
    int width = view->verticalScrollBar()->sizeHint().width();
    // Cover scroll bar width with spacing
#ifdef Q_OS_MAC
    hlayout->addSpacing(width+2);
#else
    hlayout->addSpacing(width);
#endif
    // Always show scroll bar
    view->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
    view->setTabKeyNavigation(false);
    view->setContextMenuPolicy(Qt::CustomContextMenu);

    view->installEventFilter(this);

    transactionView = view;

    // Actions
    QAction *copyAddressAction = new QAction(tr("Copy address"), this);
    QAction *copyLabelAction = new QAction(tr("Copy label"), this);
    QAction *copyAmountAction = new QAction(tr("Copy amount"), this);
    QAction *copyTxIDAction = new QAction(tr("Copy transaction ID"), this);
    QAction *editLabelAction = new QAction(tr("Edit label"), this);
    QAction *showDetailsAction = new QAction(tr("Show transaction details"), this);

    contextMenu = new QMenu();
    contextMenu->addAction(copyAddressAction);
    contextMenu->addAction(copyLabelAction);
    contextMenu->addAction(copyAmountAction);
    contextMenu->addAction(copyTxIDAction);
    contextMenu->addAction(editLabelAction);
    contextMenu->addAction(showDetailsAction);

    mapperThirdPartyTxUrls = new QSignalMapper(this);

    // Connect actions
    connect(mapperThirdPartyTxUrls, SIGNAL(mapped(QString)), this, SLOT(openThirdPartyTxUrl(QString)));

    connect(dateWidget, SIGNAL(activated(int)), this, SLOT(chooseDate(int)));
    connect(typeWidget, SIGNAL(activated(int)), this, SLOT(chooseType(int)));
    connect(watchOnlyWidget, SIGNAL(activated(int)), this, SLOT(chooseWatchonly(int)));
    connect(addressWidget, SIGNAL(textChanged(QString)), this, SLOT(changedPrefix(QString)));
    connect(amountWidget, SIGNAL(textChanged(QString)), this, SLOT(changedAmount(QString)));

    connect(view, SIGNAL(doubleClicked(QModelIndex)), this, SIGNAL(doubleClicked(QModelIndex)));
    connect(view, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextualMenu(QPoint)));

    connect(copyAddressAction, SIGNAL(triggered()), this, SLOT(copyAddress()));
    connect(copyLabelAction, SIGNAL(triggered()), this, SLOT(copyLabel()));
    connect(copyAmountAction, SIGNAL(triggered()), this, SLOT(copyAmount()));
    connect(copyTxIDAction, SIGNAL(triggered()), this, SLOT(copyTxID()));
    connect(editLabelAction, SIGNAL(triggered()), this, SLOT(editLabel()));
    connect(showDetailsAction, SIGNAL(triggered()), this, SLOT(showDetails()));
}
コード例 #28
0
DesktopQmakeRunConfigurationWidget::DesktopQmakeRunConfigurationWidget(DesktopQmakeRunConfiguration *qmakeRunConfiguration, QWidget *parent)
    : QWidget(parent),
    m_qmakeRunConfiguration(qmakeRunConfiguration),
    m_ignoreChange(false),
    m_usingDyldImageSuffix(0),
    m_isShown(false)
{
    QVBoxLayout *vboxTopLayout = new QVBoxLayout(this);
    vboxTopLayout->setMargin(0);

    QHBoxLayout *hl = new QHBoxLayout();
    hl->addStretch();
    m_disabledIcon = new QLabel(this);
    m_disabledIcon->setPixmap(QPixmap(QLatin1String(Core::Constants::ICON_WARNING)));
    hl->addWidget(m_disabledIcon);
    m_disabledReason = new QLabel(this);
    m_disabledReason->setVisible(false);
    hl->addWidget(m_disabledReason);
    hl->addStretch();
    vboxTopLayout->addLayout(hl);

    m_detailsContainer = new DetailsWidget(this);
    m_detailsContainer->setState(DetailsWidget::NoSummary);
    vboxTopLayout->addWidget(m_detailsContainer);
    QWidget *detailsWidget = new QWidget(m_detailsContainer);
    m_detailsContainer->setWidget(detailsWidget);
    QFormLayout *toplayout = new QFormLayout(detailsWidget);
    toplayout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
    toplayout->setMargin(0);

    m_executableLineEdit = new QLineEdit(m_qmakeRunConfiguration->executable(), this);
    m_executableLineEdit->setEnabled(false);
    toplayout->addRow(tr("Executable:"), m_executableLineEdit);

    QLabel *argumentsLabel = new QLabel(tr("Arguments:"), this);
    m_argumentsLineEdit = new QLineEdit(qmakeRunConfiguration->rawCommandLineArguments(), this);
    argumentsLabel->setBuddy(m_argumentsLineEdit);
    toplayout->addRow(argumentsLabel, m_argumentsLineEdit);

    m_workingDirectoryEdit = new PathChooser(this);
    m_workingDirectoryEdit->setExpectedKind(PathChooser::Directory);
    m_workingDirectoryEdit->setHistoryCompleter(QLatin1String("Qmake.WorkingDir.History"));
    m_workingDirectoryEdit->setPath(m_qmakeRunConfiguration->baseWorkingDirectory());
    m_workingDirectoryEdit->setBaseFileName(m_qmakeRunConfiguration->target()->project()->projectDirectory());
    EnvironmentAspect *aspect = qmakeRunConfiguration->extraAspect<EnvironmentAspect>();
    if (aspect) {
        connect(aspect, SIGNAL(environmentChanged()), this, SLOT(environmentWasChanged()));
        environmentWasChanged();
    }
    m_workingDirectoryEdit->setPromptDialogTitle(tr("Select Working Directory"));

    QToolButton *resetButton = new QToolButton(this);
    resetButton->setToolTip(tr("Reset to default"));
    resetButton->setIcon(QIcon(QLatin1String(Core::Constants::ICON_RESET)));

    QHBoxLayout *boxlayout = new QHBoxLayout();
    boxlayout->setMargin(0);
    boxlayout->addWidget(m_workingDirectoryEdit);
    boxlayout->addWidget(resetButton);
    toplayout->addRow(tr("Working directory:"), boxlayout);

    QHBoxLayout *innerBox = new QHBoxLayout();
    m_useTerminalCheck = new QCheckBox(tr("Run in terminal"), this);
    m_useTerminalCheck->setChecked(m_qmakeRunConfiguration->runMode() == ApplicationLauncher::Console);
    m_useTerminalCheck->setVisible(!m_qmakeRunConfiguration->forcedGuiMode());
    innerBox->addWidget(m_useTerminalCheck);

    m_useQvfbCheck = new QCheckBox(tr("Run on QVFb"), this);
    m_useQvfbCheck->setToolTip(tr("Check this option to run the application on a Qt Virtual Framebuffer."));
    m_useQvfbCheck->setChecked(m_qmakeRunConfiguration->runMode() == ApplicationLauncher::Console);
    m_useQvfbCheck->setVisible(false);
    innerBox->addWidget(m_useQvfbCheck);
    innerBox->addStretch();
    toplayout->addRow(QString(), innerBox);

    if (HostOsInfo::isMacHost()) {
        m_usingDyldImageSuffix = new QCheckBox(tr("Use debug version of frameworks (DYLD_IMAGE_SUFFIX=_debug)"), this);
        m_usingDyldImageSuffix->setChecked(m_qmakeRunConfiguration->isUsingDyldImageSuffix());
        toplayout->addRow(QString(), m_usingDyldImageSuffix);
        connect(m_usingDyldImageSuffix, SIGNAL(toggled(bool)),
                this, SLOT(usingDyldImageSuffixToggled(bool)));
    }

    runConfigurationEnabledChange();

    connect(m_workingDirectoryEdit, SIGNAL(changed(QString)),
            this, SLOT(workDirectoryEdited()));

    connect(resetButton, SIGNAL(clicked()),
            this, SLOT(workingDirectoryReseted()));

    connect(m_argumentsLineEdit, SIGNAL(textEdited(QString)),
            this, SLOT(argumentsEdited(QString)));
    connect(m_useTerminalCheck, SIGNAL(toggled(bool)),
            this, SLOT(termToggled(bool)));
    connect(m_useQvfbCheck, SIGNAL(toggled(bool)),
            this, SLOT(qvfbToggled(bool)));

    connect(qmakeRunConfiguration, SIGNAL(baseWorkingDirectoryChanged(QString)),
            this, SLOT(workingDirectoryChanged(QString)));

    connect(qmakeRunConfiguration, SIGNAL(commandLineArgumentsChanged(QString)),
            this, SLOT(commandLineArgumentsChanged(QString)));
    connect(qmakeRunConfiguration, SIGNAL(runModeChanged(ProjectExplorer::ApplicationLauncher::Mode)),
            this, SLOT(runModeChanged(ProjectExplorer::ApplicationLauncher::Mode)));
    connect(qmakeRunConfiguration, SIGNAL(usingDyldImageSuffixChanged(bool)),
            this, SLOT(usingDyldImageSuffixChanged(bool)));
    connect(qmakeRunConfiguration, SIGNAL(effectiveTargetInformationChanged()),
            this, SLOT(effectiveTargetInformationChanged()), Qt::QueuedConnection);

    connect(qmakeRunConfiguration, SIGNAL(enabledChanged()),
            this, SLOT(runConfigurationEnabledChange()));
}
コード例 #29
0
ファイル: SettingsPage.cpp プロジェクト: lazyrun/pokerbot
void SettingsPage::setupUi()
{
   QVBoxLayout * vb = new QVBoxLayout;
   QGridLayout * grid = new QGridLayout;

	QLabel * lblCaption = new QLabel(this);
	lblCaption->setMinimumHeight(30);
   lblCaption->setText("<h3><center>" + tr("Additional Settings") + "</center></h3>");
   lblCaption->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
   lblCaption->setStyleSheet("background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #d9ebfb, stop: 0.4 #a1d4fb,stop: 0.5 #a1d4fb, stop: 1.0 #d9ebfb); background-position: left top; border-style: solid; border-width: 1px; border-color: silver; border-radius: 3px; color: black;");

   btnTurn_  = new QToolButton(this);
   btnFold_  = new QToolButton(this);
   btnCheck_ = new QToolButton(this);

   btnTurn_->setIcon(QIcon(":/images/speaker.png"));
   btnFold_->setIcon(QIcon(":/images/speaker.png"));
   btnCheck_->setIcon(QIcon(":/images/speaker.png"));

   btnTurn_->setAutoRaise(true);
   btnFold_->setAutoRaise(true); 
   btnCheck_->setAutoRaise(true);
   
   btnTurn_->setToolTip(tr("Soundcheck"));
   btnFold_->setToolTip(tr("Soundcheck")); 
   btnCheck_->setToolTip(tr("Soundcheck"));
   
   btnTurn_->setEnabled(false);
   btnFold_->setEnabled(false); 
   btnCheck_->setEnabled(false);
   connect(btnTurn_, SIGNAL(clicked()), this, SLOT(testTurn()));
   connect(btnFold_, SIGNAL(clicked()), this, SLOT(testFold()));
   connect(btnCheck_, SIGNAL(clicked()), this, SLOT(testCheck()));

   chkTurn_ = new QCheckBox(tr("&Play a sound when you have a good hand"), this);
   chkFold_ = new QCheckBox(tr("Play a sound when the cards are &folded"), this);
   chkCheck_ = new QCheckBox(tr("Play a sound when Maverick &checks"), this);
   chkVisual_ = new QCheckBox(tr("&Highlight the table with a good hand"), this);
   chkShowFolded_ = new QCheckBox(tr("&Show folded hands"), this);
   chkAdvisor_ = new QCheckBox(tr("&Advisor mode (only tips, no actual actions)"),
      this);
   //chkKeep_ = new QCheckBox(tr("&Keep a log of the folder"), this);
   
   connect(chkTurn_, SIGNAL(toggled(bool)), this, SLOT(turnSwitch(bool)));
   connect(chkFold_, SIGNAL(toggled(bool)), this, SLOT(foldSwitch(bool)));
   connect(chkCheck_, SIGNAL(toggled(bool)), this, SLOT(checkSwitch(bool)));

   spnInterval_ = new QDoubleSpinBox(this);
   spnInterval_->setMinimum(0.1);
   spnInterval_->setMaximum(5);
   spnInterval_->setSingleStep(0.1);
   spnInterval_->setMinimumWidth(80);
   spnInterval_->setValue(1.00);
   spnInterval_->setDecimals(1);

   QLabel * lblInterval = new QLabel(tr("Process tables every (&sec.):"), this);
   lblInterval->setBuddy(spnInterval_);
   
   QLabel * lblRoom = new QLabel(tr("&Poker room:"), this);
   cmbRoom_ = new QComboBox(this);
   cmbRoom_->setEditable(false);
#ifndef DEMO_MODE
   cmbRoom_->addItem("Party Poker", "party");
   cmbRoom_->addItem("Titan Poker", "titan");
#endif
   cmbRoom_->addItem("Cake Poker", "cake");
   cmbRoom_->addItem("Red Star Poker", "rsp1");
   cmbRoom_->addItem("Poker Academy Pro", "acad");
   cmbRoom_->setMinimumWidth(120);
   lblRoom->setBuddy(cmbRoom_);

   QLabel * lblLang = new QLabel(tr("&Interface language:"), this);
   cmbLang_ = new QComboBox(this);
   cmbLang_->setEditable(false);
   cmbLang_->addItem("English", "en");
   cmbLang_->setMinimumWidth(120);
   lblLang->setBuddy(cmbLang_);
   
   QString appExe = qApp->applicationDirPath();
   QDir dir(":/translations");
   QStringList files = dir.entryList(QDir::Files);
   foreach (QString file, files)
   {
      if (file.right(2) == "qm" && file.contains("HoldemFolder_"))
      {
         int idx = file.indexOf("_");
         QString loc = file.mid(idx + 1, 2);
         QLocale locale(loc);
         cmbLang_->addItem(QLocale::languageToString(locale.language()), loc);
      }
   }

   vb->addWidget(lblCaption);
   vb->addSpacerItem(new QSpacerItem(1, 12));
   vb->addLayout(grid);
   grid->setContentsMargins(6, 6, 6, 6);
   int row = 0;
   grid->addWidget(chkTurn_, row, 0, Qt::AlignLeft);
   grid->addWidget(btnTurn_, row++, 1, Qt::AlignLeft);
   
   grid->addWidget(chkFold_, row, 0, Qt::AlignLeft);
   grid->addWidget(btnFold_, row++, 1, Qt::AlignLeft);

   grid->addWidget(chkCheck_, row, 0, Qt::AlignLeft);
   grid->addWidget(btnCheck_, row++, 1, Qt::AlignLeft);
   
   grid->addWidget(chkVisual_, row++, 0, 1, 2, Qt::AlignLeft);
   grid->addWidget(chkShowFolded_, row++, 0, 1, 2, Qt::AlignLeft);
   grid->addWidget(chkAdvisor_, row++, 0, 1, 2, Qt::AlignLeft);
   
   QGridLayout * grid1 = new QGridLayout;
   grid1->setMargin(0);
   grid1->addWidget(lblInterval,    0, 0, Qt::AlignLeft);
   grid1->addWidget(spnInterval_,   0, 1, Qt::AlignLeft);
   grid->addLayout(grid1, row++, 0);

   QGridLayout * grid2 = new QGridLayout;
   grid2->setMargin(0);
   grid2->addWidget(lblRoom,        0, 0, Qt::AlignLeft);
   grid2->addWidget(cmbRoom_,       0, 1, Qt::AlignLeft);
   //grid->addLayout(grid2, row++, 0);

   //QGridLayout * grid3 = new QGridLayout;
   //grid3->setMargin(0);
   grid2->addWidget(lblLang,        1, 0, Qt::AlignLeft);
   grid2->addWidget(cmbLang_,       1, 1, Qt::AlignLeft);
   grid->addLayout(grid2, row++, 0);

   
   grid->setColumnStretch(1, 1);
   //grid->addWidget(chkKeep_, row++, 0, 1, 2);

   vb->addStretch(1);
   setLayout(vb);

   //audioOutput_ = new Phonon::AudioOutput(this);
   //mediaObject_ = new Phonon::MediaObject(this);
   //Phonon::createPath(mediaObject_, audioOutput_);

}
コード例 #30
0
CLSSIS3820ScalerControlsView::CLSSIS3820ScalerControlsView(CLSSIS3820Scaler *scaler, QWidget *parent) :
	QWidget(parent)
{
	// Initialize member variables.

	scaler_ = 0;

	// Create UI elements.

	modeChoice_ = new QComboBox;
	modeChoice_->addItems(QStringList() << "Single Shot" << "Continuous");
	modeChoice_->setCurrentIndex(0);

	startButton_ = new QPushButton(QIcon(":/22x22/media-playback-start.png"), "Start");
	startButton_->setMaximumHeight(25);

	stopButton_ = new QPushButton(QIcon(":/22x22/media-playback-stop.png"), "Stop");
	stopButton_->setMaximumHeight(25);

	status_ = new QLabel;
	status_->setPixmap(QIcon(":/32x32/greenLEDOff.png").pixmap(25));

	time_ = new QSpinBox;
	time_->setRange(0, 1000000);
	time_->setValue(1000);
	time_->setSuffix(" ms");
	time_->setFixedWidth(100);
	time_->setAlignment(Qt::AlignCenter);

	scansPerBuffer_ = new QSpinBox;
	scansPerBuffer_->setRange(0, 10000);
	scansPerBuffer_->setValue(1);
	scansPerBuffer_->setFixedWidth(100);
	scansPerBuffer_->setAlignment(Qt::AlignCenter);

	totalScans_ = new QSpinBox;
	totalScans_->setRange(0, 10000);
	totalScans_->setValue(1);
	totalScans_->setFixedWidth(100);
	totalScans_->setAlignment(Qt::AlignCenter);

	// Create and set layouts.

	QHBoxLayout *startAndStopButtons = new QHBoxLayout;
	startAndStopButtons->addWidget(startButton_);
	startAndStopButtons->addWidget(stopButton_);

	QVBoxLayout *statusAndModeLayout = new QVBoxLayout;
	statusAndModeLayout->addWidget(status_, 0, Qt::AlignCenter);
	statusAndModeLayout->addLayout(startAndStopButtons);
	statusAndModeLayout->addWidget(modeChoice_, 0, Qt::AlignCenter);

	QHBoxLayout *timeLayout = new QHBoxLayout;
	timeLayout->addWidget(new QLabel("Dwell Time:"), 0, Qt::AlignRight);
	timeLayout->addWidget(time_);

	QHBoxLayout *scansPerBufferLayout = new QHBoxLayout;
	scansPerBufferLayout->addWidget(new QLabel("Scans per Buffer:"), 0, Qt::AlignRight);
	scansPerBufferLayout->addWidget(scansPerBuffer_);

	QHBoxLayout *totalScansLayout = new QHBoxLayout;
	totalScansLayout->addWidget(new QLabel("Total Scans"), 0, Qt::AlignRight);
	totalScansLayout->addWidget(totalScans_);

	QVBoxLayout *spinBoxLayout = new QVBoxLayout;
	spinBoxLayout->addLayout(timeLayout);
	spinBoxLayout->addLayout(scansPerBufferLayout);
	spinBoxLayout->addLayout(totalScansLayout);

	QHBoxLayout *layout = new QHBoxLayout;
	layout->addLayout(statusAndModeLayout);
	layout->addLayout(spinBoxLayout);

	setLayout(layout);

	// Make connections.

	connect(startButton_, SIGNAL(clicked()), this, SLOT(startScanning()));
	connect(stopButton_, SIGNAL(clicked()), this, SLOT(stopScanning()));
	connect(modeChoice_, SIGNAL(currentIndexChanged(int)), this, SLOT(setContinuous()));
	connect(time_, SIGNAL(editingFinished()), this, SLOT(setDwellTime()));
	connect(scansPerBuffer_, SIGNAL(editingFinished()), this, SLOT(setScansPerBuffer()));
	connect(totalScans_, SIGNAL(editingFinished()), this, SLOT(setTotalScans()));

	// Current settings.

	setScaler(scaler);
}