示例#1
0
PageTimers::PageTimers (QWidget *parent)
    : Background (parent), edit_mode (false)
{
    QGridLayout *layout = new QGridLayout (this);
    layout->setMargin (0);
    layout->setSpacing (0);

    {
	digital_timer = new DigitalTimer (this);
	connect (digital_timer, SIGNAL (enterEditModeRequested ()), this, SLOT (enterEditModeDigitalTimerPressed ()));
	connect (digital_timer, SIGNAL (leaveEditModeRequested ()), this, SLOT (leaveEditMode ()));
	layout->addWidget (digital_timer, 1, 1);
    }

    {
	analog_timer = new AnalogTimer (this);
	connect (analog_timer, SIGNAL (clearAlarms ()), this, SLOT (clearCurrentAlarms ()));
	connect (analog_timer, SIGNAL (enterEditModeRequested ()), this, SLOT (enterEditModeAnalogTimerPressed ()));
	connect (analog_timer, SIGNAL (leaveEditModeRequested ()), this, SLOT (leaveEditMode ()));
	connect (analog_timer, SIGNAL (pressed ()), this, SIGNAL (analogTimerPressed ()));
	connect (analog_timer, SIGNAL (released ()), this, SIGNAL (analogTimerReleased ()));
	connect (analog_timer, SIGNAL (slide ()), this, SIGNAL (analogTimerSlide ()));
	connect (analog_timer, SIGNAL (zeroTimeReached ()), this, SIGNAL (zeroTimeReached ()));
	layout->addWidget (analog_timer, 2, 1);
    }

    layout->setColumnStretch (0, 15);
    layout->setColumnStretch (1, 50);
    layout->setColumnStretch (2, 15);

    layout->setRowStretch (0, 2);
    layout->setRowStretch (1, 40);
    layout->setRowStretch (2, 40);
    layout->setRowStretch (3, 10);
    layout->setRowStretch (4, 2);
    
#if 0 // Link with Reference
    {
	QHBoxLayout *hlayout = new QHBoxLayout ();
	hlayout->addStretch (1);
	QPushButton *add_timer_button = new QPushButton ("Add timer", this);
	connect (add_timer_button, SIGNAL (clicked ()), this, SIGNAL (switchToPageDishSelect ()));
	hlayout->addWidget (add_timer_button);
	hlayout->addStretch (1);
	layout->addLayout (hlayout);
	add_timer_button->hide ();
    }
#endif
    
    connect (this, SIGNAL (pressed ()), this, SLOT (leaveEditMode ()));

    updateContent ();

    update_timer.setInterval (100);
    update_timer.setSingleShot (false);
    update_timer.start ();

    leave_edit_mode_timer.setSingleShot (false);
    connect (&leave_edit_mode_timer, SIGNAL (timeout ()), this, SLOT (leaveEditMode ()));

    connect (analog_timer, SIGNAL (lmb_pressed ()), &leave_edit_mode_timer, SLOT (stop ()));
    connect (digital_timer, SIGNAL (lmb_pressed ()), &leave_edit_mode_timer, SLOT (stop ()));
    connect (analog_timer, SIGNAL (userIsAlive ()), this, SLOT (restartTirednessTimer ()));
    connect (digital_timer, SIGNAL (userIsAlive ()), this, SLOT (restartTirednessTimer ()));
    connect (analog_timer, SIGNAL (lmb_released ()), this, SLOT (startTirednessTimer ()));
    connect (digital_timer, SIGNAL (lmb_released ()), this, SLOT (startTirednessTimer ()));
}
示例#2
0
CollapsibleEffect::CollapsibleEffect(const QDomElement &effect, const QDomElement &original_effect, const ItemInfo &info, EffectMetaInfo *metaInfo, bool canMoveUp, bool lastEffect, QWidget * parent) :
    AbstractCollapsibleWidget(parent),
    m_paramWidget(NULL),
    m_effect(effect),
    m_itemInfo(info),
    m_original_effect(original_effect),
    m_isMovable(true),
    m_animation(NULL),
    m_regionEffect(false)
{
    if (m_effect.attribute(QStringLiteral("tag")) == QLatin1String("region")) {
        m_regionEffect = true;
        decoframe->setObjectName(QStringLiteral("decoframegroup"));
    }
    filterWheelEvent = true;
    m_info.fromString(effect.attribute(QStringLiteral("kdenlive_info")));
    //setFont(QFontDatabase::systemFont(QFontDatabase::SmallestReadableFont));
    buttonUp->setIcon(KoIconUtils::themedIcon(QStringLiteral("kdenlive-up")));
    QSize iconSize = buttonUp->iconSize();
    buttonUp->setMaximumSize(iconSize);
    buttonDown->setMaximumSize(iconSize);
    menuButton->setMaximumSize(iconSize);
    enabledButton->setMaximumSize(iconSize);
    buttonDel->setMaximumSize(iconSize);
    buttonUp->setToolTip(i18n("Move effect up"));
    buttonDown->setIcon(KoIconUtils::themedIcon(QStringLiteral("kdenlive-down")));
    buttonDown->setToolTip(i18n("Move effect down"));
    buttonDel->setIcon(KoIconUtils::themedIcon(QStringLiteral("kdenlive-deleffect")));
    buttonDel->setToolTip(i18n("Delete effect"));
    buttonUp->setEnabled(canMoveUp);
    buttonDown->setEnabled(!lastEffect);

    if (m_effect.attribute(QStringLiteral("id")) == QLatin1String("speed")) {
        // Speed effect is a "pseudo" effect, cannot be moved
        buttonUp->setVisible(false);
        buttonDown->setVisible(false);
        m_isMovable = false;
        setAcceptDrops(false);
    } else {
        setAcceptDrops(true);
    }

    /*buttonReset->setIcon(KoIconUtils::themedIcon("view-refresh"));
    buttonReset->setToolTip(i18n("Reset effect"));*/
    //checkAll->setToolTip(i18n("Enable/Disable all effects"));
    //buttonShowComments->setIcon(KoIconUtils::themedIcon("help-about"));
    //buttonShowComments->setToolTip(i18n("Show additional information for the parameters"));
    m_menu = new QMenu(this);
    m_menu->addAction(KoIconUtils::themedIcon(QStringLiteral("view-refresh")), i18n("Reset Effect"), this, SLOT(slotResetEffect()));
    m_menu->addAction(KoIconUtils::themedIcon(QStringLiteral("document-save")), i18n("Save Effect"), this, SLOT(slotSaveEffect()));

    QHBoxLayout *l = static_cast <QHBoxLayout *>(frame->layout());
    m_colorIcon = new QLabel(this);
    l->insertWidget(0, m_colorIcon);
    m_colorIcon->setMinimumSize(iconSize);
    title = new QLabel(this);
    l->insertWidget(2, title);

    m_enabledButton = new KDualAction(i18n("Disable Effect"), i18n("Enable Effect"), this);
    m_enabledButton->setActiveIcon(KoIconUtils::themedIcon(QStringLiteral("hint")));
    m_enabledButton->setInactiveIcon(KoIconUtils::themedIcon(QStringLiteral("visibility")));
    enabledButton->setDefaultAction(m_enabledButton);

    m_groupAction = new QAction(KoIconUtils::themedIcon(QStringLiteral("folder-new")), i18n("Create Group"), this);
    connect(m_groupAction, SIGNAL(triggered(bool)), this, SLOT(slotCreateGroup()));

    QDomElement namenode = m_effect.firstChildElement(QStringLiteral("name"));
    if (namenode.isNull()) {
        // Warning, broken effect?
        //qDebug()<<"// Could not create effect";
        return;
    }
    QString effectname = i18n(namenode.text().toUtf8().data());
    if (m_regionEffect) effectname.append(':' + QUrl(EffectsList::parameter(m_effect, QStringLiteral("resource"))).fileName());

    // Create color thumb
    QPixmap pix(iconSize);
    QColor col(m_effect.attribute(QStringLiteral("effectcolor")));
    QFont ft = font();
    ft.setBold(true);
    bool isAudio = m_effect.attribute(QStringLiteral("type")) == QLatin1String("audio");
    if (isAudio) {
        pix.fill(Qt::transparent);
    }
    else {
        pix.fill(col);
    }
    QPainter p(&pix);
    if (isAudio) {
        p.setPen(Qt::NoPen);
        p.setBrush(col);
        p.drawEllipse(pix.rect());
        p.setPen(QPen());
    }
    p.setFont(ft);
    p.drawText(pix.rect(), Qt::AlignCenter, effectname.at(0));
    p.end();
    m_iconPix = pix;
    m_colorIcon->setPixmap(pix);
    title->setText(effectname);

    if (!m_regionEffect) {
        if (m_info.groupIndex == -1) m_menu->addAction(m_groupAction);
        m_menu->addAction(KoIconUtils::themedIcon(QStringLiteral("folder-new")), i18n("Create Region"), this, SLOT(slotCreateRegion()));
    }
    setupWidget(info, metaInfo);
    menuButton->setIcon(KoIconUtils::themedIcon(QStringLiteral("kdenlive-menu")));
    menuButton->setMenu(m_menu);

    if (m_effect.attribute(QStringLiteral("disable")) == QLatin1String("1")) {
        title->setEnabled(false);
        m_enabledButton->setActive(true);
    }
    else {
        m_enabledButton->setActive(false);
    }

    connect(collapseButton, SIGNAL(clicked()), this, SLOT(slotSwitch()));
    connect(m_enabledButton, SIGNAL(activeChangedByUser(bool)), this, SLOT(slotDisable(bool)));
    connect(buttonUp, SIGNAL(clicked()), this, SLOT(slotEffectUp()));
    connect(buttonDown, SIGNAL(clicked()), this, SLOT(slotEffectDown()));
    connect(buttonDel, SIGNAL(clicked()), this, SLOT(slotDeleteEffect()));

    Q_FOREACH( QSpinBox * sp, findChildren<QSpinBox*>() ) {
        sp->installEventFilter( this );
        sp->setFocusPolicy( Qt::StrongFocus );
    }
示例#3
0
void addTab(std::string tabName, ImageStorage* imgstore, Ui::MainWindow *ui)
{
	/*ui->processBtn->setEnabled(true);
	ui->previousBtn->setEnabled(true);*/

	QWidget *tab = new QWidget();
	QString qname = QString::fromStdString(tabName);
	tab->setObjectName(qname);
	QHBoxLayout *horizontalLayout = new QHBoxLayout(tab);
	horizontalLayout->setSpacing(6);
	horizontalLayout->setContentsMargins(11, 11, 11, 11);
	horizontalLayout->setObjectName(QStringLiteral("horizontalLayout"));
	QScrollArea * scrollArea = new QScrollArea(tab);
	scrollArea->setObjectName(QStringLiteral("scrollArea"));
	scrollArea->setWidgetResizable(true);
	QWidget * scrollAreaWidgetContents = new QWidget();
	scrollAreaWidgetContents->setObjectName(QStringLiteral("scrollAreaWidgetContents"));
	scrollAreaWidgetContents->setGeometry(QRect(0, 0, 492, 447));
	QHBoxLayout* horizontalLayout_13 = new QHBoxLayout(scrollAreaWidgetContents);
	horizontalLayout->setSpacing(6);
	horizontalLayout_13->setContentsMargins(11, 11, 11, 11);
	horizontalLayout_13->setObjectName(QStringLiteral("horizontalLayout_13"));
	QLabel* label = new QLabel(scrollAreaWidgetContents);
	std::string stmp = tabName;
	stmp.append("_label");
	QString qname2 = QString::fromStdString(stmp);
	label->setObjectName(qname2);
	QSizePolicy sizePolicy2(QSizePolicy::Expanding, QSizePolicy::Expanding);
	sizePolicy2.setHorizontalStretch(0);
	sizePolicy2.setVerticalStretch(0);
	sizePolicy2.setHeightForWidth(label->sizePolicy().hasHeightForWidth());
	label->setSizePolicy(sizePolicy2);

	horizontalLayout_13->addWidget(label);
	scrollArea->setWidget(scrollAreaWidgetContents);
	horizontalLayout->addWidget(scrollArea);
	ui->imageTab->addTab(tab, QString());

	std::string tmp1 = tabName.c_str();
	const char* tmp2 = tmp1.c_str();
	ui->imageTab->setTabText(ui->imageTab->indexOf(tab), QApplication::translate("MainWindow", tmp2, 0));
	ui->imageTab->setCurrentIndex(ui->imageTab->indexOf(tab));


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

	//---------------------
	//display image

	cv::Mat image = std::get<1>(imgstore->getCurrent()->second);  
	QImage img;  
	if(image.channels() == 3)    // RGB image  
	{  
		//cvtColor(image, image, CV_BGR2RGB);  
		img = QImage((const uchar*)(image.data),  //(const unsigned char*)  
			image.cols, image.rows,  
			image.cols*image.channels(),
			QImage::Format_RGB888);  
	}else                     // gray image  
	{  
		img = QImage((const uchar*)(image.data),  
			image.cols, image.rows,  
			image.cols*image.channels(),
			QImage::Format_Indexed8);  
	}  

	if (!img.isNull())
	{
		label->setPixmap(QPixmap::fromImage(img));  
		label->resize(label->pixmap()->size());  
		label->setAlignment(Qt::AlignCenter);
		label->show();
	}
	else
	{
		ASSERT(0);
	}
	  

	//---------------------
}
REIXSSampleMoveActionEditor::REIXSSampleMoveActionEditor(REIXSSampleMoveActionInfo *info, QWidget *parent) : QFrame(parent) {

	info_ = info;

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

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

	QHBoxLayout* hl = new QHBoxLayout();

	sample_ = new QComboBox();

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

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

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

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

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


	setLayout(hl);

	// Initialize GUI:

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

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

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

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

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

	// connect editing finished for all spin boxes...
	connect(x_, SIGNAL(editingFinished()), this, SLOT(onSpinBoxEditingFinished()));
	connect(y_, SIGNAL(editingFinished()), this, SLOT(onSpinBoxEditingFinished()));
	connect(z_, SIGNAL(editingFinished()), this, SLOT(onSpinBoxEditingFinished()));
	connect(theta_, SIGNAL(editingFinished()), this, SLOT(onSpinBoxEditingFinished()));
}
示例#5
0
PropertiesDialog::PropertiesDialog(QWidget *parent, Okular::Document *doc)
    : KPageDialog( parent ), m_document( doc ), m_fontPage( 0 ),
      m_fontModel( 0 ), m_fontInfo( 0 ), m_fontProgressBar( 0 ),
      m_fontScanStarted( false )
{
    setFaceType( Tabbed );
    setCaption( i18n( "Unknown File" ) );
    setButtons( Ok );

    // PROPERTIES
    QFrame *page = new QFrame();
    KPageWidgetItem *item = addPage( page, i18n( "&Properties" ) );
    item->setIcon( KIcon( "document-properties" ) );

    // get document info
    const Okular::DocumentInfo info = doc->documentInfo();
    QFormLayout *layout = new QFormLayout( page );

    // mime name based on mimetype id
    QString mimeName = info.get( Okular::DocumentInfo::MimeType ).section( '/', -1 ).toUpper();
    setCaption( i18n( "%1 Properties", mimeName ) );

    int valMaxWidth = 100;

    /* obtains the properties list, conveniently ordered */
    QStringList orderedProperties;
    orderedProperties << Okular::DocumentInfo::getKeyString( Okular::DocumentInfo::FilePath )
                      << Okular::DocumentInfo::getKeyString( Okular::DocumentInfo::PagesSize )
                      << Okular::DocumentInfo::getKeyString( Okular::DocumentInfo::DocumentSize );
    for (Okular::DocumentInfo::Key ks = Okular::DocumentInfo::Title;
                                   ks <= Okular::DocumentInfo::Keywords;
                                   ks = Okular::DocumentInfo::Key( ks+1 ) )
    {
        orderedProperties << Okular::DocumentInfo::getKeyString( ks );
    }
    foreach( const QString &ks, info.keys()) {
        if ( !orderedProperties.contains( ks ) ) {
            orderedProperties << ks;
        }
    }

    for ( QStringList::Iterator it = orderedProperties.begin();
                                it != orderedProperties.end();
                                ++it )
    {
        const QString key = *it;
        const QString titleString = info.getKeyTitle( key );
        const QString valueString = info.get( key );
        if ( titleString.isNull() || valueString.isNull() )
            continue;

        // create labels and layout them
        QWidget *value = NULL;
        if ( key == Okular::DocumentInfo::getKeyString( Okular::DocumentInfo::MimeType ) ) {
            /// for mime type fields, show icon as well
            value = new QWidget( page );
            /// place icon left of mime type's name
            QHBoxLayout *hboxLayout = new QHBoxLayout( value );
            hboxLayout->setMargin( 0 );
            /// retrieve icon and place it in a QLabel
            KMimeType::Ptr mimeType = KMimeType::mimeType( valueString );
            KSqueezedTextLabel *squeezed;
            if (!mimeType.isNull()) {
                /// retrieve icon and place it in a QLabel
                QLabel *pixmapLabel = new QLabel( value );
                hboxLayout->addWidget( pixmapLabel, 0 );
                pixmapLabel->setPixmap( KIconLoader::global()->loadMimeTypeIcon( mimeType->iconName(), KIconLoader::Small ) );
                /// mime type's name and label
                squeezed = new KSqueezedTextLabel( i18nc( "mimetype information, example: \"PDF Document (application/pdf)\"", "%1 (%2)", mimeType->comment(), valueString ), value );
            } else {
                /// only mime type name
                squeezed = new KSqueezedTextLabel( valueString, value );
            }
            squeezed->setTextInteractionFlags( Qt::TextSelectableByMouse );
            hboxLayout->addWidget( squeezed, 1 );
        } else {
            /// default for any other document information
            KSqueezedTextLabel *label = new KSqueezedTextLabel( valueString, page );
            label->setTextInteractionFlags( Qt::TextSelectableByMouse );
            value = label;
        }
        layout->addRow( new QLabel( i18n( "%1:", titleString ) ), value);

        // refine maximum width of 'value' labels
        valMaxWidth = qMax( valMaxWidth, fontMetrics().width( valueString ) );
    }

    // FONTS
    QVBoxLayout *page2Layout = 0;
    if ( doc->canProvideFontInformation() ) {
        // create fonts tab and layout it
        QFrame *page2 = new QFrame();
        m_fontPage = addPage(page2, i18n("&Fonts"));
        m_fontPage->setIcon( KIcon( "preferences-desktop-font" ) );
        page2Layout = new QVBoxLayout(page2);
        page2Layout->setMargin(marginHint());
        page2Layout->setSpacing(spacingHint());
        // add a tree view
        QTreeView *view = new QTreeView(page2);
        view->setContextMenuPolicy(Qt::CustomContextMenu);
        connect(view, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(showFontsMenu(QPoint)));
        page2Layout->addWidget(view);
        view->setRootIsDecorated(false);
        view->setAlternatingRowColors(true);
        view->setSortingEnabled( true );
        // creating a proxy model so we can sort the data
        QSortFilterProxyModel *proxymodel = new QSortFilterProxyModel(view);
        proxymodel->setDynamicSortFilter( true );
        proxymodel->setSortCaseSensitivity( Qt::CaseInsensitive );
        m_fontModel = new FontsListModel(view);
        proxymodel->setSourceModel(m_fontModel);
        view->setModel(proxymodel);
        view->sortByColumn( 0, Qt::AscendingOrder );
        m_fontInfo = new QLabel( this );
        page2Layout->addWidget( m_fontInfo );
        m_fontInfo->setText( i18n( "Reading font information..." ) );
        m_fontInfo->hide();
        m_fontProgressBar = new QProgressBar( this );
        page2Layout->addWidget( m_fontProgressBar );
        m_fontProgressBar->setRange( 0, 100 );
        m_fontProgressBar->setValue( 0 );
        m_fontProgressBar->hide();
    }

    // current width: left columnt + right column + dialog borders
    int width = layout->minimumSize().width() + valMaxWidth + 2 * marginHint() + spacingHint() + 30;
    if ( page2Layout )
        width = qMax( width, page2Layout->sizeHint().width() + marginHint() + spacingHint() + 31 );
    // stay inside the 2/3 of the screen width
    QRect screenContainer = KGlobalSettings::desktopGeometry( this );
    width = qMin( width, 2*screenContainer.width()/3 );
    resize(width, 1);

    connect( pageWidget(), SIGNAL(currentPageChanged(KPageWidgetItem*,KPageWidgetItem*)),
             this, SLOT(pageChanged(KPageWidgetItem*,KPageWidgetItem*)) );
}
示例#6
0
Downloader::Downloader(QWidget *parent, std::vector<QUrl>* _urls,
		std::vector<QString>* _savePaths, bool _silent) :
	QDialog(parent) {

	DEBUG("");

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

	this->setFont(THE_REPO->fontVariableWidthSmall);

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

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

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

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

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

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

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

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

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

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

	if (silent) {
		this->downloadFiles();
		/*
		 * TODO:
		 * indagare cosa succede se silent == FALSE
		 * eventualmente aggiungere un else
		 *
		 * * * * * * * * * * * * * * * * * * * * */
	}
}
Nuclear::Nuclear(QWidget *parent)
    : QWidget(parent)
{
    //инициализация слоев всего виджета (не изменять)
    this->setLayout(new QVBoxLayout);
    this->layout()->setAlignment(Qt::AlignTop | Qt::AlignLeft);
    this->setMinimumWidth(800);
	this->setMinimumHeight(480);

    QHBoxLayout* other = new QHBoxLayout;
    edit_box1 = new QLabel();
    QPalette pl;
    pl.setColor(QPalette::Text,Qt::red);
    edit_box1->setPalette(pl);
    this->layout()->addWidget(edit_box1);

    QFont font;
//    font.setBold(true);
    font.setPointSize(12);
    //инициализация слоя для виджетов ввода данных (не изменять)
    QVBoxLayout* input_layout = new QVBoxLayout;
    input_layout->setAlignment(Qt::AlignTop | Qt::AlignHCenter);
    //инициализация слоя для виджетов вывода данных (не изменять)
    QVBoxLayout* output_layout = new QVBoxLayout;
    output_layout->setAlignment(Qt::AlignTop | Qt::AlignHCenter);

    //выбор тестов

    QPushButton* calculate_btn = new QPushButton("Calculate", this);
    calculate_btn->setFixedSize(150,80);
	calculate_btn->setFont(font);
	connect(calculate_btn, SIGNAL(clicked()), this, SLOT(Calculate()));
    other->addWidget(calculate_btn);

    list1 = new QListWidget;
    list1->addItem("1");
    list1->addItem("2");
    list1->addItem("3");

    list1->setMaximumHeight(30);
    QObject::connect(list1, &QListWidget::clicked,
                     this, &Nuclear::OpenTest);
    QObject::connect(list1, &QListWidget::activated,
                     this, &Nuclear::OpenTest);


    this->layout()->addWidget(list1);


	//layout для table
	QVBoxLayout* table1_layout = new QVBoxLayout;
	table1_layout->setAlignment(Qt::AlignHCenter | Qt::AlignTop);
	QLabel* table1_name_label = new QLabel("Table example", this); //название таблицы
    table1_name_label->setAlignment(Qt::AlignHCenter);
    table1_name_label->setVisible(false);
    table1 = new QTableWidget(this);
//    table1->setMinimumSize(700,560);
//    table1_layout->addWidget(table1_name_label);
//    table1_layout->addWidget(table1);
    other->addWidget(table1_name_label);
    other->addWidget(table1);


	table1->setRowCount(22);//кол-во строк
    table1->setColumnCount(7);//кол-во столбцов
	//задание название строкам (аналогично стобцам)
	QStringList lst;
	lst << "Node" <<
		   "Chance of branch" <<
		   "Cost of branch" <<
           "EIN" <<
           "Params" <<
           "Death" <<
           "Action";
	table1->setHorizontalHeaderLabels(lst);
	lst.clear();
    table1->setVerticalHeaderLabels(lst);
	table1->setItem(0,0, new QTableWidgetItem("1"));
	table1->setItem(2,0, new QTableWidgetItem("2"));
	table1->setItem(4,0, new QTableWidgetItem("3"));
	table1->setItem(9,0, new QTableWidgetItem("4"));
	table1->setItem(15,0, new QTableWidgetItem("5"));
	table1->setItem(21,0, new QTableWidgetItem("6"));

    //заполенения output layout
    QLabel* output_label = new QLabel("Output", this);
    output_label->setFont(font);
    output_label->setFixedHeight(30);
    output_label->setAlignment(Qt::AlignHCenter);
    output_layout->addWidget(output_label);
    output_label->setVisible(false);
    //добавление необходимых виджетов для вывода данных
//    output_layout->addItem(label1_layout);
    output_layout->addItem(table1_layout);
//	output_layout->addItem(plot1_layout);
    //=====

    this->layout()->addItem(other);
    this->layout()->addItem(input_layout);
	this->layout()->addItem(output_layout);

    init();

}
示例#8
0
文件: window.cpp 项目: cedrus/qt4
//! [16]
void Window::createTextFormatsGroupBox()
{
    textFormatsGroupBox = new QGroupBox(tr("Text Formats"));

    weekdayColorCombo = createColorComboBox();
    weekdayColorCombo->setCurrentIndex(
            weekdayColorCombo->findText(tr("Black")));

    weekdayColorLabel = new QLabel(tr("&Weekday color:"));
    weekdayColorLabel->setBuddy(weekdayColorCombo);

    weekendColorCombo = createColorComboBox();
    weekendColorCombo->setCurrentIndex(
            weekendColorCombo->findText(tr("Red")));

    weekendColorLabel = new QLabel(tr("Week&end color:"));
    weekendColorLabel->setBuddy(weekendColorCombo);

//! [16] //! [17]
    headerTextFormatCombo = new QComboBox;
    headerTextFormatCombo->addItem(tr("Bold"));
    headerTextFormatCombo->addItem(tr("Italic"));
    headerTextFormatCombo->addItem(tr("Plain"));

    headerTextFormatLabel = new QLabel(tr("&Header text:"));
    headerTextFormatLabel->setBuddy(headerTextFormatCombo);

    firstFridayCheckBox = new QCheckBox(tr("&First Friday in blue"));

    mayFirstCheckBox = new QCheckBox(tr("May &1 in red"));

//! [17] //! [18]
    connect(weekdayColorCombo, SIGNAL(currentIndexChanged(int)),
            this, SLOT(weekdayFormatChanged()));
    connect(weekendColorCombo, SIGNAL(currentIndexChanged(int)),
            this, SLOT(weekendFormatChanged()));
    connect(headerTextFormatCombo, SIGNAL(currentIndexChanged(QString)),
            this, SLOT(reformatHeaders()));
    connect(firstFridayCheckBox, SIGNAL(toggled(bool)),
            this, SLOT(reformatCalendarPage()));
    connect(mayFirstCheckBox, SIGNAL(toggled(bool)),
            this, SLOT(reformatCalendarPage()));

//! [18]
    QHBoxLayout *checkBoxLayout = new QHBoxLayout;
    checkBoxLayout->addWidget(firstFridayCheckBox);
    checkBoxLayout->addStretch();
    checkBoxLayout->addWidget(mayFirstCheckBox);

    QGridLayout *outerLayout = new QGridLayout;
    outerLayout->addWidget(weekdayColorLabel, 0, 0);
    outerLayout->addWidget(weekdayColorCombo, 0, 1);
    outerLayout->addWidget(weekendColorLabel, 1, 0);
    outerLayout->addWidget(weekendColorCombo, 1, 1);
    outerLayout->addWidget(headerTextFormatLabel, 2, 0);
    outerLayout->addWidget(headerTextFormatCombo, 2, 1);
    outerLayout->addLayout(checkBoxLayout, 3, 0, 1, 2);
    textFormatsGroupBox->setLayout(outerLayout);

    weekdayFormatChanged();
    weekendFormatChanged();
//! [19]
    reformatHeaders();
    reformatCalendarPage();
}
示例#9
0
文件: ElmDlg.cpp 项目: yuguess/GSoC
ElmDlg::ElmDlg(SpatialDataView* pView, ElmInteractive* pElmInteractive, QWidget* pParent) :
   QDialog(pParent),
   mPixelOffset(1.0, 1.0),
   mMaxDisplayedPixels(10000),
   mCurrentIndex(-1),
   mpElmInteractive(pElmInteractive),
   mpView(pView, SIGNAL_NAME(Subject, Deleted), Slot(this, &ElmDlg::viewDeleted))
{
   // Initialization
   VERIFYNRV(mpView.get() != NULL);
   VERIFYNRV(mpElmInteractive != NULL);
   setWindowTitle(QString::fromStdString("Empirical Line Method - " + mpView->getDisplayName()));
   mpAoiElement.addSignal(SIGNAL_NAME(Subject, Modified), Slot(this, &ElmDlg::aoiModified));
   mpAoiElement.addSignal(SIGNAL_NAME(Subject, Deleted), Slot(this, &ElmDlg::aoiDeleted));

   // "Use Existing Gains/Offsets File" Layout Begin
   mpExistingFileBrowser = new FileBrowser;

   QHBoxLayout* pUseExistingFileLayout = new QHBoxLayout;
   pUseExistingFileLayout->addWidget(mpExistingFileBrowser);

   QGroupBox* pUseExistingFileGroup = new QGroupBox;
   pUseExistingFileGroup->setLayout(pUseExistingFileLayout);
   pUseExistingFileGroup->setEnabled(false);
   // "Use Existing Gains/Offsets File" Layout End


   // Element Layout Begin
   mpElementComboBox = new QComboBox;
   mpElementComboBox->setToolTip("This is the list of available ELM Elements.");
   mpElementComboBox->setWhatsThis("This is the list of available ELM Elements. "
      "ELM elements are simply a group of selected pixels, similar to an AOI, that specify the location "
      "of an object whose signature matches a corresponding input reflectance signature. "
      "At least two elements must be created to run the ELM algorithm.");

   QPushButton* pNewElementButton = new QPushButton("New Element");
   pNewElementButton->setToolTip("Click this button to create a new ELM element.");
   pNewElementButton->setWhatsThis("Click this button to create a new ELM element. "
      "Pixels must be selected and a corresponding signature must be selected for each element. "
      "At least two elements must be created to run the ELM algorithm.");

   QPushButton* pDeleteElementButton = new QPushButton("Delete Element");
   pDeleteElementButton->setToolTip("Click this button to delete the currently selected ELM Element.");
   pDeleteElementButton->setWhatsThis("Click this button to delete the currently selected ELM Element. "
      "The Element will be removed from the list and its pixels will be deleted from the scene.");

   QVBoxLayout* pElementLayout = new QVBoxLayout;
   pElementLayout->addWidget(mpElementComboBox);
   pElementLayout->addWidget(pNewElementButton);
   pElementLayout->addWidget(pDeleteElementButton);

   QGroupBox* pElementGroup = new QGroupBox("Current Element");
   pElementGroup->setLayout(pElementLayout);
   // Element Layout End


   // Pixel Layout Begin
   mpPixelList = new QListWidget;
   mpPixelList->setSortingEnabled(false);
   mpPixelList->setSelectionMode(QAbstractItemView::ExtendedSelection);
   mpPixelList->setToolTip("When pixels in the scene are selected, their coordinates are listed in this box.");
   mpPixelList->setWhatsThis("When pixels in the scene are selected, their coordinates are listed in this box. "
      "To remove pixels from the list, highlight the pixels to remove and click the \"Delete Pixels\" button.");

   QPushButton* pDeletePixelButton = new QPushButton("Delete Pixels");
   pDeletePixelButton->setToolTip("Click this button to exclude the currently selected "
      "pixel(s) in the list from any further processing.");
   pDeletePixelButton->setWhatsThis("Click this button to exclude the currently selected "
      "pixel(s) in the list from any further processing. The pixels will be removed from "
      "the list so that they cannot be considered during execution.");

   QVBoxLayout* pPixelLayout = new QVBoxLayout;
   pPixelLayout->addWidget(mpPixelList);
   pPixelLayout->addWidget(pDeletePixelButton);

   QGroupBox* pPixelGroup = new QGroupBox(QString("Pixels (Up to %1 displayed)").arg(mMaxDisplayedPixels));
   pPixelGroup->setLayout(pPixelLayout);
   // Pixel Layout End


   // Signature Layout Begin
   mpSignature = new QLineEdit;
   mpSignature->setReadOnly(true);

   QPushButton* pSignatureButton = new QPushButton("Change...");
   pSignatureButton->setToolTip("Select the corresponding reflectance signature for the selected Element.");
   pSignatureButton->setWhatsThis("Select the corresponding reflectance signature for the selected Element. ");

   QHBoxLayout* pSignatureLayout = new QHBoxLayout;
   pSignatureLayout->addWidget(mpSignature);
   pSignatureLayout->addWidget(pSignatureButton);

   QGroupBox* pSignatureGroup = new QGroupBox("Signature");
   pSignatureGroup->setLayout(pSignatureLayout);
   // Signature Layout End


   QGridLayout* pCalculateLayout = new QGridLayout;
   pCalculateLayout->addWidget(pElementGroup, 1, 0);
   pCalculateLayout->addWidget(pPixelGroup, 1, 1, 2, 1);
   pCalculateLayout->addWidget(pSignatureGroup, 3, 0, 1, 3);

   QGroupBox* pCalculateGroup = new QGroupBox;
   pCalculateGroup->setLayout(pCalculateLayout);
   pCalculateGroup->setEnabled(false);
   // "Calculate Gains/Offsets" Layout End


   // Button Box Begin
   QDialogButtonBox* pButtonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel,
      Qt::Horizontal, this);
   // Button Box End


   // Overall Layout Begin
   mpUseExistingFileRadio = new QRadioButton("Use Existing Gains/Offsets File");
   mpCalculateRadio = new QRadioButton("Calculate Gains/Offsets");

   QVBoxLayout* pOverallLayout = new QVBoxLayout(this);
   pOverallLayout->setMargin(10);
   pOverallLayout->setSpacing(5);
   pOverallLayout->addWidget(mpUseExistingFileRadio);
   pOverallLayout->addWidget(pUseExistingFileGroup);
   pOverallLayout->addWidget(mpCalculateRadio);
   pOverallLayout->addWidget(pCalculateGroup);
   pOverallLayout->addWidget(pButtonBox);
   // Overall Layout End


   // Make GUI connections
   VERIFYNRV(connect(mpUseExistingFileRadio, SIGNAL(toggled(bool)), pUseExistingFileGroup, SLOT(setEnabled(bool))));
   VERIFYNRV(connect(mpCalculateRadio, SIGNAL(toggled(bool)), pCalculateGroup, SLOT(setEnabled(bool))));
   VERIFYNRV(connect(mpElementComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(currentIndexChanged(int))));
   VERIFYNRV(connect(pNewElementButton, SIGNAL(clicked()), this, SLOT(newElement())));
   VERIFYNRV(connect(pDeleteElementButton, SIGNAL(clicked()), this, SLOT(deleteElement())));
   if (ElmCore::hasSettingElmHelp())
   {
      pButtonBox->addButton(QDialogButtonBox::Help);
      VERIFYNRV(connect(pButtonBox, SIGNAL(helpRequested()), this, SLOT(help())));
   }
   VERIFYNRV(connect(pButtonBox, SIGNAL(accepted()), this, SLOT(accept())));
   VERIFYNRV(connect(pButtonBox, SIGNAL(rejected()), this, SLOT(reject())));
   VERIFYNRV(connect(pDeletePixelButton, SIGNAL(clicked()), this, SLOT(deletePixels())));
   VERIFYNRV(connect(pSignatureButton, SIGNAL(clicked()), this, SLOT(selectSignature())));


   // AOI toolbar defaults
   Service<DesktopServices> pDesktopServices;
   pDesktopServices->setAoiSelectionTool(RECTANGLE_OBJECT, DRAW);


   // Create an initial element
   newElement();


   // Enable the appropriate GroupBox
   const QString defaultFilename = QString::fromStdString(mpElmInteractive->getDefaultGainsOffsetsFilename());
   if (QFile::exists(defaultFilename) == true)
   {
      mpUseExistingFileRadio->setChecked(true);
      mpExistingFileBrowser->setFilename(defaultFilename);
   }
   else
   {
      mpCalculateRadio->setChecked(true);
   }
}
/*
 * Because Maemo 5 is using a special dialog design this window is declared
 * as a tool window.
 */
SettingsPagePointDataLoading::SettingsPagePointDataLoading( QWidget *parent ) :
  QWidget( parent )
{
  setObjectName("SettingsPagePointDataLoading");
  setAttribute( Qt::WA_DeleteOnClose );
  setWindowFlags( Qt::Tool );
  setWindowTitle(tr("Point data loading settings"));
  setWindowModality( Qt::WindowModal );

  if( _globalMainWindow )
    {
      // Resize the window to the same size as the main window has. That will
      // completely hide the parent window.
      resize( _globalMainWindow->size() );
    }

  QStringList mapDirs = GeneralConfig::instance()->getMapDirectories();

  QVBoxLayout *topLayout = new QVBoxLayout( this );
  topLayout->setSpacing(10);

  m_fileTable = new QTableWidget( 0, 1, this );
  m_fileTable->setToolTip( tr("Uncheck All to enable loading of single files.") );
  m_fileTable->setSelectionBehavior( QAbstractItemView::SelectRows );
  m_fileTable->setAlternatingRowColors( true );
  m_fileTable->setShowGrid( true );

  // set new row height from configuration
  int afMargin = GeneralConfig::instance()->getListDisplayAFMargin();
  m_fileTable->setItemDelegate( new RowDelegate( m_fileTable, afMargin ) );

  m_fileTable->setVerticalScrollMode( QAbstractItemView::ScrollPerPixel );
  m_fileTable->setHorizontalScrollMode( QAbstractItemView::ScrollPerPixel );

#ifdef ANDROID
  QScrollBar* lvsb = m_fileTable->verticalScrollBar();
  lvsb->setStyleSheet( Layout::getCbSbStyle() );
#endif

#ifdef QSCROLLER
  QScroller::grabGesture( m_fileTable->viewport(), QScroller::LeftMouseButtonGesture );
#endif

#ifdef QTSCROLLER
  QtScroller::grabGesture( m_fileTable->viewport(), QtScroller::LeftMouseButtonGesture );
#endif

  QString style = "QTableView QTableCornerButton::section { background: gray }";
  m_fileTable->setStyleSheet( style );

  QHeaderView *vHeader = m_fileTable->verticalHeader();
  style = "QHeaderView::section { width: 2em }";
  vHeader->setStyleSheet( style );

  connect( m_fileTable, SIGNAL(cellClicked ( int, int )),
           SLOT(slot_toggleCheckBox( int, int )) );

  connect( m_fileTable, SIGNAL(itemSelectionChanged()),
           this, SLOT(slot_itemSelectionChanged()) );

  QHeaderView* hHeader = m_fileTable->horizontalHeader();
  hHeader->setStretchLastSection( true );

  QString loadDirs;

  for( int i = 0; i < mapDirs.size(); i++ )
    {
      if( i > 0 )
        {
          loadDirs.append("\n");
        }

      loadDirs += mapDirs.at(i) + "/points";
    }

  QTableWidgetItem *item = new QTableWidgetItem( loadDirs );
  item->setTextAlignment( Qt::AlignLeft );
  m_fileTable->setHorizontalHeaderItem( 0, item );

  topLayout->addWidget( m_fileTable, 10 );

  int buttonSize = Layout::getButtonSize();
  int iconSize   = buttonSize - 5;

  m_delButton = new QPushButton;
  m_delButton->setIcon( QIcon( GeneralConfig::instance()->loadPixmap( "delete.png" ) ) );
  m_delButton->setIconSize(QSize(iconSize, iconSize));
  m_delButton->setMinimumSize(buttonSize, buttonSize);
  m_delButton->setMaximumSize(buttonSize, buttonSize);
  m_delButton->setEnabled( false );

  QPushButton *okButton = new QPushButton;
  okButton->setIcon(QIcon(GeneralConfig::instance()->loadPixmap("ok.png")));
  okButton->setIconSize(QSize(iconSize, iconSize));
  okButton->setMinimumSize(buttonSize, buttonSize);
  okButton->setMaximumSize(buttonSize, buttonSize);

  QPushButton *cancelButton = new QPushButton;
  cancelButton->setIcon(QIcon(GeneralConfig::instance()->loadPixmap("cancel.png")));
  cancelButton->setIconSize(QSize(iconSize, iconSize));
  cancelButton->setMinimumSize(buttonSize, buttonSize);
  cancelButton->setMaximumSize(buttonSize, buttonSize);

  connect( m_delButton, SIGNAL(clicked() ), this, SLOT(slot_DeleteRows()) );
  connect( okButton, SIGNAL(clicked() ), this, SLOT(slot_save()) );
  connect( cancelButton, SIGNAL(clicked() ), this, SLOT(close()) );

  // box with operator buttons
  QHBoxLayout *buttonBox = new QHBoxLayout;

  buttonBox->setSpacing(0);
  buttonBox->addWidget( m_delButton );
  buttonBox->addStretch(2);
  buttonBox->addWidget( cancelButton );
  buttonBox->addSpacing(32);
  buttonBox->addWidget( okButton );
  topLayout->addLayout( buttonBox );

  //---------------------------------------------------------------------------
  // Load table with POI files
  QStringList preselect;

  for ( int i = 0; i < mapDirs.size(); ++i )
    {
      MapContents::addDir(preselect, mapDirs.at(i) + "/points", "*_wpt.aip");
      MapContents::addDir(preselect, mapDirs.at(i) + "/points", "*_nav.aip");
      MapContents::addDir(preselect, mapDirs.at(i) + "/points", "*_hot.aip");
    }

  preselect.sort();

  int row = 0;
  m_fileTable->setRowCount( row + 1 );

  item = new QTableWidgetItem( tr("Check or Uncheck all"), 0 );
  item->setFlags( Qt::ItemIsEnabled );
  item->setCheckState( Qt::Unchecked );
  m_fileTable->setItem( row, 0, item );
  row++;

  for( int i = 0; i < preselect.size(); i++ )
    {
      m_fileTable->setRowCount( row + 1 );

      QString file = QFileInfo( preselect.at(i) ).fileName();
      item = new QTableWidgetItem( file, row );
      item->setFlags( Qt::ItemIsEnabled|Qt::ItemIsSelectable );
      item->setData( Qt::UserRole, preselect.at(i) );
      item->setCheckState( Qt::Unchecked );
      m_fileTable->setItem( row, 0, item );
      row++;
    }

  QStringList& files = GeneralConfig::instance()->getOpenAipPoiFileList();

  if( files.isEmpty() )
    {
      return;
    }

  if( files.at(0) == "All" )
    {
      // Set all items to checked, if All is contained in the list at the first
      // position.
      for( int i = 0; i < m_fileTable->rowCount(); i++ )
        {
          m_fileTable->item( i, 0 )->setCheckState( Qt::Checked );
        }
    }
  else
    {
      // Set the All item to unchecked.
      m_fileTable->item( 0, 0 )->setCheckState( Qt::Unchecked );

      for( int i = 1; i < m_fileTable->rowCount(); i++ )
        {
          QTableWidgetItem* item = m_fileTable->item( i, 0 );

          if( files.contains( item->text()) )
            {
              m_fileTable->item( i, 0 )->setCheckState( Qt::Checked );
            }
          else
            {
              m_fileTable->item( i, 0 )->setCheckState( Qt::Unchecked );
            }
        }
    }

  m_fileTable->resizeColumnsToContents();
  m_fileTable->resizeRowsToContents();
}
示例#11
0
文件: window.cpp 项目: cedrus/qt4
//! [10]
void Window::createGeneralOptionsGroupBox()
{
    generalOptionsGroupBox = new QGroupBox(tr("General Options"));

    localeCombo = new QComboBox;
    int curLocaleIndex = -1;
    int index = 0;
    for (int _lang = QLocale::C; _lang <= QLocale::LastLanguage; ++_lang) {
        QLocale::Language lang = static_cast<QLocale::Language>(_lang);
        QList<QLocale::Country> countries = QLocale::countriesForLanguage(lang);
        for (int i = 0; i < countries.count(); ++i) {
            QLocale::Country country = countries.at(i);
            QString label = QLocale::languageToString(lang);
            label += QLatin1Char('/');
            label += QLocale::countryToString(country);
            QLocale locale(lang, country);
            if (this->locale().language() == lang && this->locale().country() == country)
                curLocaleIndex = index;
            localeCombo->addItem(label, locale);
            ++index;
        }
    }
    if (curLocaleIndex != -1)
        localeCombo->setCurrentIndex(curLocaleIndex);
    localeLabel = new QLabel(tr("&Locale"));
    localeLabel->setBuddy(localeCombo);

    firstDayCombo = new QComboBox;
    firstDayCombo->addItem(tr("Sunday"), Qt::Sunday);
    firstDayCombo->addItem(tr("Monday"), Qt::Monday);
    firstDayCombo->addItem(tr("Tuesday"), Qt::Tuesday);
    firstDayCombo->addItem(tr("Wednesday"), Qt::Wednesday);
    firstDayCombo->addItem(tr("Thursday"), Qt::Thursday);
    firstDayCombo->addItem(tr("Friday"), Qt::Friday);
    firstDayCombo->addItem(tr("Saturday"), Qt::Saturday);

    firstDayLabel = new QLabel(tr("Wee&k starts on:"));
    firstDayLabel->setBuddy(firstDayCombo);
//! [10]

    selectionModeCombo = new QComboBox;
    selectionModeCombo->addItem(tr("Single selection"),
                                QCalendarWidget::SingleSelection);
    selectionModeCombo->addItem(tr("None"), QCalendarWidget::NoSelection);

    selectionModeLabel = new QLabel(tr("&Selection mode:"));
    selectionModeLabel->setBuddy(selectionModeCombo);

    gridCheckBox = new QCheckBox(tr("&Grid"));
    gridCheckBox->setChecked(calendar->isGridVisible());

    navigationCheckBox = new QCheckBox(tr("&Navigation bar"));
    navigationCheckBox->setChecked(true);

    horizontalHeaderCombo = new QComboBox;
    horizontalHeaderCombo->addItem(tr("Single letter day names"),
                                   QCalendarWidget::SingleLetterDayNames);
    horizontalHeaderCombo->addItem(tr("Short day names"),
                                   QCalendarWidget::ShortDayNames);
    horizontalHeaderCombo->addItem(tr("None"),
                                   QCalendarWidget::NoHorizontalHeader);
    horizontalHeaderCombo->setCurrentIndex(1);

    horizontalHeaderLabel = new QLabel(tr("&Horizontal header:"));
    horizontalHeaderLabel->setBuddy(horizontalHeaderCombo);

    verticalHeaderCombo = new QComboBox;
    verticalHeaderCombo->addItem(tr("ISO week numbers"),
                                 QCalendarWidget::ISOWeekNumbers);
    verticalHeaderCombo->addItem(tr("None"), QCalendarWidget::NoVerticalHeader);

    verticalHeaderLabel = new QLabel(tr("&Vertical header:"));
    verticalHeaderLabel->setBuddy(verticalHeaderCombo);

//! [11]
    connect(localeCombo, SIGNAL(currentIndexChanged(int)),
            this, SLOT(localeChanged(int)));
    connect(firstDayCombo, SIGNAL(currentIndexChanged(int)),
            this, SLOT(firstDayChanged(int)));
    connect(selectionModeCombo, SIGNAL(currentIndexChanged(int)),
            this, SLOT(selectionModeChanged(int)));
    connect(gridCheckBox, SIGNAL(toggled(bool)),
            calendar, SLOT(setGridVisible(bool)));
    connect(navigationCheckBox, SIGNAL(toggled(bool)),
            calendar, SLOT(setNavigationBarVisible(bool)));
    connect(horizontalHeaderCombo, SIGNAL(currentIndexChanged(int)),
            this, SLOT(horizontalHeaderChanged(int)));
    connect(verticalHeaderCombo, SIGNAL(currentIndexChanged(int)),
            this, SLOT(verticalHeaderChanged(int)));
//! [11]

    QHBoxLayout *checkBoxLayout = new QHBoxLayout;
    checkBoxLayout->addWidget(gridCheckBox);
    checkBoxLayout->addStretch();
    checkBoxLayout->addWidget(navigationCheckBox);

    QGridLayout *outerLayout = new QGridLayout;
    outerLayout->addWidget(localeLabel, 0, 0);
    outerLayout->addWidget(localeCombo, 0, 1);
    outerLayout->addWidget(firstDayLabel, 1, 0);
    outerLayout->addWidget(firstDayCombo, 1, 1);
    outerLayout->addWidget(selectionModeLabel, 2, 0);
    outerLayout->addWidget(selectionModeCombo, 2, 1);
    outerLayout->addLayout(checkBoxLayout, 3, 0, 1, 2);
    outerLayout->addWidget(horizontalHeaderLabel, 4, 0);
    outerLayout->addWidget(horizontalHeaderCombo, 4, 1);
    outerLayout->addWidget(verticalHeaderLabel, 5, 0);
    outerLayout->addWidget(verticalHeaderCombo, 5, 1);
    generalOptionsGroupBox->setLayout(outerLayout);

//! [12]
    firstDayChanged(firstDayCombo->currentIndex());
    selectionModeChanged(selectionModeCombo->currentIndex());
    horizontalHeaderChanged(horizontalHeaderCombo->currentIndex());
    verticalHeaderChanged(verticalHeaderCombo->currentIndex());
}
KisAboutApplication::KisAboutApplication(QWidget *parent)
    : QDialog(parent)
{
    setWindowTitle(i18n("About Krita"));

    QVBoxLayout *vlayout = new QVBoxLayout(this);
    vlayout->setMargin(0);
    QTabWidget *wdg = new QTabWidget;
    vlayout->addWidget(wdg);

    KisSplashScreen *splash = new KisSplashScreen(qApp->applicationVersion(), QPixmap(splash_screen_xpm), true);
    splash->setWindowFlags(Qt::Widget);
    splash->setFixedSize(splash->sizeHint());
    wdg->addTab(splash, i18n("About"));
    setMinimumSize(wdg->sizeHint());

    QTextEdit *lblAuthors = new QTextEdit();
    lblAuthors->setReadOnly(true);

    QString authors = i18n("<html>"
                          "<head/>"
                          "<body>"
                          "<h1 align=\"center\">Created By</h1></p>"
                          "<p>");

    QFile fileDevelopers(":/developers.txt");
    Q_ASSERT(fileDevelopers.exists());
    fileDevelopers.open(QIODevice::ReadOnly);

    foreach(const QByteArray &author, fileDevelopers.readAll().split('\n')) {
        authors.append(QString::fromUtf8(author));
        authors.append(", ");
    }
    authors.chop(2);
    authors.append(".</p></body></html>");
    lblAuthors->setText(authors);
    wdg->addTab(lblAuthors, i18n("Authors"));

    QTextEdit *lblKickstarter = new QTextEdit();
    lblKickstarter->setReadOnly(true);

    QString backers = i18n("<html>"
                          "<head/>"
                          "<body>"
                          "<h1 align=\"center\">Backed By</h1>"
                          "<p>");

    QFile fileBackers(":/backers.txt");
    Q_ASSERT(fileBackers.exists());
    fileBackers.open(QIODevice::ReadOnly);
    foreach(const QByteArray &backer, fileBackers.readAll().split('\n')) {
        backers.append(QString::fromUtf8(backer));
        backers.append(", ");
    }
    backers.chop(2);
    backers.append(i18n(".</p><p><i>Thanks! You were all <b>awesome</b>!</i></p></body></html>"));
    lblKickstarter->setText(backers);
    wdg->addTab(lblKickstarter, i18n("Backers"));



    QTextEdit *lblCredits = new QTextEdit();
    lblCredits->setReadOnly(true);
    QString credits = i18n("<html>"
                          "<head/>"
                          "<body>"
                          "<h1 align=\"center\">Thanks To</h1>"
                          "<p>");

    QFile fileCredits(":/credits.txt");
    Q_ASSERT(fileCredits.exists());
    fileCredits.open(QIODevice::ReadOnly);

    foreach(const QByteArray &credit, fileCredits.readAll().split('\n')) {
        if (!credit.isEmpty()) {
            QList<QByteArray> creditSplit = credit.split(':');
            Q_ASSERT(creditSplit.size() == 2);
            credits.append(QString::fromUtf8(creditSplit.at(0)));
            credits.append(" (<i>" + QString::fromUtf8(creditSplit.at(1)) + "</i>)");
            credits.append(", ");
        }
    }
    credits.chop(2);
    credits.append(i18n(".</p><p><i>For supporting Krita development with advice, icons, brush sets and more.</i></p></body></html>"));

    lblCredits->setText(credits);
    wdg->addTab(lblCredits, i18n("Also Thanks To"));

    QTextEdit *lblLicense = new QTextEdit();
    lblLicense->setReadOnly(true);
    QString license = i18n("<html>"
                           "<head/>"
                           "<body>"
                           "<h1 align=\"center\"><b>Your Rights</h1>"
                           "<p>Krita is released under the GNU General Public License (version 2 or any later version).</p>"
                           "<p>This license grants people a number of freedoms:</p>"
                           "<ul>"
                           "<li>You are free to use Krita, for any purpose</li>"
                           "<li>You are free to distribute Krita</li>"
                           "<li>You can study how Krita works and change it</li>"
                           "<li>You can distribute changed versions of Krita</li>"
                           "</ul>"
                           "<p>The Krita Foundation and its projects on krita.org are <b>committed</b> to preserving Krita as free software.</p>"
                           "<h1 align=\"center\">Your artwork</h1>"
                           "<p>What you create with Krita is your sole property. All your artwork is free for you to use as you like.</p>"
                           "<p>That means that Krita can be used commercially, for any purpose. There are no restrictions whatsoever.</p>"
                           "<p>Krita’s GNU GPL license guarantees you this freedom. Nobody is ever permitted to take it away, in contrast "
                           "to trial or educational versions of commercial software that will forbid your work in commercial situations.</p>"
                           "<br/><hr/><pre>");

    QFile licenseFile(":/LICENSE");
    Q_ASSERT(licenseFile.exists());
    licenseFile.open(QIODevice::ReadOnly);
    QByteArray ba = licenseFile.readAll();
    license.append(QString::fromUtf8(ba));
    license.append("</pre></body></html>");
    lblLicense->setText(license);

    wdg->addTab(lblLicense, i18n("License"));

    QPushButton *bnClose = new QPushButton(i18n("Close"));
    connect(bnClose, SIGNAL(clicked()), SLOT(close()));

    QHBoxLayout *hlayout = new QHBoxLayout;
    hlayout->setMargin(0);
    hlayout->addStretch(10);
    hlayout->addWidget(bnClose);

    vlayout->addLayout(hlayout);
}
示例#13
0
QLayout * PageEditTeam::bodyLayoutDefinition()
{
    QGridLayout * pageLayout = new QGridLayout();
    tbw = new QTabWidget();
    QWidget * page1 = new QWidget(this);
    binder = new KeyBinder(this, tr("Select an action to choose a custom key bind for this team"), tr("Use my default"), tr("Reset all binds"));
    connect(binder, SIGNAL(resetAllBinds()), this, SLOT(resetAllBinds()));
    tbw->addTab(page1, tr("General"));
    tbw->addTab(binder, tr("Custom Controls"));
    pageLayout->addWidget(tbw, 0, 0, 1, 3);

    QHBoxLayout * page1Layout = new QHBoxLayout(page1);
    page1Layout->setAlignment(Qt::AlignTop);

// ====== Page 1 ======
    QVBoxLayout * vbox1 = new QVBoxLayout();
    QVBoxLayout * vbox2 = new QVBoxLayout();
    page1Layout->addLayout(vbox1);
    page1Layout->addLayout(vbox2);

    GBoxHedgehogs = new QGroupBox(this);
    GBoxHedgehogs->setTitle(QGroupBox::tr("Team Members"));
    GBoxHedgehogs->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
    QGridLayout * GBHLayout = new QGridLayout(GBoxHedgehogs);


    GBHLayout->addWidget(new QLabel(tr("Hat")), 0, 0);
    GBHLayout->addWidget(new QLabel(tr("Name")), 0, 1);

    for(int i = 0; i < HEDGEHOGS_PER_TEAM; i++)
    {
        HHHats[i] = new HatButton(GBoxHedgehogs);
        GBHLayout->addWidget(HHHats[i], i + 1, 0);

        HHNameEdit[i] = new QLineEdit(GBoxHedgehogs);
        HHNameEdit[i]->setMaxLength(64);
        HHNameEdit[i]->setMinimumWidth(120);
        HHNameEdit[i]->setFixedHeight(36);
        HHNameEdit[i]->setWhatsThis(tr("This hedgehog's name"));
        HHNameEdit[i]->setStyleSheet("padding: 6px;");
        GBHLayout->addWidget(HHNameEdit[i], i + 1, 1);

        btnRandomHogName[i] = addButton(":/res/dice.png", GBHLayout, i + 1, 3, 1, 1, true);
        btnRandomHogName[i]->setFixedHeight(HHNameEdit[i]->height());
        btnRandomHogName[i]->setWhatsThis(tr("Randomize this hedgehog's name"));
    }

    btnRandomTeam = new QPushButton();
    btnRandomTeam->setText(tr("Random Team"));
    btnRandomTeam->setStyleSheet("padding: 6px 10px;");
    GBHLayout->addWidget(btnRandomTeam, 9, 0, 1, 4, Qt::AlignCenter);
    btnRandomTeam->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);

    vbox1->addWidget(GBoxHedgehogs);

    GBoxTeam = new QGroupBox(this);
    GBoxTeam->setTitle(QGroupBox::tr("Team Settings"));
    GBoxTeam->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
    QGridLayout * GBTLayout = new QGridLayout(GBoxTeam);
    QLabel * tmpLabel = new QLabel(GBoxTeam);
    tmpLabel->setText(QLabel::tr("Name"));
    GBTLayout->addWidget(tmpLabel, 0, 0);
    tmpLabel = new QLabel(GBoxTeam);
    tmpLabel->setText(QLabel::tr("Type"));
    GBTLayout->addWidget(tmpLabel, 1, 0);
    tmpLabel = new QLabel(GBoxTeam);
    tmpLabel->setText(QLabel::tr("Grave"));
    GBTLayout->addWidget(tmpLabel, 2, 0);
    tmpLabel = new QLabel(GBoxTeam);
    tmpLabel->setText(QLabel::tr("Flag"));
    GBTLayout->addWidget(tmpLabel, 3, 0);
    tmpLabel = new QLabel(GBoxTeam);
    tmpLabel->setText(QLabel::tr("Voice"));
    GBTLayout->addWidget(tmpLabel, 4, 0);

    TeamNameEdit = new QLineEdit(GBoxTeam);
    TeamNameEdit->setMaxLength(64);
    GBTLayout->addWidget(TeamNameEdit, 0, 1);
    vbox2->addWidget(GBoxTeam);

    CBTeamLvl = new QComboBox(GBoxTeam);
    CBTeamLvl->setIconSize(QSize(48, 48));
    CBTeamLvl->addItem(QIcon(":/res/botlevels/0.png"), QComboBox::tr("Human"));
    for(int i = 5; i > 0; i--)
        CBTeamLvl->addItem(
            QIcon(QString(":/res/botlevels/%1.png").arg(6 - i)),
            QString("%1 %2").arg(QComboBox::tr("Level")).arg(i)
        );
    GBTLayout->addWidget(CBTeamLvl, 1, 1);

    CBGrave = new QComboBox(GBoxTeam);
    CBGrave->setMaxCount(65535);
    CBGrave->setIconSize(QSize(32, 32));
    GBTLayout->addWidget(CBGrave, 2, 1);

    CBFlag = new QComboBox(GBoxTeam);
    CBFlag->setMaxCount(65535);
    CBFlag->setIconSize(QSize(22, 15));
    GBTLayout->addWidget(CBFlag, 3, 1);

    QHBoxLayout * hbox = new QHBoxLayout();
    CBVoicepack = new QComboBox(GBoxTeam);

    hbox->addWidget(CBVoicepack, 100);
    btnTestSound = addSoundlessButton(":/res/PlaySound.png", hbox, 1, true);
    hbox->setStretchFactor(btnTestSound, 1);

    GBTLayout->addLayout(hbox, 4, 1);

    GBoxFort = new QGroupBox(this);
    GBoxFort->setTitle(QGroupBox::tr("Fort"));
    QGridLayout * GBFLayout = new QGridLayout(GBoxFort);
    CBFort = new QComboBox(GBoxFort);
    CBFort->setMaxCount(65535);
    GBFLayout->addWidget(CBFort, 0, 0);
    FortPreview = new SquareLabel(GBoxFort);
    FortPreview->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    FortPreview->setMinimumSize(128, 128);
    FortPreview->setPixmap(QPixmap());
    // perhaps due to handling its own paintevents, SquareLabel doesn't play nice with the stars
    //FortPreview->setAttribute(Qt::WA_PaintOnScreen, true);
    GBFLayout->addWidget(FortPreview, 1, 0);
    vbox2->addWidget(GBoxFort);

    vbox1->addStretch();
    vbox2->addStretch();

    return pageLayout;
}
示例#14
0
US_RunDetails2::US_RunDetails2( const QVector< US_DataIO::RawData >& data, 
                                const QString&                       runID, 
                                const QString&                       dataDir, 
                                const QStringList&                   cell_ch_wl )
   : US_WidgetsDialog( 0, 0 ), dataList( data ), triples( cell_ch_wl )
{
   setWindowTitle( tr( "Details for Raw Data" ) );
   setPalette( US_GuiSettings::frameColor() );

   QGridLayout* main = new QGridLayout( this );
   main->setSpacing        ( 2 );
   main->setContentsMargins( 2, 2, 2, 2 );

   plotType  = TEMPERATURE;
   temp_warn = true;
   int row  = 0;

   // Plot Rows
   QBoxLayout* plot = new US_Plot( data_plot,
        tr( "Parameter Variation Throughout Run" ),
        tr( "Scan Number" ), 
        tr( "RPM * 1000 / Temperature " ) + DEGC );

   data_plot->setMinimumSize( 400, 200 );
   data_plot->enableAxis( QwtPlot::yRight );

   // Copy font for right axis from left axis
   QwtText axisTitle = data_plot->axisTitle( QwtPlot::yLeft );
   axisTitle.setText( tr( "Time between Scans (min)" ) );
   data_plot->setAxisTitle( QwtPlot::yRight, axisTitle );

   QwtPlotGrid* grid = us_grid( data_plot );
   grid->enableXMin( false );

   main->addLayout( plot, row, 0, 5, 6 );
   row += 6;

   // Row
   QLabel* lb_dir = us_label( tr( "Data Directory:" ) );
   main->addWidget( lb_dir, row, 0 );

   QLineEdit* le_dir = us_lineedit();
   le_dir->setReadOnly( true );
   le_dir->setText( dataDir );
   main->addWidget( le_dir, row++, 1, 1, 5 );

   // Row
   QLabel* lb_desc = us_label( tr( "Description:" ) );
   main->addWidget( lb_desc, row, 0 );

   le_desc = us_lineedit();
   le_desc->setReadOnly( true );
   le_desc->setText( dataDir );
   main->addWidget( le_desc, row++, 1, 1, 5 );

   // Row
   QLabel* lb_runID = us_label( tr( "Run Identification:" ) );
   main->addWidget( lb_runID, row, 0 );

   lw_rpm = us_listwidget();
   lw_rpm->setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Minimum );
   lw_rpm->setMinimumSize( 100, 50 );
   main->addWidget( lw_rpm, row, 2, 5, 2 );

   lw_triples = us_listwidget();
   lw_triples->setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Minimum );
   lw_triples->setMinimumSize( 100, 50 );
   main->addWidget( lw_triples, row, 4, 5, 2 );

   le_runID = us_lineedit();
   le_runID->setReadOnly( true );
   le_runID->setText( runID );
   main->addWidget( le_runID, row++, 1 );

   // Row
   QLabel* lb_runLen = us_label( tr( "Length of Run:" ) );
   main->addWidget( lb_runLen, row, 0 );

   le_runLen = us_lineedit();
   le_runLen->setReadOnly( true );
   main->addWidget( le_runLen, row++, 1 );

   // Row
   QLabel* lb_timeCorr = us_label( tr( "Time Correction:" ) );
   main->addWidget( lb_timeCorr, row, 0 );

   le_timeCorr = us_lineedit();
   le_timeCorr->setReadOnly( true );
   main->addWidget( le_timeCorr, row++, 1 );

   // Row
   QLabel* lb_rotorSpeed = us_label( tr( "Avg. Rotor Speed:" ) );
   main->addWidget( lb_rotorSpeed, row, 0 );

   le_rotorSpeed = us_lineedit();
   le_rotorSpeed->setReadOnly( true );
   main->addWidget( le_rotorSpeed, row++, 1 );

   // Row
   QLabel* lb_avgTemp = us_label( tr( "Avg. Temperature:" ) );
   main->addWidget( lb_avgTemp, row, 0 );

   le_avgTemp = us_lineedit();
   le_avgTemp->setReadOnly( true );
   main->addWidget( le_avgTemp, row++, 1 );

   // Row
   QLabel* lb_tempCheck = us_label( tr( "Temperature Check:" ) );
   main->addWidget( lb_tempCheck, row, 0 );

   QHBoxLayout* box1 = new QHBoxLayout;
   box1->setAlignment( Qt::AlignCenter );

   QHBoxLayout* box2 = new QHBoxLayout;
   box2->setAlignment( Qt::AlignCenter );
   box2->setSpacing( 10 );

   lb_green = new QLabel();
   lb_green->setFixedSize(20, 16);
   lb_green->setPalette( QPalette( QColor( 0, 0x44, 0 ) ) ); // Dark Green
   lb_green->setAutoFillBackground( true );
   lb_green->setFrameStyle( QFrame::StyledPanel | QFrame::Sunken );

   lb_red   = new QLabel();
   lb_red->setFixedSize(20, 16);
   lb_red->setPalette( QPalette( QColor( 0x55, 0, 0 ) ) ); // Dark Red
   lb_red->setAutoFillBackground( true );
   lb_red->setFrameStyle( QFrame::StyledPanel | QFrame::Sunken );

   box2->addWidget( lb_green );
   box2->addWidget( lb_red );
   box1->addLayout( box2 );

   main->addLayout( box1, row, 1 );

   QHBoxLayout* buttons = new QHBoxLayout();

   QPushButton* pb_temp = us_pushbutton( tr( "Temperature" ) );
   connect( pb_temp, SIGNAL( clicked() ), SLOT( plot_temp() ) );
   buttons->addWidget( pb_temp );

   QPushButton* pb_rpm = us_pushbutton( tr( "RPM" ) );
   connect( pb_rpm, SIGNAL( clicked() ), SLOT( plot_rpm() ) );
   buttons->addWidget( pb_rpm );

   QPushButton* pb_interval = us_pushbutton( tr( "Interval" ) );
   connect( pb_interval, SIGNAL( clicked() ), SLOT( plot_interval() ) );
   buttons->addWidget( pb_interval );

   QPushButton* pb_all = us_pushbutton( tr( "Combined" ) );
   connect( pb_all, SIGNAL( clicked() ), SLOT( plot_combined() ) );
   buttons->addWidget( pb_all );

   QPushButton* pb_close = us_pushbutton( tr( "Close" ) );
   connect( pb_close, SIGNAL( clicked() ), SLOT( close() ) );
   buttons->addWidget( pb_close );

   main->addLayout( buttons, row++, 2, 1, 4 );

   timer = new QTimer();
   connect( timer, SIGNAL( timeout() ), SLOT( update_timer() ) );

   setup();
   connect( lw_triples, SIGNAL( currentRowChanged( int ) ),
                        SLOT  ( update           ( int ) ) );

   connect( lw_rpm,     SIGNAL( itemClicked     ( QListWidgetItem* ) ),
            this,       SLOT  ( show_rpm_details( QListWidgetItem* ) ) );
}
示例#15
0
文件: MainWindow.cpp 项目: StCyr/lmms
MainWindow::MainWindow() :
    m_workspace( NULL ),
    m_templatesMenu( NULL ),
    m_recentlyOpenedProjectsMenu( NULL ),
    m_toolsMenu( NULL ),
    m_autoSaveTimer( this ),
    m_viewMenu( NULL ),
    m_metronomeToggle( 0 ),
    m_session( Normal )
{
    setAttribute( Qt::WA_DeleteOnClose );

    QWidget * main_widget = new QWidget( this );
    QVBoxLayout * vbox = new QVBoxLayout( main_widget );
    vbox->setSpacing( 0 );
    vbox->setMargin( 0 );

    QWidget * w = new QWidget( main_widget );
    QHBoxLayout * hbox = new QHBoxLayout( w );
    hbox->setSpacing( 0 );
    hbox->setMargin( 0 );

    SideBar * sideBar = new SideBar( Qt::Vertical, w );

    QSplitter * splitter = new QSplitter( Qt::Horizontal, w );
    splitter->setChildrenCollapsible( false );

    ConfigManager* confMgr = ConfigManager::inst();

    emit initProgress(tr("Preparing plugin browser"));
    sideBar->appendTab( new PluginBrowser( splitter ) );
    emit initProgress(tr("Preparing file browsers"));
    sideBar->appendTab( new FileBrowser(
                            confMgr->userProjectsDir() + "*" +
                            confMgr->factoryProjectsDir(),
                            "*.mmp *.mmpz *.xml *.mid *.flp",
                            tr( "My Projects" ),
                            embed::getIconPixmap( "project_file" ).transformed( QTransform().rotate( 90 ) ),
                            splitter, false, true ) );
    sideBar->appendTab( new FileBrowser(
                            confMgr->userSamplesDir() + "*" +
                            confMgr->factorySamplesDir(),
                            "*", tr( "My Samples" ),
                            embed::getIconPixmap( "sample_file" ).transformed( QTransform().rotate( 90 ) ),
                            splitter, false, true ) );
    sideBar->appendTab( new FileBrowser(
                            confMgr->userPresetsDir() + "*" +
                            confMgr->factoryPresetsDir(),
                            "*.xpf *.cs.xml *.xiz",
                            tr( "My Presets" ),
                            embed::getIconPixmap( "preset_file" ).transformed( QTransform().rotate( 90 ) ),
                            splitter , false, true  ) );
    sideBar->appendTab( new FileBrowser( QDir::homePath(), "*",
                                         tr( "My Home" ),
                                         embed::getIconPixmap( "home" ).transformed( QTransform().rotate( 90 ) ),
                                         splitter, false, true ) );


    QStringList root_paths;
    QString title = tr( "Root directory" );
    bool dirs_as_items = false;

#ifdef LMMS_BUILD_APPLE
    title = tr( "Volumes" );
    root_paths += "/Volumes";
#elif defined(LMMS_BUILD_WIN32)
    title = tr( "My Computer" );
    dirs_as_items = true;
#endif

#if ! defined(LMMS_BUILD_APPLE)
    QFileInfoList drives = QDir::drives();
    for( const QFileInfo & drive : drives )
    {
        root_paths += drive.absolutePath();
    }
#endif

    sideBar->appendTab( new FileBrowser( root_paths.join( "*" ), "*", title,
                                         embed::getIconPixmap( "computer" ).transformed( QTransform().rotate( 90 ) ),
                                         splitter, dirs_as_items) );

    m_workspace = new QMdiArea( splitter );

    // Load background
    emit initProgress(tr("Loading background artwork"));
    QString bgArtwork = ConfigManager::inst()->backgroundArtwork();
    QImage bgImage;
    if( !bgArtwork.isEmpty() )
    {
        bgImage = QImage( bgArtwork );
    }
    if( !bgImage.isNull() )
    {
        m_workspace->setBackground( bgImage );
    }
    else
    {
        m_workspace->setBackground( Qt::NoBrush );
    }

    m_workspace->setOption( QMdiArea::DontMaximizeSubWindowOnActivation );
    m_workspace->setHorizontalScrollBarPolicy( Qt::ScrollBarAsNeeded );
    m_workspace->setVerticalScrollBarPolicy( Qt::ScrollBarAsNeeded );

    hbox->addWidget( sideBar );
    hbox->addWidget( splitter );


    // create global-toolbar at the top of our window
    m_toolBar = new QWidget( main_widget );
    m_toolBar->setObjectName( "mainToolbar" );
    m_toolBar->setFixedHeight( 64 );
    m_toolBar->move( 0, 0 );

    // add layout for organizing quite complex toolbar-layouting
    m_toolBarLayout = new QGridLayout( m_toolBar/*, 2, 1*/ );
    m_toolBarLayout->setMargin( 0 );
    m_toolBarLayout->setSpacing( 0 );

    vbox->addWidget( m_toolBar );
    vbox->addWidget( w );
    setCentralWidget( main_widget );

    m_updateTimer.start( 1000 / 20, this );  // 20 fps

    if( ConfigManager::inst()->value( "ui", "enableautosave" ).toInt() )
    {
        // connect auto save
        connect(&m_autoSaveTimer, SIGNAL(timeout()), this, SLOT(autoSave()));
        m_autoSaveInterval = ConfigManager::inst()->value(
                                 "ui", "saveinterval" ).toInt() < 1 ?
                             DEFAULT_AUTO_SAVE_INTERVAL :
                             ConfigManager::inst()->value(
                                 "ui", "saveinterval" ).toInt();

        // The auto save function mustn't run until there is a project
        // to save or it will run over recover.mmp if you hesitate at the
        // recover messagebox for a minute. It is now started in main.
        // See autoSaveTimerReset() in MainWindow.h
    }

    connect( Engine::getSong(), SIGNAL( playbackStateChanged() ),
             this, SLOT( updatePlayPauseIcons() ) );
}
示例#16
0
bool QVideoCapture::open_resolutionDialog()
{
    if (m_cvCapture.isOpened() && deviceFlag)
    {
        //GUI CONSTRUCTION//
        QDialog dialog;
        dialog.setFixedSize(200,180);
        dialog.setWindowTitle(tr("Camcorder resolution"));

        QVBoxLayout toplevellayout;
        toplevellayout.setMargin(5);

        QVBoxLayout layout;
        layout.setMargin(5);
        QGroupBox groupbox;
        groupbox.setTitle("Resolution & framerate");
        QVBoxLayout comboboxes;
        comboboxes.setMargin(5);
        QComboBox CBresolution;
        CBresolution.addItem("640 x 360"); // 0
        CBresolution.addItem("640 x 480"); // 1
        CBresolution.addItem("800 x 600"); // 2
        CBresolution.addItem("960 x 720"); // 3
        CBresolution.addItem("1280 x 720"); // 4
        CBresolution.addItem("1920 x 1080"); // 5
        CBresolution.setSizeAdjustPolicy(QComboBox::AdjustToContents);
        CBresolution.setCurrentIndex(1);
        QLabel Lresolution("Set resolution:");
        QComboBox CBm_framerate(&dialog);
        CBm_framerate.addItem("30 fps"); // 0
        CBm_framerate.addItem("25 fps"); // 1
        CBm_framerate.addItem("20 fps"); // 2
        CBm_framerate.addItem("15 fps"); // 3
        CBm_framerate.addItem("60 fps"); // 4
        CBm_framerate.setSizeAdjustPolicy(QComboBox::AdjustToContents);
        CBm_framerate.setCurrentIndex(0);
        QLabel Lm_framerate("Set framerate:");
        comboboxes.addWidget(&Lresolution,1,Qt::AlignLeft);
        comboboxes.addWidget(&CBresolution);
        comboboxes.addWidget(&Lm_framerate,1,Qt::AlignLeft);
        comboboxes.addWidget(&CBm_framerate);
        groupbox.setLayout(&comboboxes);
        layout.addWidget(&groupbox);

        QHBoxLayout buttons;
        buttons.setMargin(5);
        QPushButton Baccept;
        Baccept.setText("Accept");
        connect(&Baccept, SIGNAL(clicked()), &dialog, SLOT(accept()));
        QPushButton Bcancel;
        Bcancel.setText("Cancel");
        connect(&Bcancel, SIGNAL(clicked()), &dialog, SLOT(reject()));
        buttons.addWidget(&Baccept);
        buttons.addWidget(&Bcancel);

        toplevellayout.addLayout(&layout);
        toplevellayout.addLayout(&buttons);
        dialog.setLayout(&toplevellayout);
        //GUI CONSTRUCTION END//

        if(dialog.exec() == QDialog::Accepted)
        {
            m_cvCapture.set( CV_CAP_PROP_FRAME_WIDTH, CBresolution.itemText(CBresolution.currentIndex()).section(" x ",0,0).toDouble() );
            m_cvCapture.set( CV_CAP_PROP_FRAME_HEIGHT, CBresolution.itemText(CBresolution.currentIndex()).section(" x ",1,1).toDouble() );
            pt_timer->setInterval( 1000/CBm_framerate.itemText(CBm_framerate.currentIndex()).section(" ",0,0).toDouble() );
        }
        return true;
    }
    return false; // will return false if device was not opened or dialog.exec() == QDialog::Rejected
}
示例#17
0
BitcoinGUI::BitcoinGUI(QWidget *parent) :
    QMainWindow(parent),
    clientModel(0),
    encryptWalletAction(0),
    changePassphraseAction(0),
    aboutQtAction(0),
    trayIcon(0),
    notificator(0),
    rpcConsole(0),
    prevBlocks(0)
{
    restoreWindowGeometry();
    setWindowTitle(tr("Vaultcoin") + " - " + tr("Wallet"));
#ifndef Q_OS_MAC
    QApplication::setWindowIcon(QIcon(":icons/bitcoin"));
    setWindowIcon(QIcon(":icons/bitcoin"));
#else
    setUnifiedTitleAndToolBarOnMac(true);
    QApplication::setAttribute(Qt::AA_DontShowIconsInMenus);
#endif
    // Create wallet frame and make it the central widget
    walletFrame = new WalletFrame(this);
    setCentralWidget(walletFrame);

    // Accept D&D of URIs
    setAcceptDrops(true);

    // Create actions for the toolbar, menu bar and tray/dock icon
    // Needs walletFrame to be initialized
    createActions();

    // Create application menu bar
    createMenuBar();

    // Create the toolbars
    createToolBars();

    // Create system tray icon and notification
    createTrayIcon();

    // Create status bar
    statusBar();

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

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

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

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

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

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

    // Install event filter to be able to catch status tip events (QEvent::StatusTip)
    this->installEventFilter(this);

    // Initially wallet actions should be disabled
    setWalletActionsEnabled(false);
}
示例#18
0
bool QVideoCapture::open_settingsDialog()
{
    if (m_cvCapture.isOpened() && deviceFlag)
    {
        //DIALOG CONSTRUCTION//
        QDialog dialog;
        dialog.setFixedSize(256,320);
        dialog.setWindowTitle(tr("Camcorder settings"));

        QVBoxLayout toplevellayout;
        toplevellayout.setMargin(5);
        QTabWidget tabwidget;

        QWidget page1; // a widget for a cam general settings selection
        QHBoxLayout centralbox;
        centralbox.setMargin(5);
        QVBoxLayout sliders;
        sliders.setMargin(5);
        QVBoxLayout lineedits;
        lineedits.setMargin(5);
        QVBoxLayout names;
        names.setMargin(5);

        QSlider Sbrightness;
        Sbrightness.setOrientation(Qt::Horizontal);
        Sbrightness.setMinimum(MIN_BRIGHTNESS);
        Sbrightness.setMaximum(MAX_BRIGHTNESS);
        Sbrightness.setValue( (int)m_cvCapture.get(CV_CAP_PROP_BRIGHTNESS) );
        QLabel Lbrightness;
        Lbrightness.setNum( (int)m_cvCapture.get(CV_CAP_PROP_BRIGHTNESS) );
        connect(&Sbrightness, SIGNAL(valueChanged(int)), &Lbrightness, SLOT(setNum(int)));
        connect(&Sbrightness, SIGNAL(valueChanged(int)), this, SLOT(set_brightness(int)));
        connect(this, SIGNAL(set_default_brightness(int)), &Sbrightness, SLOT(setValue(int)));
        QLabel Nbrightness("Brightness:");

        QSlider Scontrast;
        Scontrast.setOrientation(Qt::Horizontal);
        Scontrast.setMinimum(MIN_CONTRAST);
        Scontrast.setMaximum(MAX_CONTRAST);
        Scontrast.setValue( (int)m_cvCapture.get(CV_CAP_PROP_CONTRAST) );
        QLabel Lcontrast;
        Lcontrast.setNum( (int)m_cvCapture.get(CV_CAP_PROP_CONTRAST) );
        connect(&Scontrast, SIGNAL(valueChanged(int)), &Lcontrast, SLOT(setNum(int)));
        connect(&Scontrast,SIGNAL(valueChanged(int)), this, SLOT(set_contrast(int)));
        connect(this, SIGNAL(set_default_contrast(int)), &Scontrast, SLOT(setValue(int)));
        QLabel Ncontrast("Contrast:");

        QSlider Ssaturation;
        Ssaturation.setOrientation(Qt::Horizontal);
        Ssaturation.setMinimum(MIN_SATURATION);
        Ssaturation.setMaximum(MAX_SATURATION);
        Ssaturation.setValue( (int)m_cvCapture.get(CV_CAP_PROP_SATURATION) );
        QLabel Lsaturation;
        Lsaturation.setNum( (int)m_cvCapture.get(CV_CAP_PROP_SATURATION) );
        connect(&Ssaturation, SIGNAL(valueChanged(int)), &Lsaturation, SLOT(setNum(int)));
        connect(&Ssaturation,SIGNAL(valueChanged(int)), this, SLOT(set_saturation(int)));
        connect(this, SIGNAL(set_default_saturation(int)), &Ssaturation, SLOT(setValue(int)));
        QLabel Nsaturation("Saturation:");

        QSlider SwhitebalanceU;
        SwhitebalanceU.setOrientation(Qt::Horizontal);
        SwhitebalanceU.setMinimum(MIN_WHITE_BALANCE);
        SwhitebalanceU.setMaximum(MAX_WHITE_BALANCE);
        SwhitebalanceU.setValue( (int)m_cvCapture.get(CV_CAP_PROP_WHITE_BALANCE_BLUE_U) );
        QLabel LwhitebalanceU;
        LwhitebalanceU.setNum( (int)m_cvCapture.get(CV_CAP_PROP_WHITE_BALANCE_BLUE_U) );
        connect(&SwhitebalanceU, SIGNAL(valueChanged(int)), &LwhitebalanceU, SLOT(setNum(int)));
        connect(&SwhitebalanceU,SIGNAL(valueChanged(int)), this, SLOT(set_white_balanceU(int)));
        connect(this, SIGNAL(set_default_white_balanceU(int)), &SwhitebalanceU, SLOT(setValue(int)));
        QLabel NwhitebalanceU("White_balanceU:");

        QSlider SwhitebalanceV;
        SwhitebalanceV.setOrientation(Qt::Horizontal);
        SwhitebalanceV.setMinimum(MIN_WHITE_BALANCE);
        SwhitebalanceV.setMaximum(MAX_WHITE_BALANCE);
        SwhitebalanceV.setValue( (int)m_cvCapture.get(CV_CAP_PROP_WHITE_BALANCE_RED_V) );
        QLabel LwhitebalanceV;
        LwhitebalanceV.setNum( (int)m_cvCapture.get(CV_CAP_PROP_WHITE_BALANCE_RED_V) );
        connect(&SwhitebalanceV, SIGNAL(valueChanged(int)), &LwhitebalanceV, SLOT(setNum(int)));
        connect(&SwhitebalanceV,SIGNAL(valueChanged(int)), this, SLOT(set_white_balanceV(int)));
        connect(this, SIGNAL(set_default_white_balanceV(int)), &SwhitebalanceV, SLOT(setValue(int)));
        QLabel NwhitebalanceV("White_balanceV:");

        sliders.addWidget(&Sbrightness);
        lineedits.addWidget(&Lbrightness, 2);
        names.addWidget(&Nbrightness, 1);

        sliders.addWidget(&Scontrast);
        lineedits.addWidget(&Lcontrast, 2);
        names.addWidget(&Ncontrast, 1);

        sliders.addWidget(&Ssaturation);
        lineedits.addWidget(&Lsaturation, 2);
        names.addWidget(&Nsaturation, 1);

        sliders.addWidget(&SwhitebalanceU);
        lineedits.addWidget(&LwhitebalanceU, 2);
        names.addWidget(&NwhitebalanceU, 1);

        sliders.addWidget(&SwhitebalanceV);
        lineedits.addWidget(&LwhitebalanceV, 2);
        names.addWidget(&NwhitebalanceV, 1);

        centralbox.addLayout(&names);
        centralbox.addLayout(&sliders);
        centralbox.addLayout(&lineedits);
        page1.setLayout( &centralbox );

        QWidget page2; // a widget for a cam gain/exposure selection
        QHBoxLayout centralbox2;
        centralbox2.setMargin(5);
        QVBoxLayout sliders2;
        sliders2.setMargin(5);
        QVBoxLayout lineedits2;
        lineedits2.setMargin(5);
        QVBoxLayout names2;
        names2.setMargin(5);

        QSlider Sgain;
        Sgain.setOrientation(Qt::Horizontal);
        Sgain.setMinimum(MIN_GAIN);
        Sgain.setMaximum(MAX_GAIN);
        Sgain.setValue( (int)m_cvCapture.get(CV_CAP_PROP_GAIN) );
        QLabel Lgain;
        Lgain.setNum( (int)m_cvCapture.get(CV_CAP_PROP_GAIN) );
        connect(&Sgain, SIGNAL(valueChanged(int)), &Lgain, SLOT(setNum(int)));
        connect(&Sgain,SIGNAL(valueChanged(int)), this, SLOT(set_gain(int)));
        connect(this, SIGNAL(set_default_gain(int)), &Sgain, SLOT(setValue(int)),Qt::DirectConnection);
        QLabel Ngain("Gain:");

        QSlider Sexposure;
        Sexposure.setOrientation(Qt::Horizontal);
        Sexposure.setMinimum(MIN_EXPOSURE);
        Sexposure.setMaximum(MAX_EXPOSURE);
        Sexposure.setValue( (int)m_cvCapture.get(CV_CAP_PROP_EXPOSURE) );
        QLabel Lexposure;
        Lexposure.setNum( (int)m_cvCapture.get(CV_CAP_PROP_EXPOSURE) );
        connect(&Sexposure, SIGNAL(valueChanged(int)), &Lexposure, SLOT(setNum(int)));
        connect(&Sexposure,SIGNAL(valueChanged(int)), this, SLOT(set_exposure(int)));
        connect(this, SIGNAL(set_default_exposure(int)), &Sexposure, SLOT(setValue(int)));
        QLabel Nexposure("Exposure:");

        sliders2.addWidget(&Sgain);
        lineedits2.addWidget(&Lgain, 2);
        names2.addWidget(&Ngain, 1);

        sliders2.addWidget(&Sexposure);
        lineedits2.addWidget(&Lexposure, 2);
        names2.addWidget(&Nexposure, 1);

        centralbox2.addLayout(&names2);
        centralbox2.addLayout(&sliders2);
        centralbox2.addLayout(&lineedits2);
        page2.setLayout( &centralbox2 );


        QHBoxLayout buttons;
        buttons.setMargin(5);
        QPushButton Baccept;
        Baccept.setText(tr("Accept"));
        connect(&Baccept, SIGNAL(clicked()), &dialog, SLOT(accept()));
        QPushButton Bcancel;
        Bcancel.setText(tr("Cancel"));
        connect(&Bcancel, SIGNAL(clicked()), &dialog, SLOT(reject()));
        QPushButton Bdefault;
        Bdefault.setText(tr("Default"));
        connect(&Bdefault, SIGNAL(clicked()), this, SLOT(set_default_settings()));
        buttons.addWidget(&Baccept);
        buttons.addWidget(&Bcancel);
        buttons.addWidget(&Bdefault);

        tabwidget.addTab(&page1, "Brightness/Contrast");
        tabwidget.addTab(&page2, "Gain/Exposure");
        toplevellayout.addWidget(&tabwidget);
        toplevellayout.addLayout(&buttons);
        dialog.setLayout(&toplevellayout);
        //DIALOG CONSTRUCTION END//
        dialog.exec();
        return true;
    }
TableDialog::TableDialog(Table *t, QWidget* parent, Qt::WFlags fl )
    : QDialog( parent, fl),
    d_table(t)
{
    setName( "TableDialog" );
    setWindowTitle( tr( "QtiPlot - Column options" ) );
    setSizeGripEnabled(true);

	QHBoxLayout *hboxa = new QHBoxLayout();
	hboxa->addWidget(new QLabel(tr( "Column Name:" )));
    colName = new QLineEdit();
    hboxa->addWidget(colName);

	enumerateAllBox = new QCheckBox(tr("Enumerate all to the right" ));

	buttonPrev = new QPushButton("&<<");
	buttonPrev->setAutoDefault(false);

	buttonNext = new QPushButton("&>>");
	buttonNext->setAutoDefault(false);

#ifndef Q_OS_MAC
	buttonPrev->setMaximumWidth(40);
	buttonNext->setMaximumWidth(40);
#endif

	QHBoxLayout *hboxb = new QHBoxLayout();
    hboxb->addWidget(buttonPrev);
    hboxb->addWidget(buttonNext);
    hboxb->addStretch();

    QVBoxLayout *vbox1 = new QVBoxLayout();
    vbox1->addLayout(hboxa);
    vbox1->addWidget(enumerateAllBox);
    vbox1->addLayout(hboxb);

	buttonOk = new QPushButton(tr( "&OK" ));
    buttonOk->setDefault(true);

	buttonApply = new QPushButton(tr("&Apply"));
	buttonApply->setAutoDefault(false);

	buttonCancel = new QPushButton(tr( "&Cancel" ));
	buttonCancel->setAutoDefault(false);

	QVBoxLayout  *vbox2 = new QVBoxLayout();
	vbox2->setSpacing(5);
	vbox2->setMargin(5);
	vbox2->addWidget(buttonOk);
	vbox2->addWidget(buttonApply);
	vbox2->addWidget(buttonCancel);

    QHBoxLayout  *hbox1 = new QHBoxLayout();
	hbox1->setSpacing(5);
	hbox1->addLayout(vbox1);
	hbox1->addLayout(vbox2);

	QGridLayout *gl1 = new QGridLayout();
    gl1->addWidget(new QLabel( tr("Plot Designation:")), 0, 0);

   	columnsBox = new QComboBox();
	columnsBox->addItem(tr("None"));
	columnsBox->addItem(tr("X (abscissae)"));
	columnsBox->addItem(tr("Y (ordinates)"));
	columnsBox->addItem(tr("Z (height)"));
	columnsBox->addItem(tr("X Error"));
	columnsBox->addItem(tr("Y Error"));
	columnsBox->addItem(tr("Label"));
    gl1->addWidget(columnsBox, 0, 1);

    gl1->addWidget(new QLabel(tr("Display")), 1, 0);

   	displayBox = new QComboBox();
	displayBox->addItem(tr("Numeric"));
	displayBox->addItem(tr("Text"));
	displayBox->addItem(tr("Date"));
	displayBox->addItem(tr("Time"));
	displayBox->addItem(tr("Month"));
	displayBox->addItem(tr("Day of Week"));
    gl1->addWidget(displayBox, 1, 1);

    labelFormat = new QLabel(tr( "Format:" ));
 	gl1->addWidget(labelFormat, 2, 0);

    formatBox = new QComboBox(false);
    gl1->addWidget(formatBox, 2, 1);

	labelNumeric = new QLabel(tr( "Precision:" ));
	gl1->addWidget(labelNumeric, 3, 0);

    precisionBox = new QSpinBox();
    precisionBox->setRange(0, 14);
    gl1->addWidget(precisionBox, 3, 1);

    boxReadOnly = new QCheckBox(tr("&Read-only" ));
    gl1->addWidget(boxReadOnly, 4, 0);

	boxHideColumn = new QCheckBox(tr("&Hidden" ));
    gl1->addWidget(boxHideColumn, 4, 1);

	applyToRightCols = new QCheckBox(tr( "Apply to all columns to the right" ));

    QVBoxLayout *vbox3 = new QVBoxLayout();
    vbox3->addLayout(gl1);
    vbox3->addWidget(applyToRightCols);

    QGroupBox *gb = new QGroupBox(tr("Options"));
    gb->setLayout(vbox3);

    QHBoxLayout  *hbox2 = new QHBoxLayout();
    hbox2->addWidget(new QLabel(tr( "Column Width:" )));

	colWidth = new QSpinBox();
    colWidth->setRange(0, 1000);
	colWidth->setSingleStep(10);

	hbox2->addWidget(colWidth);

    applyToAllBox = new QCheckBox(tr( "Apply to all" ));
	hbox2->addWidget(applyToAllBox);

	comments = new QTextEdit();
	boxShowTableComments = new QCheckBox(tr("&Display Comments in Header"));
	boxShowTableComments->setChecked(d_table->commentsEnabled());

	QVBoxLayout* vbox4 = new QVBoxLayout();
    vbox4->addLayout(hbox1);
	vbox4->addWidget(gb);
	vbox4->addLayout(hbox2);
	vbox4->addWidget(new QLabel(tr( "Comment:" )));
	vbox4->addWidget(comments);
	vbox4->addWidget(boxShowTableComments);

    setLayout(vbox4);
    setFocusProxy (colName);

    updateColumn(d_table->selectedColumn());

   // signals and slots connections
	connect(colWidth, SIGNAL(valueChanged(int)), this, SLOT(setColumnWidth(int)));
	connect(buttonApply, SIGNAL(clicked()), this, SLOT(apply()));
    connect(buttonOk, SIGNAL(clicked()), this, SLOT(accept()));
    connect(buttonCancel, SIGNAL( clicked() ), this, SLOT( close() ) );
	connect(columnsBox, SIGNAL(activated(int)), this, SLOT(setPlotDesignation(int)) );
	connect(displayBox, SIGNAL(activated(int)), this, SLOT(updateDisplay(int)));
	connect(buttonPrev, SIGNAL(clicked()), this, SLOT(prevColumn()));
	connect(buttonNext, SIGNAL(clicked()), this, SLOT(nextColumn()));
	connect(precisionBox, SIGNAL(valueChanged(int)), this, SLOT(updatePrecision(int)));
	connect(boxShowTableComments, SIGNAL(toggled(bool)), d_table, SLOT(showComments(bool)));
}
示例#20
0
BitcoinGUI::BitcoinGUI(QWidget *parent):
    QMainWindow(parent),
    clientModel(0),
    walletModel(0),
    encryptWalletAction(0),
    changePassphraseAction(0),
    aboutQtAction(0),
    trayIcon(0),
    notificator(0),
    rpcConsole(0)
{
    resize(850, 550);
    setWindowTitle(tr("NobleCoin") + " - " + tr("Wallet"));
#ifndef Q_WS_MAC
    qApp->setWindowIcon(QIcon(":icons/bitcoin"));
    setWindowIcon(QIcon(":icons/bitcoin"));
#else
    setUnifiedTitleAndToolBarOnMac(true);
    QApplication::setAttribute(Qt::AA_DontShowIconsInMenus);
#endif
    // Accept D&D of URIs
    setAcceptDrops(true);

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

    // Create application menu bar
    createMenuBar();

    // Create the toolbars
    createToolBars();

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

	QPalette p;
	p.setColor(QPalette::Window, QColor(0x22, 0x22, 0x22));
	p.setColor(QPalette::Button, QColor(0x22, 0x22, 0x22));
	p.setColor(QPalette::Mid, QColor(0x22, 0x22, 0x22));
	p.setColor(QPalette::Base, QColor(0x22, 0x22, 0x22));
	p.setColor(QPalette::AlternateBase, QColor(0x22, 0x22, 0x22));
	setPalette(p);
	QFile style(":/text/res/text/style.qss");
	style.open(QFile::ReadOnly);
	setStyleSheet(QString::fromUtf8(style.readAll()));

    /* don't override the background color of the toolbar on mac os x due to
       the whole component it resides on not being paintable
     */
#ifdef Q_OS_MAC
    toolbar->setStyleSheet("QToolBar { background-color: transparent; border: 0px solid black; padding: 3px; }");
#endif
    // Create tabs
    overviewPage = new OverviewPage();
	chatWindow = new ChatWindow(this); //Create Chat Window
	blockExplorer = new BlockExplorer(this); //Include Block Explorer
    transactionsPage = new QWidget(this);
    QVBoxLayout *vbox = new QVBoxLayout();
    transactionView = new TransactionView(this);
    vbox->addWidget(transactionView);
    transactionsPage->setLayout(vbox);

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

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

    sendCoinsPage = new SendCoinsDialog(this);

    signVerifyMessageDialog = new SignVerifyMessageDialog(this);

    centralWidget = new QStackedWidget(this);
	centralWidget->addWidget(chatWindow); //Add Chat Window
	centralWidget->addWidget(blockExplorer); //Create Block Explorer
    centralWidget->addWidget(overviewPage);
    centralWidget->addWidget(transactionsPage);
    centralWidget->addWidget(addressBookPage);
    centralWidget->addWidget(receiveCoinsPage);
    centralWidget->addWidget(sendCoinsPage);
#ifdef FIRST_CLASS_MESSAGING
    centralWidget->addWidget(signVerifyMessageDialog);
#endif
    setCentralWidget(centralWidget);

    // Create status bar
    statusBar();

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

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

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

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

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

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

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

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

    gotoOverviewPage();
}
示例#21
0
void SearchTab::createGui()
{
	QVBoxLayout *layout = new QVBoxLayout(this);
	layout->setMargin(2);
	layout->setSpacing(0);

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

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

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

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

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

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

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

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

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

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

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

	QWidget *dateWidget = new QWidget(queryFormWidget);

	QHBoxLayout *dateLayout = new QHBoxLayout(dateWidget);

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

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

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

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

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

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

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

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

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

	setFocusProxy(Query);
}
void
QvisLagrangianWindow::CreateWindowContents()
{
    QGridLayout *mainLayout = new QGridLayout(0);
    topLayout->addLayout(mainLayout);

    seedPointLabel = new QLabel(tr("Seed Point"), central);
    mainLayout->addWidget(seedPointLabel,0,0);
    seedPoint = new QLineEdit(central);
    connect(seedPoint, SIGNAL(returnPressed()),
            this, SLOT(seedPointProcessText()));
    mainLayout->addWidget(seedPoint, 0,1);

    numStepsLabel = new QLabel(tr("Number of steps"), central);
    mainLayout->addWidget(numStepsLabel,1,0);
    numSteps = new QLineEdit(central);
    connect(numSteps, SIGNAL(returnPressed()),
            this, SLOT(numStepsProcessText()));
    mainLayout->addWidget(numSteps, 1,1);

    XAxisSampleLabel = new QLabel(tr("X Axis Sample"), central);
    mainLayout->addWidget(XAxisSampleLabel,2,0);
    XAxisSample = new QWidget(central);
    XAxisSampleButtonGroup= new QButtonGroup(XAxisSample);
    QHBoxLayout *XAxisSampleLayout = new QHBoxLayout(XAxisSample);
    XAxisSampleLayout->setMargin(0);
    XAxisSampleLayout->setSpacing(10);
    QRadioButton *XAxisSamplesampleTypeStep = new QRadioButton(tr("Step"), XAxisSample);
    XAxisSampleButtonGroup->addButton(XAxisSamplesampleTypeStep,0);
    XAxisSampleLayout->addWidget(XAxisSamplesampleTypeStep);
    QRadioButton *XAxisSamplesampleTypeTime = new QRadioButton(tr("Time"), XAxisSample);
    XAxisSampleButtonGroup->addButton(XAxisSamplesampleTypeTime,1);
    XAxisSampleLayout->addWidget(XAxisSamplesampleTypeTime);
    QRadioButton *XAxisSamplesampleTypeArcLength = new QRadioButton(tr("ArcLength"), XAxisSample);
    XAxisSampleButtonGroup->addButton(XAxisSamplesampleTypeArcLength,2);
    XAxisSampleLayout->addWidget(XAxisSamplesampleTypeArcLength);
    QRadioButton *XAxisSamplesampleTypeSpeed = new QRadioButton(tr("Speed"), XAxisSample);
    XAxisSampleButtonGroup->addButton(XAxisSamplesampleTypeSpeed,3);
    XAxisSampleLayout->addWidget(XAxisSamplesampleTypeSpeed);
    QRadioButton *XAxisSamplesampleTypeVorticity = new QRadioButton(tr("Vorticity"), XAxisSample);
    XAxisSampleButtonGroup->addButton(XAxisSamplesampleTypeVorticity,4);
    XAxisSampleLayout->addWidget(XAxisSamplesampleTypeVorticity);
    QRadioButton *XAxisSamplesampleTypeVariable = new QRadioButton(tr("Variable"), XAxisSample);
    XAxisSampleButtonGroup->addButton(XAxisSamplesampleTypeVariable,5);
    XAxisSampleLayout->addWidget(XAxisSamplesampleTypeVariable);
    connect(XAxisSampleButtonGroup, SIGNAL(buttonClicked(int)),
            this, SLOT(XAxisSampleChanged(int)));
    mainLayout->addWidget(XAxisSample, 2,1);

    YAxisSampleLabel = new QLabel(tr("Y Axis Sample"), central);
    mainLayout->addWidget(YAxisSampleLabel,3,0);
    YAxisSample = new QWidget(central);
    YAxisSampleButtonGroup= new QButtonGroup(YAxisSample);
    QHBoxLayout *YAxisSampleLayout = new QHBoxLayout(YAxisSample);
    YAxisSampleLayout->setMargin(0);
    YAxisSampleLayout->setSpacing(10);
    QRadioButton *YAxisSamplesampleTypeStep = new QRadioButton(tr("Step"), YAxisSample);
    YAxisSampleButtonGroup->addButton(YAxisSamplesampleTypeStep,0);
    YAxisSampleLayout->addWidget(YAxisSamplesampleTypeStep);
    QRadioButton *YAxisSamplesampleTypeTime = new QRadioButton(tr("Time"), YAxisSample);
    YAxisSampleButtonGroup->addButton(YAxisSamplesampleTypeTime,1);
    YAxisSampleLayout->addWidget(YAxisSamplesampleTypeTime);
    QRadioButton *YAxisSamplesampleTypeArcLength = new QRadioButton(tr("ArcLength"), YAxisSample);
    YAxisSampleButtonGroup->addButton(YAxisSamplesampleTypeArcLength,2);
    YAxisSampleLayout->addWidget(YAxisSamplesampleTypeArcLength);
    QRadioButton *YAxisSamplesampleTypeSpeed = new QRadioButton(tr("Speed"), YAxisSample);
    YAxisSampleButtonGroup->addButton(YAxisSamplesampleTypeSpeed,3);
    YAxisSampleLayout->addWidget(YAxisSamplesampleTypeSpeed);
    QRadioButton *YAxisSamplesampleTypeVorticity = new QRadioButton(tr("Vorticity"), YAxisSample);
    YAxisSampleButtonGroup->addButton(YAxisSamplesampleTypeVorticity,4);
    YAxisSampleLayout->addWidget(YAxisSamplesampleTypeVorticity);
    QRadioButton *YAxisSamplesampleTypeVariable = new QRadioButton(tr("Variable"), YAxisSample);
    YAxisSampleButtonGroup->addButton(YAxisSamplesampleTypeVariable,5);
    YAxisSampleLayout->addWidget(YAxisSamplesampleTypeVariable);
    connect(YAxisSampleButtonGroup, SIGNAL(buttonClicked(int)),
            this, SLOT(YAxisSampleChanged(int)));
    mainLayout->addWidget(YAxisSample, 3,1);

    variableLabel = new QLabel(tr("Variable"), central);
    mainLayout->addWidget(variableLabel,4,0);
    int variableMask = QvisVariableButton::Scalars;
    variable = new QvisVariableButton(true, true, true, variableMask, central);
    connect(variable, SIGNAL(activated(const QString&)),
            this, SLOT(variableChanged(const QString&)));
    mainLayout->addWidget(variable, 4,1);

}
QTM_USE_NAMESPACE

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

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

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

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

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

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

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

    m_saveOrNextSoftKey = new QAction("Save",this);
    m_saveOrNextSoftKey->setSoftKeyRole(QAction::PositiveSoftKey);
    addAction(m_saveOrNextSoftKey);
    connect(m_saveOrNextSoftKey, SIGNAL(triggered(bool)), this, SLOT(saveOrNextClicked()));
    m_countFieldAdded = false;
    m_multipleEntries = false;
    m_listOfEvents.clear();
}
示例#24
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_WS_MAC
    hlayout->setSpacing(5);
    hlayout->addSpacing(26);
#else
    hlayout->setSpacing(0);
    hlayout->addSpacing(23);
#endif

    dateWidget = new QComboBox(this);
#ifdef Q_WS_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_WS_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
    /* Do not move this to the XML file, Qt before 4.7 will choke on it */
    addressWidget->setPlaceholderText(tr("Enter opening 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
#ifdef Q_WS_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_WS_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;

    // Actions
    QAction *copyAddressAction = new QAction(tr("Copy opening"), this);
    QAction *copyLabelAction = new QAction(tr("Copy label"), this);
    QAction *copyAmountAction = new QAction(tr("Copy amount"), 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(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(editLabelAction, SIGNAL(triggered()), this, SLOT(editLabel()));
    connect(showDetailsAction, SIGNAL(triggered()), this, SLOT(showDetails()));
}
示例#25
0
BuzzerControl::BuzzerControl() {
    QHBoxLayout *layout = new QHBoxLayout();
    QVBoxLayout *settingsLayout = new QVBoxLayout();
    QHBoxLayout *confLayout = new QHBoxLayout();
    QGridLayout *teamLayout = new QGridLayout();

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

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

    updateSerialPortList();

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

    QSignalMapper *signalMapper = new QSignalMapper();

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

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

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

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

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

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

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

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

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

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

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

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

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

    layout->addWidget(settingsWidget);
    layout->addWidget(playlistWidget);
    setLayout(layout);
}
QgsRelationReferenceWidget::QgsRelationReferenceWidget( QWidget* parent )
    : QWidget( parent )
    , mEditorContext( QgsAttributeEditorContext() )
    , mCanvas( nullptr )
    , mMessageBar( nullptr )
    , mForeignKey( QVariant() )
    , mReferencedFieldIdx( -1 )
    , mReferencingFieldIdx( -1 )
    , mAllowNull( true )
    , mHighlight( nullptr )
    , mMapTool( nullptr )
    , mMessageBarItem( nullptr )
    , mRelationName( "" )
    , mReferencedAttributeForm( nullptr )
    , mReferencedLayer( nullptr )
    , mReferencingLayer( nullptr )
    , mMasterModel( nullptr )
    , mFilterModel( nullptr )
    , mFeatureListModel( nullptr )
    , mWindowWidget( nullptr )
    , mShown( false )
    , mIsEditable( true )
    , mEmbedForm( false )
    , mReadOnlySelector( false )
    , mAllowMapIdentification( false )
    , mOrderByValue( false )
    , mOpenFormButtonVisible( true )
    , mChainFilters( false )
    , mAllowAddFeatures( false )
{
  mTopLayout = new QVBoxLayout( this );
  mTopLayout->setContentsMargins( 0, 0, 0, 0 );

  setSizePolicy( sizePolicy().horizontalPolicy(), QSizePolicy::Fixed );

  setLayout( mTopLayout );

  QHBoxLayout* editLayout = new QHBoxLayout();
  editLayout->setContentsMargins( 0, 0, 0, 0 );
  editLayout->setSpacing( 2 );

  // Prepare the container and layout for the filter comboboxes
  mChooserContainer = new QWidget;
  editLayout->addWidget( mChooserContainer );
  QHBoxLayout* chooserLayout = new QHBoxLayout;
  chooserLayout->setContentsMargins( 0, 0, 0, 0 );
  mFilterLayout = new QHBoxLayout;
  mFilterLayout->setContentsMargins( 0, 0, 0, 0 );
  mFilterContainer = new QWidget;
  mFilterContainer->setLayout( mFilterLayout );
  mChooserContainer->setLayout( chooserLayout );
  chooserLayout->addWidget( mFilterContainer );

  // combobox (for non-geometric relation)
  mComboBox = new QComboBox();
  mChooserContainer->layout()->addWidget( mComboBox );

  // read-only line edit
  mLineEdit = new QLineEdit();
  mLineEdit->setReadOnly( true );
  editLayout->addWidget( mLineEdit );

  // open form button
  mOpenFormButton = new QToolButton();
  mOpenFormButton->setIcon( QgsApplication::getThemeIcon( "/mActionPropertyItem.png" ) );
  mOpenFormButton->setText( tr( "Open related feature form" ) );
  editLayout->addWidget( mOpenFormButton );

  mAddEntryButton = new QToolButton();
  mAddEntryButton->setIcon( QgsApplication::getThemeIcon( "/mActionAdd.svg" ) );
  mAddEntryButton->setText( tr( "Add new entry" ) );
  editLayout->addWidget( mAddEntryButton );

  // highlight button
  mHighlightFeatureButton = new QToolButton( this );
  mHighlightFeatureButton->setPopupMode( QToolButton::MenuButtonPopup );
  mHighlightFeatureAction = new QAction( QgsApplication::getThemeIcon( "/mActionHighlightFeature.svg" ), tr( "Highlight feature" ), this );
  mScaleHighlightFeatureAction = new QAction( QgsApplication::getThemeIcon( "/mActionScaleHighlightFeature.svg" ), tr( "Scale and highlight feature" ), this );
  mPanHighlightFeatureAction = new QAction( QgsApplication::getThemeIcon( "/mActionPanHighlightFeature.svg" ), tr( "Pan and highlight feature" ), this );
  mHighlightFeatureButton->addAction( mHighlightFeatureAction );
  mHighlightFeatureButton->addAction( mScaleHighlightFeatureAction );
  mHighlightFeatureButton->addAction( mPanHighlightFeatureAction );
  mHighlightFeatureButton->setDefaultAction( mHighlightFeatureAction );
  editLayout->addWidget( mHighlightFeatureButton );

  // map identification button
  mMapIdentificationButton = new QToolButton( this );
  mMapIdentificationButton->setIcon( QgsApplication::getThemeIcon( "/mActionMapIdentification.svg" ) );
  mMapIdentificationButton->setText( tr( "Select on map" ) );
  mMapIdentificationButton->setCheckable( true );
  editLayout->addWidget( mMapIdentificationButton );

  // remove foreign key button
  mRemoveFKButton = new QToolButton( this );
  mRemoveFKButton->setIcon( QgsApplication::getThemeIcon( "/mActionRemove.svg" ) );
  mRemoveFKButton->setText( tr( "No selection" ) );
  editLayout->addWidget( mRemoveFKButton );

  // add line to top layout
  mTopLayout->addLayout( editLayout );

  // embed form
  mAttributeEditorFrame = new QgsCollapsibleGroupBox( this );
  mAttributeEditorLayout = new QVBoxLayout( mAttributeEditorFrame );
  mAttributeEditorFrame->setLayout( mAttributeEditorLayout );
  mAttributeEditorFrame->setSizePolicy( mAttributeEditorFrame->sizePolicy().horizontalPolicy(), QSizePolicy::Expanding );
  mTopLayout->addWidget( mAttributeEditorFrame );

  // invalid label
  mInvalidLabel = new QLabel( tr( "The relation is not valid. Please make sure your relation definitions are ok." ) );
  mInvalidLabel->setWordWrap( true );
  QFont font = mInvalidLabel->font();
  font.setItalic( true );
  mInvalidLabel->setStyleSheet( "QLabel { color: red; } " );
  mInvalidLabel->setFont( font );
  mTopLayout->addWidget( mInvalidLabel );

  // default mode is combobox, no geometric relation and no embed form
  mLineEdit->hide();
  mMapIdentificationButton->hide();
  mHighlightFeatureButton->hide();
  mAttributeEditorFrame->hide();
  mInvalidLabel->hide();

  // connect buttons
  connect( mOpenFormButton, SIGNAL( clicked() ), this, SLOT( openForm() ) );
  connect( mHighlightFeatureButton, SIGNAL( triggered( QAction* ) ), this, SLOT( highlightActionTriggered( QAction* ) ) );
  connect( mMapIdentificationButton, SIGNAL( clicked() ), this, SLOT( mapIdentification() ) );
  connect( mRemoveFKButton, SIGNAL( clicked() ), this, SLOT( deleteForeignKey() ) );
  connect( mAddEntryButton, SIGNAL( clicked( bool ) ), this, SLOT( addEntry() ) );
  connect( mComboBox, SIGNAL( editTextChanged( QString ) ), this, SLOT( updateAddEntryButton() ) );
}
示例#27
0
void SyntroDB::initDisplayStats()
{
	QTableWidgetItem *item;
	QHBoxLayout *layout;
	QWidget *widget;

	int cellHeight = fontMetrics().lineSpacing() + CELL_HEIGHT_PAD;
	
	m_rxStreamTable = new QTableWidget(this);

	m_rxStreamTable->setColumnCount(SYNTRODB_COL_COUNT);
	m_rxStreamTable->setColumnWidth(SYNTRODB_COL_CONFIG, 80);
	m_rxStreamTable->setColumnWidth(SYNTRODB_COL_INUSE, 60);
	m_rxStreamTable->setColumnWidth(SYNTRODB_COL_STREAM, 140);
	m_rxStreamTable->setColumnWidth(SYNTRODB_COL_TOTALRECS, 80);
	m_rxStreamTable->setColumnWidth(SYNTRODB_COL_TOTALBYTES, 100);
	m_rxStreamTable->setColumnWidth(SYNTRODB_COL_FILERECS, 80);
	m_rxStreamTable->setColumnWidth(SYNTRODB_COL_FILEBYTES, 100);
	m_rxStreamTable->setColumnWidth(SYNTRODB_COL_FILE, 400);

	m_rxStreamTable->verticalHeader()->setDefaultSectionSize(cellHeight);

    m_rxStreamTable->setHorizontalHeaderLabels(QStringList() << tr("") << tr("In use") << tr("Stream") 
			<< tr("Total Recs") << tr("Total Bytes") 
			<< tr("File Recs") << tr("File Bytes") << tr("Current file path"));

    m_rxStreamTable->setSelectionMode(QAbstractItemView::NoSelection);
 
	for (int row = 0; row < SYNTRODB_MAX_STREAMS; row++) {
		m_rxStreamTable->insertRow(row);
		m_rxStreamTable->setRowHeight(row, cellHeight);
		m_rxStreamTable->setContentsMargins(5, 5, 5, 5);

		StoreButton *button = new StoreButton("Configure", this, row);
		m_rxStreamTable->setCellWidget(row, SYNTRODB_COL_CONFIG, button);
		connect(button, SIGNAL(buttonClicked(int)), this, SLOT(buttonClicked(int)));

		m_useBox[row] = new StoreCheckBox(m_rxStreamTable, row);

		// center the checkbox in cell
		widget = new QWidget;
		layout = new QHBoxLayout;
		layout->setSpacing(0);
		layout->setContentsMargins(0, 0, 0, 0);
		layout->addWidget(m_useBox[row]);
		layout->setAlignment(Qt::AlignCenter);
		widget->setLayout(layout);
		m_rxStreamTable->setCellWidget(row, SYNTRODB_COL_INUSE, widget);

		connect(m_useBox[row], SIGNAL(boxClicked(bool, int)), this, SLOT(boxClicked(bool, int)));
		
		for (int col = 2; col < SYNTRODB_COL_COUNT; col++) {
			item = new QTableWidgetItem();
			item->setTextAlignment(Qt::AlignLeft | Qt::AlignBottom);
			item->setFlags(Qt::ItemIsEnabled);
			item->setText("");
			m_rxStreamTable->setItem(row, col, item);
		}
	}
	setCentralWidget(m_rxStreamTable);
}
示例#28
0
transferOrderList::transferOrderList( QWidget* parent, const char* name, bool modal, Qt::WFlags fl )
  : QDialog(parent, fl)
{
  setObjectName(name ? name : "transferOrderList");
  setModal(modal);

  _toheadid = -1;
  _type = (cToOpen | cToClosed);

  setWindowTitle(tr("Transfer Orders"));

  QVBoxLayout *mainLayout	= new QVBoxLayout(this);
  QHBoxLayout *warehouseLayout	= new QHBoxLayout(0);
  QHBoxLayout *topLayout	= new QHBoxLayout(0);
  QVBoxLayout *buttonsLayout	= new QVBoxLayout(0);
  QVBoxLayout *listLayout	= new QVBoxLayout(0);

  mainLayout->setContentsMargins(5, 5, 5, 5);
  warehouseLayout->setContentsMargins(0, 0, 0, 0);
  topLayout->setContentsMargins(0, 0, 0, 0);
  buttonsLayout->setContentsMargins(0, 0, 0, 0);
  listLayout->setContentsMargins(0, 0, 0, 0);

  mainLayout->setSpacing(5);
  warehouseLayout->setSpacing(0);
  topLayout->setSpacing(7);
  buttonsLayout->setSpacing(5);
  listLayout->setSpacing(0);

  _srcwhs = new WarehouseGroup(this, "_srcwhs");
  _srcwhs->setTitle(tr("From Site:"));
  _dstwhs = new WarehouseGroup(this, "_dstwhs");
  _dstwhs->setTitle(tr("To Site:"));
  _dstwhs->setAll();
  warehouseLayout->addWidget(_srcwhs);
  warehouseLayout->addWidget(_dstwhs);

  QSpacerItem* spacer = new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Preferred);
  warehouseLayout->addItem(spacer);
  topLayout->addLayout(warehouseLayout);

  QSpacerItem* spacer_2 = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum);
  topLayout->addItem(spacer_2);

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

  _select = new QPushButton(tr("&Select"), this);
  _select->setObjectName("_select");
  _select->setEnabled( FALSE );
  _select->setDefault( TRUE );
  buttonsLayout->addWidget(_select);
  topLayout->addLayout(buttonsLayout);
  mainLayout->addLayout(topLayout);

  QLabel *_transferOrdersLit = new QLabel(tr("Transfer Orders:"), this);
  _transferOrdersLit->setObjectName("_transferOrdersLit");
  listLayout->addWidget(_transferOrdersLit);

  _to = new XTreeWidget(this);
  _to->setObjectName("_to");
  listLayout->addWidget(_to);
  mainLayout->addLayout(listLayout);

  resize( QSize(490, 390).expandedTo(minimumSizeHint()) );

  connect(_close,	SIGNAL(clicked()), this,    SLOT( reject() ) );
  connect(_dstwhs,	SIGNAL(updated()), this,    SLOT( sFillList() ) );
  connect(_select,	SIGNAL(clicked()), this,    SLOT( sSelect() ) );
  connect(_srcwhs,	SIGNAL(updated()), this,    SLOT( sFillList() ) );
  connect(_to,	      SIGNAL(valid(bool)), _select, SLOT( setEnabled(bool) ) );
  connect(_to,	SIGNAL(itemSelected(int)), _select, SLOT( animateClick() ) );

  _to->addColumn(tr("Order #"), _orderColumn, Qt::AlignLeft,  true, "tohead_number");
  _to->addColumn(tr("From Whs."),         -1, Qt::AlignLeft,  true, "tohead_srcname");
  _to->addColumn(tr("To Whs."), _orderColumn, Qt::AlignLeft,  true, "tohead_destname");
  _to->addColumn(tr("Ordered"),  _dateColumn, Qt::AlignCenter, true, "tohead_orderdate");
  _to->addColumn(tr("Scheduled"),_dateColumn, Qt::AlignCenter,true, "scheddate");

  setTabOrder(_srcwhs,	_dstwhs);
  setTabOrder(_dstwhs,	_to);
  setTabOrder(_to,	_select);
  setTabOrder(_select,	_close);
  setTabOrder(_close,	_srcwhs);
  _srcwhs->setFocus();
}
示例#29
0
BitcoinGUI::BitcoinGUI(QWidget *parent):
    QMainWindow(parent),
    clientModel(0),
    walletModel(0),
    encryptWalletAction(0),
    changePassphraseAction(0),
    unlockWalletAction(0),
    lockWalletAction(0),
    aboutQtAction(0),
    trayIcon(0),
    notificator(0),
    rpcConsole(0)
{
    resize(1000, 520);
    //setFixedSize(1040, 560);
    setWindowTitle(tr("Roscoin") + " - " + tr("Wallet"));


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

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

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

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

    // Create application menu bar
    createMenuBar();

    // Create the toolbars
   // createToolBars();

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

    // Create tabs
    overviewPage = new OverviewPage();

    blockBrowser = new BlockBrowser(this);

    statisticsPage = new StatisticsPage(this);

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

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

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

    sendCoinsPage = new SendCoinsDialog(this);

    signVerifyMessageDialog = new SignVerifyMessageDialog(this);

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

    setCentralWidget(centralWidget);

    // Create status bar
    statusBar();

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

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

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

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

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

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

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

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

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

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

    gotoOverviewPage();
}
void
QvisFileSelectionWindow::CreateWindowContents()
{   
    CreateHostPathFilterControls();

    // Add a grid layout for the file and directory lists.

    QSplitter *listSplitter = new QSplitter(central);
    listSplitter->setOrientation(Qt::Horizontal);
    topLayout->addWidget(listSplitter);

    //
    // Create the directory list.
    //
    QWidget *directoryWidget = new QWidget(listSplitter);
    QVBoxLayout *directoryVBox = new QVBoxLayout(directoryWidget);
    directoryVBox->setMargin(0);
    directoryVBox->addWidget(new QLabel(tr("Directories"), directoryWidget));
    directoryList = new QListWidget(directoryWidget);
    directoryVBox->addWidget(directoryList);
    int minColumnWidth = fontMetrics().width("X");
    directoryList->setMinimumWidth(minColumnWidth * 20);
    
    connect(directoryList, SIGNAL(itemDoubleClicked(QListWidgetItem *)),
            this, SLOT(changeDirectory(QListWidgetItem *)));
    connect(directoryList, SIGNAL(itemActivated(QListWidgetItem *)),
            this, SLOT(changeDirectory(QListWidgetItem *)));
    
    //
    // Create the file list.
    //
    QWidget     *fileWidget = new QWidget(listSplitter);
    QVBoxLayout *fileVBox = new QVBoxLayout(fileWidget);
    fileVBox->setMargin(0);
    fileVBox->addWidget(new QLabel(tr("Files"), listSplitter));
    fileList = CreateFileListWidget(listSplitter);
    fileVBox->addWidget(fileList);
    fileList->setSelectionMode(QAbstractItemView::ExtendedSelection);
    fileList->setMinimumWidth(minColumnWidth * 20);
    
    connect(fileList, SIGNAL(itemDoubleClicked(QListWidgetItem *)),
            this, SLOT(selectFileDblClick(QListWidgetItem *)));
    // connect(fileList, SIGNAL(itemActivated(QListWidgetItem *)),
    //        this, SLOT(selectFileReturnPressed(QListWidgetItem *)));
    connect(fileList, SIGNAL(itemSelectionChanged()),
            this, SLOT(selectFileChanged()));

    fileList->installEventFilter(this);

    //
    // Create the selection buttons.
    //
    QWidget     *selectWidget = new QWidget(listSplitter);
    QVBoxLayout *selectVBox = new QVBoxLayout(selectWidget);
    selectVBox->setMargin(0);
    selectButton = new QPushButton(tr("Select"), selectWidget);
    connect(selectButton, SIGNAL(clicked()), this, SLOT(selectFile()));
    selectButton->setEnabled(false);
    selectAllButton = new QPushButton(tr("Select all"), selectWidget);
    connect(selectAllButton, SIGNAL(clicked()), this, SLOT(selectAllFiles()));
    removeButton = new QPushButton(tr("Remove"), selectWidget);
    connect(removeButton, SIGNAL(clicked()), this, SLOT(removeFile()));
    removeButton->setEnabled(false);
    removeAllButton = new QPushButton(tr("Remove all"), selectWidget);
    connect(removeAllButton, SIGNAL(clicked()), this, SLOT(removeAllFiles()));
    groupButton = new QPushButton(tr("Group"), selectWidget);
    connect(groupButton, SIGNAL(clicked()), this, SLOT(groupFiles()));
    groupButton->setEnabled(false);     // Until we have some selections
    refreshButton = new QPushButton(tr("Refresh"), selectWidget);
    connect(refreshButton, SIGNAL(clicked()), this, SLOT(refreshFiles()));
    selectVBox->addWidget(selectButton);
    selectVBox->addWidget(selectAllButton);
    selectVBox->addWidget(removeButton);
    selectVBox->addWidget(removeAllButton);
    selectVBox->addWidget(groupButton);
    selectVBox->addWidget(refreshButton);
    listSplitter->addWidget(selectWidget);

    //
    // Create the selected file list.
    //
    QWidget     *selfileWidget = new QWidget(listSplitter);
    QVBoxLayout *selfileVBox= new QVBoxLayout(selfileWidget);
    selfileVBox->setMargin(0);
    
    selfileVBox->addWidget(new QLabel(tr("Selected files"), selfileWidget));
    selectedFileList = CreateFileListWidget(selfileWidget);
    selfileVBox->addWidget(selectedFileList);
    
    selectedFileList->setSelectionMode(QAbstractItemView::ExtendedSelection);
    selectedFileList->setMinimumWidth(minColumnWidth * 30);
    
    connect(selectedFileList, SIGNAL(itemSelectionChanged()),
            this, SLOT(selectedFileSelectChanged()));
    connect(selectedFileList, SIGNAL(itemActivated(QListWidgetItem *)),
            this, SLOT(removeSelectedFiles(QListWidgetItem *)));
    listSplitter->addWidget(selfileWidget);
            
    // Create the Ok button
    QHBoxLayout *buttonLayout = new QHBoxLayout();
    topLayout->addLayout(buttonLayout);
    QPushButton *okButton = new QPushButton(tr("OK"), central);
    connect(okButton, SIGNAL(clicked()), this, SLOT(okClicked()));
    buttonLayout->addStretch(10);
    buttonLayout->addWidget(okButton);

    // Create the Cancel button
    QPushButton *cancelButton = new QPushButton(tr("Cancel"), central);
    connect(cancelButton, SIGNAL(clicked()), this, SLOT(cancelClicked()));
    buttonLayout->addWidget(cancelButton);

    // Get the applied file list from the file server and store it in
    // the intermediateFile list.
    intermediateFileList = fileServer->GetAppliedFileList();
    
#if (defined(Q_WS_MACX) || defined(Q_OS_MAC)) && QT_VERSION >= 0x040800
    // On Mac with Qt 4.8, we run into problems with the window not
    // coming back fully after calling setEnabled(true) on the window.
    // As a workaround, we disable the central widget instead of the
    // window itself. This lets the host, path, and filter widgets work
    // after we connected to a remote computer.
    fileServer->SetProgressCallback(ProgressCallback, (void *)central);
#endif
}