static QPixmap
getStandardIcon(QMessageBox::Icon icon,
                int size,
                QWidget* widget)
{
    QStyle *style = widget ? widget->style() : QApplication::style();
    QIcon tmpIcon;

    switch (icon) {
    case QMessageBox::Information:
        tmpIcon = style->standardIcon(QStyle::SP_MessageBoxInformation, 0, widget);
        break;
    case QMessageBox::Warning:
        tmpIcon = style->standardIcon(QStyle::SP_MessageBoxWarning, 0, widget);
        break;
    case QMessageBox::Critical:
        tmpIcon = style->standardIcon(QStyle::SP_MessageBoxCritical, 0, widget);
        break;
    case QMessageBox::Question:
        tmpIcon = style->standardIcon(QStyle::SP_MessageBoxQuestion, 0, widget);
    default:
        break;
    }
    if ( !tmpIcon.isNull() ) {
        return tmpIcon.pixmap(size, size);
    }

    return QPixmap();
}
Example #2
0
PropertiesDialog::PropertiesDialog(const QWebdavUrlInfo & infos, QWidget * parent)
  : QDialog(parent)
{
  QStyle *style = QApplication::style();
  QIcon icon;

  setupUi(this);

  if (infos.isDir()) {
    icon = style->standardIcon(QStyle::SP_DirIcon);
    nameLabel->setText(QFileInfo(infos.name()).dir().dirName());
    typeLabel->setText(tr("Folder"));
  } else {
    icon = style->standardIcon(QStyle::SP_FileIcon);
    nameLabel->setText(QFileInfo(infos.name()).fileName());
    typeLabel->setText(infos.mimeType());
  }

  sizeLabel->setText(QString("%1").arg(infos.size()));
  createdAtLabel->setText(infos.createdAt().toString());
  lastModifiedLabel->setText(infos.lastModified().toString());

  iconLabel->setPixmap(icon.pixmap(64, 64));

  QString str;
  QTextStream text(&str);

  text << infos.propElement();
  textEdit->setText(str);
}
Example #3
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow),
    coordinatesIsNeeded(true)
{
    ui->setupUi(this);
    ui->enableGpsCheckbox->setChecked(coordinatesIsNeeded);
    ui->videoSlider->setEnabled(false);
    connect(ui->actionOpen, SIGNAL(triggered()), SLOT(openFile()));
    connect(&timer, SIGNAL(timeout()), this, SLOT(stepVideo()));
    connect(ui->videoSlider, SIGNAL(sliderMoved(int)), this, SLOT(startVideo(int)));
    connect(ui->videoSlider, SIGNAL(valueChanged(int)), this, SLOT(startVideo(int)));
    connect(ui->calcSpeedButton, SIGNAL(clicked()), this, SLOT(calculateSpeed()));
    connect(ui->enableGpsCheckbox, SIGNAL(stateChanged(int)), this, SLOT(changeGpsOutputState(int)));
    connect(ui->playPauseButton, SIGNAL(clicked()), this, SLOT(playPause()));
    connect(ui->stopButton, SIGNAL(clicked()), this, SLOT(stop()));
    connect(ui->actionExit, SIGNAL(triggered()), this, SLOT(close()));

    QStyle *pStyle = qApp->style();
    QIcon icon = pStyle->standardIcon(QStyle::SP_MediaPlay);
    ui->playPauseButton->setIcon(icon);

    icon = pStyle->standardIcon(QStyle::SP_MediaStop);
    ui->stopButton->setIcon(icon);

    connect(ui->actionAbout, SIGNAL(triggered()), this, SLOT(showAboutDialog()));
}
Example #4
0
QVariant RemuxQueueModel::getIcon(RemuxEntryState state)
{
	QVariant icon;
	QStyle *style = QApplication::style();

	switch (state) {
	case RemuxEntryState::Complete:
		icon = style->standardIcon(
			QStyle::SP_DialogApplyButton);
		break;

	case RemuxEntryState::InProgress:
		icon = style->standardIcon(
			QStyle::SP_ArrowRight);
		break;

	case RemuxEntryState::Error:
		icon = style->standardIcon(
			QStyle::SP_DialogCancelButton);
		break;

	case RemuxEntryState::InvalidPath:
		icon = style->standardIcon(
			QStyle::SP_MessageBoxWarning);
		break;
	}

	return icon;
}
Example #5
0
QAction* QWKPage::action(WebAction action) const
{
    if (action == QWKPage::NoWebAction || action >= WebActionCount)
        return 0;

    if (d->actions[action])
        return d->actions[action];

    QString text;
    QIcon icon;
    QStyle* style = qobject_cast<QApplication*>(QCoreApplication::instance())->style();
    bool checkable = false;

    switch (action) {
    case Back:
        text = contextMenuItemTagGoBack();
        icon = style->standardIcon(QStyle::SP_ArrowBack);
        break;
    case Forward:
        text = contextMenuItemTagGoForward();
        icon = style->standardIcon(QStyle::SP_ArrowForward);
        break;
    case Stop:
        text = contextMenuItemTagStop();
        icon = style->standardIcon(QStyle::SP_BrowserStop);
        break;
    case Reload:
        text = contextMenuItemTagReload();
        icon = style->standardIcon(QStyle::SP_BrowserReload);
        break;
    default:
        return 0;
        break;
    }

    if (text.isEmpty())
        return 0;

    QAction* a = new QAction(d->q);
    a->setText(text);
    a->setData(action);
    a->setCheckable(checkable);
    a->setIcon(icon);

    connect(a, SIGNAL(triggered(bool)), this, SLOT(_q_webActionTriggered(bool)));

    d->actions[action] = a;
    d->updateAction(action);
    return a;
}
void AMScanDatabaseImportWizardReviewRunsPage::initializePage()
{
	controller_->analyzeFacilitiesForDuplicates();
	controller_->analyzeRunsForDuplicates();

	runsFoundList_->clear();
	runsToMergeList_->clear();

	QStyle* style = QApplication::style();
	QIcon icon = style->standardIcon(QStyle::SP_DirIcon);

	QMap<int, int> runIdMapping = controller_->runIdMapping();
	QMapIterator<int, int> i(runIdMapping);
	while(i.hasNext()) {
		i.next();
		runsFoundList_->addItem(new QListWidgetItem(icon, controller_->runName(i.key())));
		if(i.value() != -1) {
			QListWidgetItem* item = new QListWidgetItem(icon, controller_->runName(i.key()));
			item->setData(Qt::UserRole, i.key());
			item->setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsEnabled | Qt::ItemIsSelectable);
			item->setData(Qt::CheckStateRole, false);
			runsToMergeList_->addItem(item);
		}
	}
}
//-----------------------------------------------------------------------------
qtConfirmationDialog::qtConfirmationDialog(
  const QString& askKey, QWidget* parent, Qt::WindowFlags flags)
  : QDialog(parent, flags), d_ptr(new qtConfirmationDialogPrivate)
{
  QTE_D(qtConfirmationDialog);

  d->AskKey = askKey;

  // Create UI
  d->UI.setupUi(this);
  this->setConfirmText("Continue");
  qtUtil::setStandardIcons(d->UI.buttonBox);

  // Set dialog icon
  QStyle* style = this->style();
  int iconSize = style->pixelMetric(QStyle::PM_MessageBoxIconSize, 0, this);
  QIcon icon = style->standardIcon(QStyle::SP_MessageBoxWarning, 0, this);
  QPixmap pixmap = icon.pixmap(iconSize, iconSize);
  d->UI.image->setPixmap(pixmap);
  d->UI.image->setFixedSize(pixmap.size());

  // Hide unneeded "don't ask" controls
  d->UI.noAsk->setHidden(askKey.isEmpty());
  d->UI.noAskSession->hide();
  d->UI.noAskEver->hide();
}
Example #8
0
CaptionFrame::CaptionFrame(QWidget *parent)
	: QFrame(parent)
{
	qfLogFuncFrame();
	setFrameShape(QFrame::StyledPanel);
	setFrameShadow(QFrame::Raised);
	QBoxLayout *ly = new QHBoxLayout(this);
	//ly->setMargin(0);
	ly->setContentsMargins(5, 1, 5, 1);
	ly->setSpacing(6);
	m_captionIconLabel = new QLabel();
		//captionLabel->setPixmap(icon.pixmap(32));
	ly->addWidget(m_captionIconLabel);

	m_captionLabel = new QLabel();
	ly->addWidget(m_captionLabel);
	ly->addStretch();
	m_closeButton = new QToolButton();
	m_closeButton->setVisible(false);
	QStyle *sty = style();
	m_closeButton->setIcon(sty->standardIcon(QStyle::SP_DialogDiscardButton));
	connect(m_closeButton, SIGNAL(clicked()), this, SIGNAL(closeButtonClicked()));
	m_closeButton->setAutoRaise(true);
	ly->addWidget(m_closeButton);
	setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Maximum);
	//setFrameStyle(StyleDefault);
	connect(this, &CaptionFrame::alertChanged, this, &CaptionFrame::update);
}
Example #9
0
void MainWindow::pause()
{
    timer.stop();

    QStyle *pStyle = qApp->style();
    QIcon icon = pStyle->standardIcon(QStyle::SP_MediaPlay);
    ui->playPauseButton->setIcon(icon);
}
Example #10
0
void MainWindow::resume()
{
    timer.start(frameDelay);

    QStyle *pStyle = qApp->style();
    QIcon icon = pStyle->standardIcon(QStyle::SP_MediaPause);
    ui->playPauseButton->setIcon(icon);
}
void CleanDialog::setFileList(const QString &workingDirectory, const QStringList &l)
{
    d->m_workingDirectory = workingDirectory;
    d->ui.groupBox->setTitle(tr("Repository: %1").
                             arg(QDir::toNativeSeparators(workingDirectory)));
    if (const int oldRowCount = d->m_filesModel->rowCount())
        d->m_filesModel->removeRows(0, oldRowCount);

    QStyle *style = QApplication::style();
    const QIcon folderIcon = style->standardIcon(QStyle::SP_DirIcon);
    const QIcon fileIcon = style->standardIcon(QStyle::SP_FileIcon);
    const QString diffSuffix = QLatin1String(".diff");
    const QString patchSuffix = QLatin1String(".patch");
    const QString proUserSuffix = QLatin1String(".pro.user");
    const QString qmlProUserSuffix = QLatin1String(".qmlproject.user");
    const QChar slash = QLatin1Char('/');
    // Do not initially check patches or 'pro.user' files for deletion.
    foreach(const QString &fileName, l) {
        const QFileInfo fi(workingDirectory + slash + fileName);
        const bool isDir = fi.isDir();
        QStandardItem *nameItem = new QStandardItem(QDir::toNativeSeparators(fileName));
        nameItem->setFlags(Qt::ItemIsUserCheckable|Qt::ItemIsEnabled);
        nameItem->setIcon(isDir ? folderIcon : fileIcon);
        const bool saveFile = !isDir && (fileName.endsWith(diffSuffix)
                                        || fileName.endsWith(patchSuffix)
                                        || fileName.endsWith(proUserSuffix)
                                        || fileName.endsWith(qmlProUserSuffix));
        nameItem->setCheckable(true);
        nameItem->setCheckState(saveFile ? Qt::Unchecked : Qt::Checked);
        nameItem->setData(QVariant(fi.absoluteFilePath()), fileNameRole);
        nameItem->setData(QVariant(isDir), isDirectoryRole);
        // Tooltip with size information
        if (fi.isFile()) {
            const QString lastModified = fi.lastModified().toString(Qt::DefaultLocaleShortDate);
            nameItem->setToolTip(tr("%1 bytes, last modified %2")
                                 .arg(fi.size()).arg(lastModified));
        }
        d->m_filesModel->appendRow(nameItem);
    }

    for (int c = 0; c < d->m_filesModel->columnCount(); c++)
        d->ui.filesTreeView->resizeColumnToContents(c);
}
void CMessageDialog::initializeUi( QMessageBox::Icon iconStyle ) {
  ui->setupUi(this);
  ui->label_2->setFrameShape( QFrame::NoFrame );

  connect( ui->btnOK, SIGNAL( clicked() ), this, SLOT( close() ) );
  connect( ui->btnCopy, SIGNAL( clicked() ), this, SLOT( copyToClipboard() ) );
  connect( ui->btnSave, SIGNAL( clicked() ), this, SLOT( save() ) );

  QMessageBox* mb = new QMessageBox();

  QStyle *style = mb ? mb->style() : QApplication::style();

  QIcon tmpIcon;

  switch( iconStyle ) {
    case QMessageBox::NoIcon:
      // Do nothing
      break;
    case QMessageBox::Information:
      tmpIcon = style->standardIcon( QStyle::SP_MessageBoxInformation );
      break;
    case QMessageBox::Warning:
      tmpIcon = style->standardIcon( QStyle::SP_MessageBoxWarning );
      break;
    case QMessageBox::Critical:
      tmpIcon = style->standardIcon( QStyle::SP_MessageBoxCritical );
      break;
    case QMessageBox::Question:
      tmpIcon = style->standardIcon( QStyle::SP_MessageBoxQuestion );
      break;
  }

  if( tmpIcon.isNull() )
    ui->label_2->setGeometry( ui->label_2->x(), ui->label_2->y(), 0, 0 );
  else {
    int iconSize = style->pixelMetric( QStyle::PM_MessageBoxIconSize, 0, mb );
    ui->label_2->setGeometry( ui->label_2->x(), ui->label_2->y(), iconSize, iconSize );
    ui->label_2->setPixmap( tmpIcon.pixmap( iconSize, iconSize ) );
  }

  delete mb;
}
Example #13
0
QPixmap TimedMessageBox::getIcon(TimedMessageBox::Icons icon)
{
    QStyle *style = this ? this->style() : QApplication::style();
    int iconSize = style->pixelMetric(QStyle::PM_MessageBoxIconSize, 0, this);
    QIcon tmpIcon;
    switch (icon) {
    case Infomation:
    tmpIcon = style->standardIcon(QStyle::SP_MessageBoxInformation, 0, this);
    break;
    case Warning:
    tmpIcon = style->standardIcon(QStyle::SP_MessageBoxWarning, 0, this);
    break;
    case Critical:
    tmpIcon = style->standardIcon(QStyle::SP_MessageBoxCritical, 0, this);
    break;
    }
    if (!tmpIcon.isNull())
        return tmpIcon.pixmap(iconSize, iconSize);
    return QPixmap();
}
Example #14
0
QRDialog::QRDialog(QWidget *parent, AccountData* dataFrom, AccountData* dataTo, int xrpValue) :
    QDialog(parent), ui(new Ui::QRDialog), dataFrom(dataFrom), dataTo(dataTo), xrpValue(xrpValue)
{
    setWindowFlags(windowFlags() & (~Qt::WindowContextHelpButtonHint));

    ui->setupUi(this);

    QSizePolicy policy(QSizePolicy::Preferred, QSizePolicy::Preferred);
    policy.setHeightForWidth(true);
    ui->qr->setSizePolicy(policy);

    QStyle *style = QApplication::style();
    ui->pushButton->setIcon(style->standardIcon(QStyle::SP_DialogApplyButton, 0, this));
    ui->pushButton_2->setIcon(style->standardIcon(QStyle::SP_BrowserReload, 0, this));
    ui->pushButton_3->setIcon(style->standardIcon(QStyle::SP_DialogCancelButton, 0, this));


    SetLabelTexts();
    GenerateQR();
}
Example #15
0
//#---------------------------------------------------------------------------#
//#------- PRIVATE -----------------------------------------------------------#
//#---------------------------------------------------------------------------#
void EditRelationName::initialise()
{
    QStyle* style = QApplication::style();
    QIcon icon = style->standardIcon(QStyle::SP_MessageBoxWarning);
    ui->nameAlert->setPixmap(icon.pixmap(20,20));

    QRegExp rx("([A-Za-z\\d\\_]*\\,){100}");
    QValidator *validator = new QRegExpValidator(rx, this);
    ui->nameEdit->setValidator(validator);

    ui->nameAlert->setVisible(false);
}
Example #16
0
//////////////////////////////////////////////////////////////
/// \brief QQPiniSearchWidget::QQPiniSearchWidget
/// \param parent
///
QQPiniSearchWidget::QQPiniSearchWidget(QWidget *parent) :
	QWidget(parent),
	ui(new Ui::QQPiniSearchWidget)
{
	ui->setupUi(this);

	m_oldFocusWidget = NULL;

	setAutoFillBackground(true);

	QStyle *currentStyle = style();

	ui->revSearchPB->setIcon(currentStyle->standardIcon(QStyle::SP_ArrowLeft));
	ui->fwdSearchPB->setIcon(currentStyle->standardIcon(QStyle::SP_ArrowRight));
	ui->stopSearchPB->setIcon(currentStyle->standardIcon(QStyle::SP_DialogCancelButton));

	connect(ui->stopSearchPB, SIGNAL(clicked()), this, SLOT(hide()));
	connect(ui->searchLineEdit, SIGNAL(textChanged(QString)), this, SLOT(searchTextChanged(QString)));
	connect(ui->searchLineEdit, SIGNAL(returnPressed()), this, SLOT(searchTextNextFwd()));
	connect(ui->fwdSearchPB, SIGNAL(clicked()), this, SLOT(searchTextNextFwd()));
	connect(ui->revSearchPB, SIGNAL(clicked()), this, SLOT(searchTextNextBwd()));
}
Example #17
0
ShutdownPrompt::ShutdownPrompt( QWidget *parent ) :
	QDialog( parent ),
	ui( new Ui::ShutdownPrompt ) {
	ui->setupUi( this );

	QStyle *style = this->style();
	int iconSize = style->pixelMetric( QStyle::PM_MessageBoxIconSize, 0, this );

	QIcon tmpIcon = style->standardIcon( QStyle::SP_MessageBoxQuestion, 0, this );

	ui->iconLabel->setPixmap( tmpIcon.pixmap( iconSize, iconSize ) );

	connect( ui->remember, SIGNAL( clicked() ), this, SLOT( remember() ) );
	connect( ui->dontRemember, SIGNAL( clicked() ), this, SLOT( dontRemember() ) );
}
Example #18
0
QIcon IconsLoader::getIcon(Icon icon) const
{
    QIcon result;
    QStyle* style = QApplication::style();

    auto it = m_icons.find(icon);
    assert(it != m_icons.end());

    const std::pair<const char *, QStyle::StandardPixmap>& info = it->second;

    if (QIcon::hasThemeIcon(info.first))
        result = QIcon::fromTheme(info.first);
    else if (info.second != QStyle::SP_CustomBase)
        result = style->standardIcon(info.second);

    return result;
}
Example #19
0
nsresult
nsIconChannel::Init(nsIURI* aURI)
{

  nsCOMPtr<nsIMozIconURI> iconURI = do_QueryInterface(aURI);
  NS_ASSERTION(iconURI, "URI is not an nsIMozIconURI");

  nsCAutoString stockIcon;
  iconURI->GetStockIcon(stockIcon);

  nsCAutoString iconSizeString;
  iconURI->GetIconSize(iconSizeString);

  PRUint32 desiredImageSize;
  iconURI->GetImageSize(&desiredImageSize);

  nsCAutoString iconStateString;
  iconURI->GetIconState(iconStateString);
  bool disabled = iconStateString.EqualsLiteral("disabled");

  QStyle::StandardPixmap sp_icon = (QStyle::StandardPixmap)0;
  nsCOMPtr <nsIGtkQtIconsConverter> converter = do_GetService("@mozilla.org/gtkqticonsconverter;1");
  if (converter) {
    PRInt32 res = 0;
    stockIcon.Cut(0,4);
    converter->Convert(stockIcon.get(), &res);
    sp_icon = (QStyle::StandardPixmap)res;
    // printf("ConvertIcon: icon:'%s' -> res:%i\n", stockIcon.get(), res);
  }
  if (!sp_icon)
    return NS_ERROR_FAILURE;

  QStyle *style = qApp->style();
  NS_ENSURE_TRUE(style, NS_ERROR_NULL_POINTER);
  QPixmap pixmap = style->standardIcon(sp_icon).pixmap(desiredImageSize, desiredImageSize, disabled?QIcon::Disabled:QIcon::Normal);
  QImage image = pixmap.toImage();

  return moz_qicon_to_channel(&image, iconURI,
                              getter_AddRefs(mRealChannel));
}
Example #20
0
// Construct a graphic box for a given column in the file including controls
// NOTE: Label used to be a label but is now a read only line edit
EditRow::EditRow(void)
{
    QStyle *style;
    style=QApplication::style();
   box=new QHBoxLayout();
   _label=new QLineEdit("");
   _label->setReadOnly(true);
   _label->setStyleSheet("QLineEdit { background: palette(window); border: none; }");
   _label->setMinimumWidth(64);
   box->addWidget(_label);
   _vButton=new QCSVPushButton(style->standardIcon(QStyle::SP_ArrowDown),"");
   _vButton->setFixedWidth(25);
   _vButton->setToolTip("Select a new record by this field");
   box->addWidget(_vButton);
   box->addWidget(_edit=new QCSVLineEdit());
   _eButton=new QCSVPushButton(QIcon(":/icons/edit-4.png"),"");
   _eButton->setFixedWidth(25);
   _eButton->setToolTip("Edit this field in a larger editor");
   box->addWidget(_eButton);
   box->setStretch(0,1);
   box->setStretch(2,3);

}
MainWindow::MainWindow() : QMainWindow()
{
    //CSS codes...
    this->setStyleSheet("background-color:gray;");
    //

    // add drop down menus
    QMenu*  fileMenu = menuBar()->addMenu( "&File" );
    //QMenu*  editMenu = menuBar()->addMenu( "&Edit" );
    //QMenu*  viewMenu = menuBar()->addMenu( "&View" );
    //menuBar()->addMenu( "&Simulate" );
    //menuBar()->addMenu( "&Help" );

    // create file menu options
    //QAction* newAction     = fileMenu->addAction( "&New",              this, SLOT(fileNew()) );
    //QAction* saveAction    = fileMenu->addAction( "&Save As...",       this, SLOT(fileSaveAs()) );
    //QAction* openAction    = fileMenu->addAction( "&Open ...",         this, SLOT(fileOpen()) );
    //fileMenu->addSeparator();
    //QAction* previewAction = fileMenu->addAction( "Print pre&view...", this, SLOT(filePrintPreview()) );
    //QAction* printAction   = fileMenu->addAction( "&Print...",         this, SLOT(filePrint()) );
    //fileMenu->addSeparator();
    fileMenu->addAction( "&Quit",             this, SLOT(close()) );
    //newAction->setShortcut( QKeySequence::New );
    //saveAction->setShortcut( QKeySequence::Save );
    //openAction->setShortcut( QKeySequence::Open );
    //printAction->setShortcut( QKeySequence::Print );

    // create undo stack and associated menu actions
    m_undoStack = new QUndoStack( this );
    m_undoView  = 0;
    //viewMenu->addAction( "Undo stack", this, SLOT(showUndoStack()) );
    QAction* undoAction = m_undoStack->createUndoAction( this );
    QAction* redoAction = m_undoStack->createRedoAction( this );
    undoAction->setShortcut( QKeySequence::Undo );
    redoAction->setShortcut( QKeySequence::Redo );
    //editMenu->addAction( undoAction );
    //editMenu->addAction( redoAction );

    // create toolbar, set icon size, and add actions
    //QToolBar*   toolBar = addToolBar( "Standard" );
    QStyle*     style   = this->style();
    QSize       size    = style->standardIcon(QStyle::SP_DesktopIcon).actualSize( QSize(99,99) );
    //toolBar->setIconSize( size );
    //newAction->setIcon( style->standardIcon(QStyle::SP_DesktopIcon) );
    //openAction->setIcon( style->standardIcon(QStyle::SP_DialogOpenButton) );
    //saveAction->setIcon( style->standardIcon(QStyle::SP_DialogSaveButton) );
    //previewAction->setIcon( style->standardIcon(QStyle::SP_FileDialogContentsView) );
    //printAction->setIcon( style->standardIcon(QStyle::SP_ComputerIcon) );
    //undoAction->setIcon( style->standardIcon(QStyle::SP_ArrowBack) );
    //redoAction->setIcon( style->standardIcon(QStyle::SP_ArrowForward) );
    //toolBar->addAction( newAction );
    //toolBar->addAction( openAction );
    //toolBar->addAction( saveAction );
    //toolBar->addSeparator();
    //toolBar->addAction( previewAction );
    //toolBar->addAction( printAction );
    //toolBar->addSeparator();
    //toolBar->addAction( undoAction );
    //toolBar->addAction( redoAction );

    // create scene and central widget view of scene
    m_scene               = new Scene( m_undoStack );
    QGraphicsView*   view = new QGraphicsView( m_scene );
    view->setAlignment( Qt::AlignLeft | Qt::AlignTop );
    view->setFrameStyle( 0 );
    setCentralWidget( view );

    // connect message signal from scene to showMessage slot
    connect( m_scene, SIGNAL(message(QString)), this, SLOT(showMessage(QString)) );

    // add status bar message
    statusBar()->showMessage("You are now attempting in vain to evade several murderous asteroids. Survive if possible. ");

    //sets window size by default
    setFixedSize(WINDOW_WIDTH, WINDOW_HEIGHT);
}
Example #22
0
AddAccDialog::AddAccDialog(AccountData* accForEdit, Mode mode, QWidget *parent) :
	QDialog(parent), ui(new Ui::AddAccDialog), srcData(NULL), mode(mode), result(NULL)
{    
    setWindowFlags(windowFlags() & (~Qt::WindowContextHelpButtonHint));

    ui->setupUi(this);

    ui->infoQR->setEnabled(false);
    ui->accountQR->setEnabled(false);	
    QStyle *style = QApplication::style();
    ui->seqHelp->setIcon(style->standardIcon(QStyle::SP_MessageBoxQuestion, 0, this));

    switch(mode)
    {
        case edit:
            ui->status->setHidden(true);
            srcData = accForEdit;
            if (srcData)
            {
                this->setWindowTitle("Edit Account");
                ui->displayName->setText(srcData->GetName());
                ui->address->setText(srcData->GetAddr());
                ui->address->setReadOnly(true);
                ui->sequence->setValue(srcData->GetSequence());                

                if (srcData->GetKey().isEmpty())
                {
                    ui->labelSequence->setHidden(true);
                    ui->seqHelp->setHidden(true);
                    ui->sequence->setHidden(true);
                    ui->infoQR->setHidden(true);
                    ui->secretKey->setHidden(true);
                    ui->labelSecret->setHidden(true);
                }
                else
                {
                    ui->secretKey->setEchoMode(QLineEdit::PasswordEchoOnEdit);
                    ui->secretKey->setText(srcData->GetKey());
                    ui->secretKey->setReadOnly(true);
                }
            }
            break;
        case newGenerate:
            this->setWindowTitle("Generate new account");
            generateAddr();
            ui->labelSequence->setHidden(true);
            ui->seqHelp->setHidden(true);
            ui->sequence->setHidden(true);
            ui->infoQR->setHidden(true);
            ui->status->setText("New generated account becomes active once reserve amount of XRP is sent to generated address. WRITE DOWN THE SECRET KEY to prevent loosing access to this account!");
            ui->secretKey->setReadOnly(true);
            ui->address->setReadOnly(true);
            break;
        case newSender:
            this->setWindowTitle("Add Sender/Recipient account");
            ui->address->setEnabled(false);
            ui->address->setToolTip("Account address is generated from secret key.");
            break;
        case newRecipient:
            this->setWindowTitle("Add Recipient account");
            ui->secretKey->setHidden(true);
            ui->labelSecret->setHidden(true);
            ui->accountQR->setHidden(true);

            ui->labelSequence->setHidden(true);
            ui->seqHelp->setHidden(true);
            ui->sequence->setHidden(true);
            ui->infoQR->setHidden(true);            

            break;
    }    
    UpdateStatus();
    this->window()->resize(0,0);
}
QgsAuthSslErrorsDialog::QgsAuthSslErrorsDialog( QNetworkReply *reply,
    const QList<QSslError> &sslErrors,
    QWidget *parent,
    const QString &digest,
    const QString &hostport )
  : QDialog( parent )
  , mSslConfiguration( reply->sslConfiguration() )
  , mSslErrors( sslErrors )
  , mDigest( digest )
  , mHostPort( hostport )
{
  if ( mDigest.isEmpty() )
  {
    mDigest = QgsAuthCertUtils::shaHexForCert( mSslConfiguration.peerCertificate() );
  }
  if ( mHostPort.isEmpty() )
  {
    mHostPort = QStringLiteral( "%1:%2" )
                .arg( reply->url().host() )
                .arg( reply->url().port() != -1 ? reply->url().port() : 443 )
                .trimmed();
  }

  setupUi( this );
  connect( buttonBox, &QDialogButtonBox::clicked, this, &QgsAuthSslErrorsDialog::buttonBox_clicked );
  connect( btnChainInfo, &QToolButton::clicked, this, &QgsAuthSslErrorsDialog::btnChainInfo_clicked );
  connect( btnChainCAs, &QToolButton::clicked, this, &QgsAuthSslErrorsDialog::btnChainCAs_clicked );
  connect( grpbxSslErrors, &QgsCollapsibleGroupBoxBasic::collapsedStateChanged, this, &QgsAuthSslErrorsDialog::grpbxSslErrors_collapsedStateChanged );
  QStyle *style = QApplication::style();
  lblWarningIcon->setPixmap( style->standardIcon( QStyle::SP_MessageBoxWarning ).pixmap( 48, 48 ) );
  lblWarningIcon->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed );

  lblErrorsText->setStyleSheet( QStringLiteral( "QLabel{ font-weight: bold; }" ) );
  leUrl->setText( reply->request().url().toString() );

  ignoreButton()->setDefault( false );
  abortButton()->setDefault( true );

  if ( !QgsApplication::authManager()->isDisabled() )
  {
    saveButton()->setEnabled( false );

    saveButton()->setText( QStringLiteral( "%1 && %2" ).arg( saveButton()->text(),
                           ignoreButton()->text() ) );

    grpbxSslConfig->setChecked( false );
    grpbxSslConfig->setCollapsed( true );
    connect( grpbxSslConfig, &QGroupBox::toggled,
             this, &QgsAuthSslErrorsDialog::loadUnloadCertificate );

    connect( wdgtSslConfig, &QgsAuthSslConfigWidget::readyToSaveChanged,
             this, &QgsAuthSslErrorsDialog::widgetReadyToSaveChanged );
    wdgtSslConfig->setConfigCheckable( false );
    wdgtSslConfig->certificateGroupBox()->setFlat( true );
  }
  else
  {
    btnChainInfo->setVisible( false );
    btnChainCAs->setVisible( false );
    grpbxSslConfig->setVisible( false );
    saveButton()->setVisible( false );
  }

  populateErrorsList();
}
Example #24
0
void Test::init()
{
    QStyle *style = QApplication::style();
    icons << style->standardIcon(QStyle::SP_DriveFDIcon)
          << style->standardIcon(QStyle::SP_DesktopIcon)
          << style->standardIcon(QStyle::SP_TrashIcon)
          << style->standardIcon(QStyle::SP_ComputerIcon)
          << style->standardIcon(QStyle::SP_DriveFDIcon)
          << style->standardIcon(QStyle::SP_DriveHDIcon)
          << style->standardIcon(QStyle::SP_DriveCDIcon)
          << style->standardIcon(QStyle::SP_DriveDVDIcon)
          << style->standardIcon(QStyle::SP_DriveNetIcon)
          << style->standardIcon(QStyle::SP_DirHomeIcon)
          << style->standardIcon(QStyle::SP_DirOpenIcon)
          << style->standardIcon(QStyle::SP_DirClosedIcon)
          << style->standardIcon(QStyle::SP_DirIcon)
          << style->standardIcon(QStyle::SP_DirLinkIcon)
          << style->standardIcon(QStyle::SP_FileIcon);
}
FileDialogModelIconProvider::FileDialogModelIconProvider()
{
  QStyle* style = QApplication::style();
  m_folderLinkIcon = style->standardIcon(QStyle::SP_DirLinkIcon);
  m_fileLinkIcon = style->standardIcon(QStyle::SP_FileLinkIcon);
}
Example #26
0
File: Player.cpp Project: miuk/dsp
Player::Player(QWidget* parent)
{
    src = NULL;
    audio = NULL;
    volume = 10;
    elapsedSec = 0;
    layout = new QVBoxLayout(parent);
    QHBoxLayout* h = new QHBoxLayout(parent);
    layout->addLayout(h);

    // source name label
    QLabel* l = new QLabel(parent);
    l->setFont(QFont("Courier"));
    connect(this, SIGNAL(showElapsed(const QString&))
            , l, SLOT(setText(const QString&)));
    h->addWidget(l);

    // Play/Pause button
    QIcon ico;
    QStyle* style = QApplication::style();
    QIcon ic = style->standardIcon(QStyle::SP_MediaPlay);
    QPixmap px = ic.pixmap(16);
    ico.addPixmap(px, QIcon::Normal, QIcon::On);
    ic = style->standardIcon(QStyle::SP_MediaPause);
    px = ic.pixmap(16);
    ico.addPixmap(px, QIcon::Normal, QIcon::Off);
    QPushButton* b = new QPushButton(parent);
    b->setCheckable(true);
    b->setIcon(ico);
    connect(b, SIGNAL(toggled(bool)), this, SLOT(onPlayToggled(bool)));
    connect(this, SIGNAL(setEnabled(bool)), b, SLOT(setEnabled(bool)));
    connect(this, SIGNAL(setPaused(bool)), b, SLOT(setChecked(bool)));
    h->addWidget(b);

    // Stop button
    ico = style->standardIcon(QStyle::SP_MediaStop);
    b = new QPushButton(parent);
    b->setIcon(ico);
    connect(b, SIGNAL(clicked()), this, SLOT(onStopClicked()));
    connect(this, SIGNAL(setEnabled(bool)), b, SLOT(setEnabled(bool)));
    h->addWidget(b);

    // Volume slider
    ico = style->standardIcon(QStyle::SP_MediaVolume);
    l = new QLabel(parent);
    l->setPixmap(ico.pixmap(16));
    h->addWidget(l);
    QSlider* slider = new QSlider(Qt::Horizontal);
    connect(slider, SIGNAL(valueChanged(int)), this, SLOT(onVolumeChanged(int)));
    h->addWidget(slider);
    //QStyle::SP_MediaVolumeMuted

    QList<QAudioDeviceInfo> al = QAudioDeviceInfo::availableDevices(QAudio::AudioOutput);
    if (al.size() > 1) {
        QComboBox* cb = new QComboBox(parent);
        for (QList<QAudioDeviceInfo>::const_iterator i = al.begin();
             i != al.end(); i++) {
            const QAudioDeviceInfo& info = *i;
            cb->addItem(info.deviceName());
        }
        connect(cb, SIGNAL(currentIndexChanged(const QString&))
                , this, SLOT(onDeviceChanged(const QString&)));
        h->addWidget(cb);
    }
QgsAuthSslImportDialog::QgsAuthSslImportDialog( QWidget *parent )
    : QDialog( parent )
    , mSocket( nullptr )
    , mExecErrorsDialog( false )
    , mTimer( nullptr )
    , mSslErrors( QList<QSslError>() )
    , mTrustedCAs( QList<QSslCertificate>() )
    , mAuthNotifyLayout( nullptr )
    , mAuthNotify( nullptr )
{
  if ( QgsAuthManager::instance()->isDisabled() )
  {
    mAuthNotifyLayout = new QVBoxLayout;
    this->setLayout( mAuthNotifyLayout );
    mAuthNotify = new QLabel( QgsAuthManager::instance()->disabledMessage(), this );
    mAuthNotifyLayout->addWidget( mAuthNotify );
  }
  else
  {
    setupUi( this );
    QStyle *style = QApplication::style();
    lblWarningIcon->setPixmap( style->standardIcon( QStyle::SP_MessageBoxWarning ).pixmap( 48, 48 ) );
    lblWarningIcon->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed );

    closeButton()->setDefault( false );
    saveButton()->setEnabled( false );

    leServer->setSelection( 0, leServer->text().size() );
    pteSessionStatus->setReadOnly( true );
    spinbxTimeout->setValue( 15 );

    grpbxServer->setCollapsed( false );
    radioServerImport->setChecked( true );
    frameServerImport->setEnabled( true );
    radioFileImport->setChecked( false );
    frameFileImport->setEnabled( false );

    connect( radioServerImport, SIGNAL( toggled( bool ) ),
             this, SLOT( radioServerImportToggled( bool ) ) );
    connect( radioFileImport, SIGNAL( toggled( bool ) ),
             this, SLOT( radioFileImportToggled( bool ) ) );

    connect( leServer, SIGNAL( textChanged( QString ) ),
             this, SLOT( updateEnabledState() ) );
    connect( btnConnect, SIGNAL( clicked() ),
             this, SLOT( secureConnect() ) );
    connect( leServer, SIGNAL( returnPressed() ),
             btnConnect, SLOT( click() ) );

    connect( buttonBox, SIGNAL( accepted() ),
             this, SLOT( accept() ) );
    connect( buttonBox, SIGNAL( rejected() ),
             this, SLOT( reject() ) );

    connect( wdgtSslConfig, SIGNAL( readyToSaveChanged( bool ) ),
             this, SLOT( widgetReadyToSaveChanged( bool ) ) );
    wdgtSslConfig->setEnabled( false );

    mTrustedCAs = QgsAuthManager::instance()->getTrustedCaCertsCache();
  }
}
Example #28
0
QAction *QWebEnginePage::action(WebAction action) const
{
    Q_D(const QWebEnginePage);
    if (action == QWebEnginePage::NoWebAction)
        return 0;
    if (d->actions[action])
        return d->actions[action];

    QString text;
    QIcon icon;
    QStyle *style = d->view ? d->view->style() : qApp->style();

    switch (action) {
    case Back:
        text = tr("Back");
        icon = style->standardIcon(QStyle::SP_ArrowBack);
        break;
    case Forward:
        text = tr("Forward");
        icon = style->standardIcon(QStyle::SP_ArrowForward);
        break;
    case Stop:
        text = tr("Stop");
        icon = style->standardIcon(QStyle::SP_BrowserStop);
        break;
    case Reload:
        text = tr("Reload");
        icon = style->standardIcon(QStyle::SP_BrowserReload);
        break;
    case Cut:
        text = tr("Cut");
        break;
    case Copy:
        text = tr("Copy");
        break;
    case Paste:
        text = tr("Paste");
        break;
    case Undo:
        text = tr("Undo");
        break;
    case Redo:
        text = tr("Redo");
        break;
    case SelectAll:
        text = tr("Select All");
        break;
    case PasteAndMatchStyle:
        text = tr("Paste and Match Style");
        break;
    default:
        break;
    }

    QAction *a = new QAction(const_cast<QWebEnginePage*>(this));
    a->setText(text);
    a->setData(action);
    a->setIcon(icon);

    connect(a, SIGNAL(triggered(bool)), this, SLOT(_q_webActionTriggered(bool)));

    d->actions[action] = a;
    d->updateAction(action);
    return a;
}
Example #29
0
/* static */
QIcon UIIconPool::defaultIcon(UIDefaultIconType defaultIconType, const QWidget *pWidget /* = 0 */)
{
    QIcon icon;
    QStyle *pStyle = pWidget ? pWidget->style() : QApplication::style();
    switch (defaultIconType)
    {
        case UIDefaultIconType_MessageBoxInformation:
        {
            icon = pStyle->standardIcon(QStyle::SP_MessageBoxInformation, 0, pWidget);
            break;
        }
        case UIDefaultIconType_MessageBoxQuestion:
        {
            icon = pStyle->standardIcon(QStyle::SP_MessageBoxQuestion, 0, pWidget);
            break;
        }
        case UIDefaultIconType_MessageBoxWarning:
        {
#ifdef Q_WS_MAC
            /* At least in Qt 4.3.4/4.4 RC1 SP_MessageBoxWarning is the application
             * icon. So change this to the critical icon. (Maybe this would be
             * fixed in a later Qt version) */
            icon = pStyle->standardIcon(QStyle::SP_MessageBoxCritical, 0, pWidget);
#else /* Q_WS_MAC */
            icon = pStyle->standardIcon(QStyle::SP_MessageBoxWarning, 0, pWidget);
#endif /* !Q_WS_MAC */
            break;
        }
        case UIDefaultIconType_MessageBoxCritical:
        {
            icon = pStyle->standardIcon(QStyle::SP_MessageBoxCritical, 0, pWidget);
            break;
        }
        case UIDefaultIconType_DialogCancel:
        {
            icon = pStyle->standardIcon(QStyle::SP_DialogCancelButton, 0, pWidget);
            if (icon.isNull())
                icon = iconSet(":/cancel_16px.png");
            break;
        }
        case UIDefaultIconType_DialogHelp:
        {
            icon = pStyle->standardIcon(QStyle::SP_DialogHelpButton, 0, pWidget);
            if (icon.isNull())
                icon = iconSet(":/help_16px.png");
            break;
        }
        case UIDefaultIconType_ArrowBack:
        {
            icon = pStyle->standardIcon(QStyle::SP_ArrowBack, 0, pWidget);
            if (icon.isNull())
                icon = iconSet(":/list_moveup_16px.png",
                               ":/list_moveup_disabled_16px.png");
            break;
        }
        case UIDefaultIconType_ArrowForward:
        {
            icon = pStyle->standardIcon(QStyle::SP_ArrowForward, 0, pWidget);
            if (icon.isNull())
                icon = iconSet(":/list_movedown_16px.png",
                               ":/list_movedown_disabled_16px.png");
            break;
        }
        default:
        {
            AssertMsgFailed(("Unknown default icon type!"));
            break;
        }
    }
    return icon;
}
Example #30
0
MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow)
    , device()
    , model(this)
    , currentMode(ModeControl::Mode_Ch1)
    , calibDlg(&device, this)
{
    ui->setupUi(this);


    ui->channelControlCh1->setChannel(DeviceConstants::ADC_ch1);
    ui->channelControlCh2->setChannel(DeviceConstants::ADC_ch2);
    ui->widgetMeasurements->setModel(&model);

    QMap<QAction*, QStyle::StandardPixmap> buttonIcons;
    QStyle* s = QApplication::style();
    buttonIcons[ui->actionConnect] = QStyle::SP_MediaPlay;
    buttonIcons[ui->actionDisconnect] = QStyle::SP_MediaStop;
    buttonIcons[ui->actionAuto_connect] = QStyle::SP_BrowserReload;
    buttonIcons[ui->actionUse_real_hardware] = QStyle::SP_DriveHDIcon;
    buttonIcons[ui->actionUse_software_emulation] = QStyle::SP_ComputerIcon;

    QMapIterator<QAction*, QStyle::StandardPixmap> i(buttonIcons);
    while (i.hasNext()) {
        i.next();
        i.key()->setIcon(s->standardIcon(i.value()));
    }

    connect(&updateTimer, SIGNAL(timeout()), &device, SLOT(refresh()));
    connect(&sampleTimer, SIGNAL(timeout()), this, SLOT(sample()));
    connect(&device, SIGNAL(connected(QString, QString)), this, SLOT(deviceConnected(QString, QString)));
    connect(&device, SIGNAL(disconnected()), this, SLOT(deviceDisconnected()));
    connect(&device, SIGNAL(fatal(QString)), this, SLOT(fatal(QString)));

    connect(ui->channelControlCh1, SIGNAL(vdivSelected(DeviceConstants::VdivValues_t)), this, SLOT(VdivCh1Adjusted(DeviceConstants::VdivValues_t)));
    connect(ui->channelControlCh1, SIGNAL(vdivSelected(DeviceConstants::VdivValues_t)), &meas, SLOT(setVdiv_Ch1(DeviceConstants::VdivValues_t)));
    connect(ui->channelControlCh1, SIGNAL(acdcSelected(DeviceConstants::ACDC_t)), this, SLOT(ACDCCh1Adjusted(DeviceConstants::ACDC_t)));

    connect(ui->channelControlCh2, SIGNAL(vdivSelected(DeviceConstants::VdivValues_t)), this, SLOT(VdivCh2Adjusted(DeviceConstants::VdivValues_t)));
    connect(ui->channelControlCh2, SIGNAL(vdivSelected(DeviceConstants::VdivValues_t)), &meas, SLOT(setVdiv_Ch2(DeviceConstants::VdivValues_t)));
    connect(ui->channelControlCh2, SIGNAL(acdcSelected(DeviceConstants::ACDC_t)), this, SLOT(ACDCCh2Adjusted(DeviceConstants::ACDC_t)));

    connect(ui->triggerControl, SIGNAL(triggerSourceSelected(DeviceConstants::TriggerSource_t)), this, SLOT(triggerSourceSelected(DeviceConstants::TriggerSource_t)));
    connect(ui->triggerControl, SIGNAL(triggerModeSelected(DeviceConstants::TriggerMode_t)), this, SLOT(triggerModeSelected(DeviceConstants::TriggerMode_t)));

    connect(ui->dialTriggerLevel, SIGNAL(valueChanged(int)), this, SLOT(TriggerLevelAdjusted(int)));
    connect(ui->timeControl, SIGNAL(TdivChanged(DeviceConstants::TdivValues_t)), this, SLOT(TdivAdjusted(DeviceConstants::TdivValues_t)));
    connect(ui->timeControl, SIGNAL(TdivChanged(DeviceConstants::TdivValues_t)), &meas, SLOT(setTdiv(DeviceConstants::TdivValues_t)));

    connect(ui->actionExport_Data, SIGNAL(triggered()), this, SLOT(exportData()));
    connect(ui->modeControl, SIGNAL(modeSelected(ModeControl::Modes_t)), this, SLOT(modeSelectionChanged(ModeControl::Modes_t)));
    connect(ui->modeControl, SIGNAL(modeSelected(ModeControl::Modes_t)), ui->graphNorm, SLOT(modeSelectionChanged(ModeControl::Modes_t)));
    connect(ui->modeControl, SIGNAL(modeSelected(ModeControl::Modes_t)), ui->graphXY, SLOT(modeSelectionChanged(ModeControl::Modes_t)));
    connect(ui->modeControl, SIGNAL(modeSelected(ModeControl::Modes_t)), ui->graphFFT, SLOT(modeSelectionChanged(ModeControl::Modes_t)));
    connect(ui->modeControl, SIGNAL(modeSelected(ModeControl::Modes_t)), ui->graphAutoCorr, SLOT(modeSelectionChanged(ModeControl::Modes_t)));
    connect(ui->modeControl, SIGNAL(updateSelected(ModeControl::Update_t)), this, SLOT(updateSelectionChanged(ModeControl::Update_t)));
    connect(ui->modeControl, SIGNAL(singleShot()), this, SLOT(singleShot()));
    connect(ui->modeControl, SIGNAL(testSignalSelected(DeviceConstants::TestSignal_t)), this, SLOT(TestSignalSelectionChanged(DeviceConstants::TestSignal_t)));

    connect(ui->graphControl, SIGNAL(graphSelected(QMap<GraphControl::Graphs_t,bool>)), this, SLOT(graphSelectionChanged(QMap<GraphControl::Graphs_t,bool>)));
    connect(ui->actionCalibration_Dialog, SIGNAL(triggered()), &calibDlg, SLOT(show()));

    statusBar()->showMessage("Searching for device. Tip: try software emulation.");
    centralWidget()->setEnabled(false);
    updateTimer.start(2500);
    sampleTimer.setInterval(500);

//    QSqlDatabase
}