Пример #1
0
GUI::GUI() {
    mStreamingMode = STREAMING_MODE_STORE_ALL_FRAMES;
    QScreen* screen = QGuiApplication::primaryScreen();
    menuWidth = screen->geometry().width()*(1.0f/6.0f);
    mPipelineWidget = nullptr;
    mStreamer = ImageFileStreamer::New();

    QVBoxLayout* viewLayout = new QVBoxLayout;


    View* view = createView();
    view->set2DMode();
    view->setBackgroundColor(Color::Black());
    setWidth(screen->geometry().width());
    setHeight(screen->geometry().height());
    enableMaximized();
    setTitle("FAST - Viewer");
    viewLayout->addWidget(view);

    menuLayout = new QVBoxLayout;
    menuLayout->setAlignment(Qt::AlignTop);

    // Logo
    QImage* image = new QImage;
    image->load((Config::getDocumentationPath() + "images/FAST_logo_square.png").c_str());
    QLabel* logo = new QLabel;
    logo->setPixmap(QPixmap::fromImage(image->scaled(menuWidth, ((float)menuWidth/image->width())*image->height(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation)));
    logo->adjustSize();
    menuLayout->addWidget(logo);

    // Title label
    QLabel* title = new QLabel;
    title->setText("Viewer");
	QFont font;
	font.setPixelSize(24 * getScalingFactor());
	font.setWeight(QFont::Bold);
	title->setFont(font);
	title->setAlignment(Qt::AlignCenter);
    menuLayout->addWidget(title);

    // Quit button
    QPushButton* quitButton = new QPushButton;
    quitButton->setText("Quit (q)");
    quitButton->setStyleSheet("QPushButton { background-color: red; color: white; }");
    quitButton->setFixedWidth(menuWidth);
    menuLayout->addWidget(quitButton);

    // Connect the clicked signal of the quit button to the stop method for the window
    QObject::connect(quitButton, &QPushButton::clicked, std::bind(&Window::stop, this));

    QLabel* inputListLabel = new QLabel;
    //inputListLabel->setFixedHeight(24);
    inputListLabel->setText("Input data");
    inputListLabel->setStyleSheet("QLabel { font-weight: bold; }");
    menuLayout->addWidget(inputListLabel);

    mList = new QListWidget;
    mList->setFixedWidth(menuWidth);
    mList->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
    mList->setFixedHeight(200);
    mList->setSelectionMode(QAbstractItemView::ExtendedSelection); // Allow multiple items to be selected
    QObject::connect(mList, &QListWidget::itemSelectionChanged, std::bind(&GUI::selectInputData, this));
    menuLayout->addWidget(mList);

    QPushButton* addButton = new QPushButton;
    addButton->setText("Add input data");
    addButton->setFixedWidth(menuWidth);
    QObject::connect(addButton, &QPushButton::clicked, std::bind(&GUI::addInputData, this));
    menuLayout->addWidget(addButton);

    QLabel* selectPipelineLabel = new QLabel;
    selectPipelineLabel->setText("Active pipeline");
    selectPipelineLabel->setStyleSheet("QLabel { font-weight: bold; }");
    //selectPipelineLabel->setFixedHeight(24);
    menuLayout->addWidget(selectPipelineLabel);

    mSelectPipeline = new QComboBox;
    mSelectPipeline->setFixedWidth(menuWidth);
    mPipelines = getAvailablePipelines();
    int index = 0;
    int counter = 0;
    for(auto pipeline : mPipelines) {
        mSelectPipeline->addItem((pipeline.getName() + " (" + pipeline.getDescription() + ")").c_str());
        if(pipeline.getName() == "Image renderer") {
            index = counter;
        }
        ++counter;
    }
    mSelectPipeline->setCurrentIndex(index);

    menuLayout->addWidget(mSelectPipeline);
    QObject::connect(mSelectPipeline, static_cast<void (QComboBox::*)(int)>(&QComboBox::activated), std::bind(&GUI::selectPipeline, this));

    QPushButton* refreshPipeline = new QPushButton;
    refreshPipeline->setText("Refresh pipeline");
    refreshPipeline->setStyleSheet("QPushButton { background-color: blue; color: white; }");
    refreshPipeline->setFixedWidth(menuWidth);
    QObject::connect(refreshPipeline, &QPushButton::clicked, std::bind(&GUI::selectPipeline, this));
    menuLayout->addWidget(refreshPipeline);

    QPushButton* editPipeline = new QPushButton;
    editPipeline->setText("Edit pipeline");
    editPipeline->setStyleSheet("QPushButton { background-color: blue; color: white; }");
    editPipeline->setFixedWidth(menuWidth);
    QObject::connect(editPipeline, &QPushButton::clicked, std::bind(&GUI::editPipeline, this));
    menuLayout->addWidget(editPipeline);

    QPushButton* newPipeline = new QPushButton;
    newPipeline->setText("New pipeline");
    newPipeline->setStyleSheet("QPushButton { background-color: blue; color: white; }");
    newPipeline->setFixedWidth(menuWidth);
    QObject::connect(newPipeline, &QPushButton::clicked, std::bind(&GUI::newPipeline, this));
    menuLayout->addWidget(newPipeline);

    // Playback
    QHBoxLayout* playbackLayout = new QHBoxLayout;

    mPlayPauseButton = new QPushButton;
    mPlayPauseButton->setText("Play");
    mPlayPauseButton->setStyleSheet("QPushButton { background-color: green; color: white; }");
    //mPlayPauseButton->setFixedHeight(100);
    QObject::connect(mPlayPauseButton, &QPushButton::clicked, std::bind(&GUI::playPause, this));
    playbackLayout->addWidget(mPlayPauseButton);

    mTimestepSlider = new QSlider(Qt::Horizontal);
    // Improve style of slider
    mTimestepSlider->setStyleSheet("QSlider:horizontal { min-height: 50px; } QSlider::groove:horizontal {\n"
                                           "    border: 1px solid #999999;\n"
                                           "    height: 10px; /* the groove expands to the size of the slider by default. by giving it a height, it has a fixed size */\n"
                                           "    background: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #B1B1B1, stop:1 #c4c4c4);\n"
                                           "    margin: 2px 0;\n"
                                           "}\n"
                                           "\n"
                                           "QSlider::handle:horizontal {\n"
                                           "    background: qlineargradient(x1:0, y1:0, x2:1, y2:1, stop:0 #81BEF7, stop:1 #2E9AFE);\n"
                                           "    border: 1px solid #5c5c5c;\n"
                                           "    width: 18px;\n"
                                           "    height: 25px;\n"
                                           "    margin: -10px 0; /* handle is placed by default on the contents rect of the groove. Expand outside the groove */\n"
                                           "    border-radius: 3px;\n"
                                           "}");
    playbackLayout->addWidget(mTimestepSlider);
    mTimestepSlider->setTickPosition(QSlider::NoTicks);
    mTimestepSlider->setRange(0, 1234);
    mTimestepSlider->setPageStep(1);
    mTimestepSlider->setSingleStep(1);
    mTimestepSlider->setStyle(new MyStyle(mTimestepSlider->style())); // Fixes issues with direct jump with slider
    QObject::connect(mTimestepSlider, &QSlider::sliderMoved, std::bind(&GUI::setTimestep, this));
    QObject::connect(mTimestepSlider, &QSlider::sliderPressed, std::bind(&GUI::setTimestep, this));

    viewLayout->addLayout(playbackLayout);

    // Add menu and view to main layout
    QHBoxLayout* layout = new QHBoxLayout;
    layout->addLayout(menuLayout);
    layout->addLayout(viewLayout);

    mWidget->setLayout(layout);
	std::cout << "Finished viewer setup" << std::endl;

}
Пример #2
0
AdvPrefsPanel::AdvPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,
                        PrefsItemData * data ) :
                        QWidget( _parent ), p_intf( _p_intf )
{
    /* Find our module */
    module_t *p_module = NULL;
    p_config = NULL;
    if( data->i_type == PrefsItemData::TYPE_CATEGORY )
        return;
    else if( data->i_type == PrefsItemData::TYPE_MODULE )
        p_module = data->p_module;
    else
    {
        p_module = module_get_main();
        assert( p_module );
    }

    unsigned confsize;
    p_config = module_config_get( p_module, &confsize );
    module_config_t *p_item = p_config,
                    *p_end = p_config + confsize;

    if( data->i_type == PrefsItemData::TYPE_SUBCATEGORY ||
        data->i_type == PrefsItemData::TYPE_CATSUBCAT )
    {
        while (p_item < p_end)
        {
            if(  p_item->i_type == CONFIG_SUBCATEGORY &&
                 ( ( data->i_type == PrefsItemData::TYPE_SUBCATEGORY &&
                     p_item->value.i == data->i_object_id ) ||
                   ( data->i_type == PrefsItemData::TYPE_CATSUBCAT &&
                     p_item->value.i == data->i_subcat_id ) ) )
                break;
            p_item++;
        }
    }

    /* Widgets now */
    global_layout = new QVBoxLayout();
    global_layout->setMargin( 2 );
    QString head;
    QString help;

    help = QString( data->help );

    if( data->i_type == PrefsItemData::TYPE_SUBCATEGORY ||
        data->i_type == PrefsItemData::TYPE_CATSUBCAT )
    {
        head = QString( data->name );
        p_item++; // Why that ?
    }
    else
    {
        head = QString( qtr( module_GetLongName( p_module ) ) );
    }

    QLabel *titleLabel = new QLabel( head );
    QFont titleFont = QApplication::font();
    titleFont.setPointSize( titleFont.pointSize() + 6 );
    titleLabel->setFont( titleFont );

    // Title <hr>
    QFrame *title_line = new QFrame;
    title_line->setFrameShape(QFrame::HLine);
    title_line->setFrameShadow(QFrame::Sunken);

    QLabel *helpLabel = new QLabel( help, this );
    helpLabel->setWordWrap( true );

    global_layout->addWidget( titleLabel );
    global_layout->addWidget( title_line );
    global_layout->addWidget( helpLabel );

    QGroupBox *box = NULL;
    QGridLayout *boxlayout = NULL;

    QScrollArea *scroller= new QScrollArea;
    scroller->setFrameStyle( QFrame::NoFrame );
    QWidget *scrolled_area = new QWidget;

    QGridLayout *layout = new QGridLayout();
    int i_line = 0, i_boxline = 0;
    bool has_hotkey = false;

    if( p_item ) do
    {
        if( ( ( data->i_type == PrefsItemData::TYPE_SUBCATEGORY &&
                p_item->value.i != data->i_object_id ) ||
              ( data->i_type == PrefsItemData::TYPE_CATSUBCAT  &&
                p_item->value.i != data->i_subcat_id ) ) &&
            ( p_item->i_type == CONFIG_CATEGORY ||
              p_item->i_type == CONFIG_SUBCATEGORY ) )
            break;
        if( p_item->b_internal ) continue;

        if( p_item->i_type == CONFIG_SECTION )
        {
            if( box )
            {
                box->setLayout( boxlayout );
                box->show();
                layout->addWidget( box, i_line, 0, 1, -1 );
                i_line++;
            }
            box = new QGroupBox( qtr( p_item->psz_text ), this );
            box->hide();
            boxlayout = new QGridLayout();
        }
        /* Only one hotkey control */
        if( p_item->i_type == CONFIG_ITEM_KEY )
        {
            if( has_hotkey )
                continue;
            has_hotkey = true;
        }

        ConfigControl *control;
        if( ! box )
            control = ConfigControl::createControl( VLC_OBJECT( p_intf ),
                                        p_item, this, layout, i_line );
        else
            control = ConfigControl::createControl( VLC_OBJECT( p_intf ),
                                    p_item, this, boxlayout, i_boxline );
        if( !control )
            continue;

        if( box ) i_boxline++;
        else i_line++;
        controls.append( control );
    }
    while( !( ( data->i_type == PrefsItemData::TYPE_SUBCATEGORY ||
               data->i_type == PrefsItemData::TYPE_CATSUBCAT ) &&
             ( p_item->i_type == CONFIG_CATEGORY ||
               p_item->i_type == CONFIG_SUBCATEGORY ) )
        && ( ++p_item < p_end ) );

    if( box && i_boxline > 0 )
    {
        box->setLayout( boxlayout );
        box->show();
        layout->addWidget( box, i_line, 0, 1, -1 );
    }

    scrolled_area->setSizePolicy( QSizePolicy::Preferred,QSizePolicy::Fixed );
    scrolled_area->setLayout( layout );
    scroller->setWidget( scrolled_area );
    scroller->setWidgetResizable( true );
    global_layout->addWidget( scroller );
    setLayout( global_layout );
}
// Configuration widget
CMakeRunConfigurationWidget::CMakeRunConfigurationWidget(CMakeRunConfiguration *cmakeRunConfiguration, QWidget *parent)
    : QWidget(parent), m_ignoreChange(false), m_cmakeRunConfiguration(cmakeRunConfiguration)
{
    QFormLayout *fl = new QFormLayout();
    fl->setMargin(0);
    fl->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
    QLineEdit *argumentsLineEdit = new QLineEdit();
    argumentsLineEdit->setText(cmakeRunConfiguration->commandLineArguments());
    connect(argumentsLineEdit, SIGNAL(textChanged(QString)),
            this, SLOT(setArguments(QString)));
    fl->addRow(tr("Arguments:"), argumentsLineEdit);

    m_workingDirectoryEdit = new Utils::PathChooser();
    m_workingDirectoryEdit->setExpectedKind(Utils::PathChooser::Directory);
    m_workingDirectoryEdit->setBaseDirectory(m_cmakeRunConfiguration->target()->project()->projectDirectory());
    m_workingDirectoryEdit->setPath(m_cmakeRunConfiguration->baseWorkingDirectory());
    m_workingDirectoryEdit->setPromptDialogTitle(tr("Select Working Directory"));

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

    QHBoxLayout *boxlayout = new QHBoxLayout();
    boxlayout->addWidget(m_workingDirectoryEdit);
    boxlayout->addWidget(resetButton);

    fl->addRow(tr("Working directory:"), boxlayout);

    QCheckBox *runInTerminal = new QCheckBox;
    fl->addRow(tr("Run in Terminal"), runInTerminal);

    m_detailsContainer = new Utils::DetailsWidget(this);
    m_detailsContainer->setState(Utils::DetailsWidget::NoSummary);

    QWidget *m_details = new QWidget(m_detailsContainer);
    m_detailsContainer->setWidget(m_details);
    m_details->setLayout(fl);

    QVBoxLayout *vbx = new QVBoxLayout(this);
    vbx->setMargin(0);;
    vbx->addWidget(m_detailsContainer);

    QLabel *environmentLabel = new QLabel(this);
    environmentLabel->setText(tr("Run Environment"));
    QFont f = environmentLabel->font();
    f.setBold(true);
    f.setPointSizeF(f.pointSizeF() *1.2);
    environmentLabel->setFont(f);
    vbx->addWidget(environmentLabel);

    QWidget *baseEnvironmentWidget = new QWidget;
    QHBoxLayout *baseEnvironmentLayout = new QHBoxLayout(baseEnvironmentWidget);
    baseEnvironmentLayout->setMargin(0);
    QLabel *label = new QLabel(tr("Base environment for this runconfiguration:"), this);
    baseEnvironmentLayout->addWidget(label);
    m_baseEnvironmentComboBox = new QComboBox(this);
    m_baseEnvironmentComboBox->addItems(QStringList()
                                        << tr("Clean Environment")
                                        << tr("System Environment")
                                        << tr("Build Environment"));
    m_baseEnvironmentComboBox->setCurrentIndex(m_cmakeRunConfiguration->baseEnvironmentBase());
    connect(m_baseEnvironmentComboBox, SIGNAL(currentIndexChanged(int)),
            this, SLOT(baseEnvironmentComboBoxChanged(int)));
    baseEnvironmentLayout->addWidget(m_baseEnvironmentComboBox);
    baseEnvironmentLayout->addStretch(10);

    m_environmentWidget = new ProjectExplorer::EnvironmentWidget(this, baseEnvironmentWidget);
    m_environmentWidget->setBaseEnvironment(m_cmakeRunConfiguration->baseEnvironment());
    m_environmentWidget->setBaseEnvironmentText(m_cmakeRunConfiguration->baseEnvironmentText());
    m_environmentWidget->setUserChanges(m_cmakeRunConfiguration->userEnvironmentChanges());

    vbx->addWidget(m_environmentWidget);

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

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

    connect(runInTerminal, SIGNAL(toggled(bool)),
            this, SLOT(runInTerminalToggled(bool)));

    connect(m_environmentWidget, SIGNAL(userChangesChanged()),
            this, SLOT(userChangesChanged()));

    connect(m_cmakeRunConfiguration, SIGNAL(baseWorkingDirectoryChanged(QString)),
            this, SLOT(workingDirectoryChanged(QString)));
    connect(m_cmakeRunConfiguration, SIGNAL(baseEnvironmentChanged()),
            this, SLOT(baseEnvironmentChanged()));
    connect(m_cmakeRunConfiguration, SIGNAL(userEnvironmentChangesChanged(QList<Utils::EnvironmentItem>)),
            this, SLOT(userEnvironmentChangesChanged()));

    setEnabled(m_cmakeRunConfiguration->isEnabled());
}
QWidget *MemcheckErrorDelegate::createDetailsWidget(const QModelIndex &errorIndex, QWidget *parent) const
{
    QWidget *widget = new QWidget(parent);
    QVBoxLayout *layout = new QVBoxLayout;
    // code + white-space:pre so the padding (see below) works properly
    // don't include frameName here as it should wrap if required and pre-line is not supported
    // by Qt yet it seems
    const QString displayTextTemplate = QString("<code style='white-space:pre'>%1:</code> %2");

    QString relativeTo = relativeToPath();

    const Error error = errorIndex.data(ErrorListModel::ErrorRole).value<Error>();

    QLabel *errorLabel = new QLabel();
    errorLabel->setWordWrap(true);
    errorLabel->setContentsMargins(0, 0, 0, 0);
    errorLabel->setMargin(0);
    errorLabel->setIndent(0);
    QPalette p = errorLabel->palette();
    QColor lc = p.color(QPalette::Text);
    QString linkStyle = QString("style=\"color:rgba(%1, %2, %3, %4);\"")
                            .arg(lc.red()).arg(lc.green()).arg(lc.blue()).arg(int(0.7 * 255));
    p.setBrush(QPalette::Text, p.highlightedText());
    errorLabel->setPalette(p);
    errorLabel->setText(QString("%1&nbsp;&nbsp;<span %4>%2</span>")
                            .arg(error.what(), errorLocation(errorIndex, error, true, linkStyle),
                                 linkStyle));
    connect(errorLabel, SIGNAL(linkActivated(QString)), SLOT(openLinkInEditor(QString)));
    layout->addWidget(errorLabel);

    const QVector<Stack> stacks = error.stacks();
    for (int i = 0; i < stacks.count(); ++i) {
        const Stack &stack = stacks.at(i);
        // auxwhat for additional stacks
        if (i > 0) {
            QLabel *stackLabel = new QLabel(stack.auxWhat());
            stackLabel->setWordWrap(true);
            stackLabel->setContentsMargins(0, 0, 0, 0);
            stackLabel->setMargin(0);
            stackLabel->setIndent(0);
            QPalette p = stackLabel->palette();
            p.setBrush(QPalette::Text, p.highlightedText());
            stackLabel->setPalette(p);
            layout->addWidget(stackLabel);
        }
        int frameNr = 1;
        foreach (const Frame &frame, stack.frames()) {
            QString frameName = makeFrameName(frame, relativeTo);
            QTC_ASSERT(!frameName.isEmpty(), qt_noop());

            QLabel *frameLabel = new QLabel(widget);
            frameLabel->setAutoFillBackground(true);
            if (frameNr % 2 == 0) {
                // alternating rows
                QPalette p = frameLabel->palette();
                p.setBrush(QPalette::Base, p.alternateBase());
                frameLabel->setPalette(p);
            }
            frameLabel->setFont(QFont("monospace"));
            connect(frameLabel, SIGNAL(linkActivated(QString)), SLOT(openLinkInEditor(QString)));
            // pad frameNr to 2 chars since only 50 frames max are supported by valgrind
            const QString displayText = displayTextTemplate
                                            .arg(frameNr++, 2).arg(frameName);
            frameLabel->setText(displayText);

            frameLabel->setToolTip(Valgrind::XmlProtocol::toolTipForFrame(frame));
            frameLabel->setWordWrap(true);
            frameLabel->setContentsMargins(0, 0, 0, 0);
            frameLabel->setMargin(0);
            frameLabel->setIndent(10);
            layout->addWidget(frameLabel);
        }
    }

    layout->setContentsMargins(0, 0, 0, 0);
    layout->setSpacing(0);
    widget->setLayout(layout);
    return widget;
}
Пример #5
0
MainWindow::MainWindow( QWidget* parent )
: QMainWindow( parent ), ui( new Ui::MainWindow ),
  mSyslog( this ),
  mHide( false ),
  mStartupIdle( false ),
  mTerminating( false ),
  mTerminated( false ),
  mUpdateTimerID( 0 )
{
  ui->setupUi(this);
  this->setWindowFlags(
          Qt::Window
          | Qt::CustomizeWindowHint
          | Qt::WindowTitleHint
          | Qt::WindowSystemMenuHint
  );
  for( size_t i = 0; i < Preferences::numButtons; ++i )
  {
    QString idx;
    idx.setNum( i + 1 );
    mButtons[i] = findChild<QPushButton*>( "pushButton_Btn" + idx );
    new QShortcut( QKeySequence( "F" + idx ), mButtons[i], SLOT(click()), SLOT(click()), Qt::ApplicationShortcut );
  }
  new QShortcut( QKeySequence( tr("Ctrl+W") ), this, SLOT(CloseTopmostWindow()), NULL, Qt::ApplicationShortcut );
  // Avoid undesired side effects of key presses.
  QList<QPushButton*> pushButtons = findChildren<QPushButton*>();
  for( int i = 0; i < pushButtons.size(); ++i )
    pushButtons[i]->setFocusPolicy( Qt::NoFocus );

  ReadCommandLine();

  if( gpPreferences == NULL )
    gpPreferences = new Preferences;

  if( gpConnectionInfo == NULL )
  {
    gpConnectionInfo = new ConnectionInfo( this );
    gpConnectionInfo->setVisible( false );
  }

  QFont font = mButtons[0]->font();
  int standardFontSize = QFontInfo( font ).pixelSize(),
      standardWeight = QFontInfo( font ).weight();
  font.setPixelSize( ( standardFontSize * 150 ) / 100 );
  font.setWeight( QFont::DemiBold );
  ui->pushButton_Config->setFont( font );
  ui->pushButton_SetConfig->setFont( font );
  ui->pushButton_RunSystem->setFont( font );
  ui->pushButton_Quit->setFont( font );
  font.setPixelSize( ( standardFontSize * 84 ) / 100 );
  font.setWeight( standardWeight );

  int nStatusLabels = sizeof( mpStatusLabels ) / sizeof( *mpStatusLabels );
  for( int i = 0; i < nStatusLabels; ++i )
  {
    QLabel* pLabel = new QLabel( ui->statusBar );
#ifndef _WIN32
    pLabel->setFrameStyle( QFrame::Panel | QFrame::Sunken );
    pLabel->setFont( font );
#endif
    pLabel->setText( "N/A" );
    ui->statusBar->addWidget( pLabel, 1 );
    mpStatusLabels[i] = pLabel;
  }

  OperatorUtils::RestoreWidget( this );

  BCI_Initialize();

  BCI_SetCallback( BCI_OnSetConfig, BCI_Function( SetStartTime ), this );
  BCI_SetCallback( BCI_OnStart, BCI_Function( SetStartTime ), this );
  BCI_SetCallback( BCI_OnResume, BCI_Function( SetStartTime ), this );
  BCI_SetCallback( BCI_OnSuspend, BCI_Function( SetStartTime ), this );

  BCI_SetExternalCallback( BCI_OnQuitRequest, BCI_Function( OnQuitRequest ), this );
  BCI_SetExternalCallback( BCI_OnInitializeVis, BCI_Function( OnInitializeVis ), this );

  BCI_SetCallback( BCI_OnCoreInput, BCI_Function( OnCoreInput ), this );
  BCI_SetCallback( BCI_OnDebugMessage, BCI_Function( OnDebugMessage ), this );
  BCI_SetCallback( BCI_OnLogMessage, BCI_Function( OnLogMessage ), this );
  BCI_SetCallback( BCI_OnWarningMessage, BCI_Function( OnWarningMessage ), this );
  BCI_SetCallback( BCI_OnErrorMessage, BCI_Function( OnErrorMessage ), this );

  BCI_SetCallback( BCI_OnParameter, BCI_Function( OnParameter ), this );
  BCI_SetCallback( BCI_OnVisSignal, BCI_Function( OnVisSignal ), this );
  BCI_SetCallback( BCI_OnVisMemo, BCI_Function( OnVisMemo ), this );
  BCI_SetCallback( BCI_OnVisBitmap, BCI_Function( OnVisBitmap ), this );
  BCI_SetExternalCallback( BCI_OnVisPropertyMessage, BCI_Function( OnVisPropertyMessage ), this );
  BCI_SetExternalCallback( BCI_OnVisProperty, BCI_Function( OnVisProperty ), this );

  BCI_SetCallback( BCI_OnUnknownCommand, BCI_Function( OnUnknownCommand ), this );
  BCI_SetCallback( BCI_OnScriptHelp, BCI_Function( OnScriptHelp ), this );
  BCI_SetCallback( BCI_OnScriptError, BCI_Function( OnScriptError ), this );

  SetupScripts();

  if( mTelnet.length() )
    BCI_TelnetListen( mTelnet.toLocal8Bit().constData() );

  if( !mStartupIdle )
  {
    if( mStartup.length() )
      BCI_Startup( mStartup.toLocal8Bit().constData() );
    else
      BCI_Startup( "* SignalSource:4000 SignalProcessing:4001 Application:4002" );
  }

  if( mHide )
    this->hide();
  else
    this->show();

  mUpdateTimerID = this->startTimer( 100 );
  UpdateDisplay();
  SetFunctionButtons();
}
Пример #6
0
// ------------------------------------------------------
// CategoryDlg
CategoryDlg::CategoryDlg(QWidget *parent, QString name)
 : QDialog(parent, name, TRUE)
{
   QFont labelFont;
   labelFont.setBold(true);

   QBoxLayout* topLayout = new QVBoxLayout(this);
   QBoxLayout* row4Layout = new QHBoxLayout(topLayout);
   QBoxLayout* row3Layout = new QHBoxLayout(topLayout);
   QBoxLayout* row2Layout = new QHBoxLayout(topLayout);
   QBoxLayout* row1Layout = new QHBoxLayout(topLayout);
   QBoxLayout* row0Layout = new QHBoxLayout(topLayout);

   QLabel *colorLabel = new QLabel ("Color", this);
   colorLabel->setFont(labelFont);
   colorLabel->setAlignment(QLabel::AlignRight|QLabel::AlignVCenter);
   row1Layout->addWidget(colorLabel, 0, AlignLeft);

   m_Color = new QPushButton(this, "color");
   m_Color->setText("...");
   m_Color->setFont(labelFont);
   connect(m_Color, SIGNAL(clicked()),
	   this, SLOT(select_color()));
   row1Layout->addWidget(m_Color);

   QLabel *nameLabel = new QLabel ("Name", this);
   nameLabel->setFont(labelFont);
   nameLabel->setAlignment(QLabel::AlignLeft|QLabel::AlignVCenter);
   row4Layout->addWidget(nameLabel);

   m_Name = new QLineEdit(this, "Name");
   m_Name->setFont(labelFont);
   row4Layout->addWidget(m_Name);

   QLabel *filterLabel = new QLabel ("Filter", this);
   filterLabel->setFont(labelFont);
   filterLabel->setAlignment(QLabel::AlignLeft|QLabel::AlignVCenter);
   row3Layout->addWidget(filterLabel);

   m_Filter  = new QLineEdit(this, "Filter");
   m_Filter->setFont(labelFont);
   row3Layout->addWidget(m_Filter);

   QLabel *filteroutLabel = new QLabel ("FilterOut", this);
   filteroutLabel->setFont(labelFont);
   filteroutLabel->setAlignment(QLabel::AlignLeft|QLabel::AlignVCenter);
   row2Layout->addWidget(filteroutLabel);

   m_FilterOut  = new QLineEdit(this, "FilterOut");
   m_FilterOut->setFont(labelFont);
   row2Layout->addWidget(m_FilterOut);

   QPushButton *ok = new QPushButton("OK", this);
   row0Layout->addWidget(ok, 0, AlignLeft);

   QPushButton *cancel = new QPushButton("Cancel", this);
   row0Layout->addWidget(cancel, 0, AlignRight);

   // Hook on pressing the buttons
   connect(ok, SIGNAL(clicked()), SLOT(accept()));
   connect(cancel, SIGNAL(clicked()), SLOT(reject()));
}
Пример #7
0
MenuBarPopup::MenuBarPopup(Room* room)
	: Dialog(TApp::instance()->getMainWindow(), true, false, "CustomizeMenuBar")
{
	setWindowTitle(tr("Customize Menu Bar of Room \"%1\"").arg(room->getName()));
	
	/*- get menubar setting file path -*/
	std::string mbFileName = room->getPath().getName() + "_menubar.xml";
	TFilePath mbPath = ToonzFolder::getMyModuleDir() + mbFileName;
	
	m_commandListTree = new CommandListTree(this);
	m_menuBarTree = new MenuBarTree(mbPath, this);

	QPushButton *okBtn = new QPushButton(tr("OK"), this);
	QPushButton *cancelBtn = new QPushButton(tr("Cancel"), this);

	okBtn->setFocusPolicy(Qt::NoFocus);
	cancelBtn->setFocusPolicy(Qt::NoFocus);

	QLabel* menuBarLabel = new QLabel(tr("%1 Menu Bar").arg(room->getName()), this);
	QLabel* menuItemListLabel = new QLabel(tr("Menu Items"), this);
		
	QFont f("Arial", 15, QFont::Bold);
	menuBarLabel->setFont(f);
	menuItemListLabel->setFont(f);

	QLabel* noticeLabel = new QLabel(tr("N.B. If you put unique title to submenu, it may not be translated to another language.\nN.B. Duplicated commands will be ignored. Only the last one will appear in the menu bar."),this);
	QFont nf("Arial", 9, QFont::Normal);
	nf.setItalic(true);
	noticeLabel->setFont(nf);

	//--- layout
	QVBoxLayout* mainLay = new QVBoxLayout();
	m_topLayout->setMargin(0);
	m_topLayout->setSpacing(0);
	{
		QGridLayout* mainUILay = new QGridLayout();
		mainUILay->setMargin(5);
		mainUILay->setHorizontalSpacing(8);
		mainUILay->setVerticalSpacing(5);
		{
			mainUILay->addWidget(menuBarLabel, 0, 0);
			mainUILay->addWidget(menuItemListLabel, 0, 1);
			mainUILay->addWidget(m_menuBarTree, 1, 0);
			mainUILay->addWidget(m_commandListTree, 1, 1);

			mainUILay->addWidget(noticeLabel, 2, 0, 1, 2);
		}
		mainUILay->setRowStretch(0, 0);
		mainUILay->setRowStretch(1, 1);
		mainUILay->setRowStretch(2, 0);
		mainUILay->setColumnStretch(0, 1);
		mainUILay->setColumnStretch(1, 1);

		m_topLayout->addLayout(mainUILay, 1);
	}
		
	m_buttonLayout->setMargin(0);
	m_buttonLayout->setSpacing(30);
	{
		m_buttonLayout->addStretch(1);
		m_buttonLayout->addWidget(okBtn, 0);
		m_buttonLayout->addWidget(cancelBtn, 0);
		m_buttonLayout->addStretch(1);
	}

	//--- signal/slot connections

	bool ret = connect(okBtn, SIGNAL(clicked()), this, SLOT(onOkPressed()));
	ret = ret && connect(cancelBtn, SIGNAL(clicked()), this, SLOT(reject()));
	assert(ret);
}
Пример #8
0
KAstTopLevel::KAstTopLevel( QWidget *parent, const char *name )
    : Q3MainWindow( parent, name, 0 )
{
    QWidget *border = new QWidget( this );
    border->setBackgroundColor( Qt::black );
    setCentralWidget( border );

    Q3VBoxLayout *borderLayout = new Q3VBoxLayout( border );
    borderLayout->addStretch( 1 );

    QWidget *mainWin = new QWidget( border );
    mainWin->setFixedSize(640, 480);
    borderLayout->addWidget( mainWin, 0, Qt::AlignHCenter );

    borderLayout->addStretch( 1 );

    view = new KAsteroidsView( mainWin );
    view->setFocusPolicy( Qt::StrongFocus );
    connect( view, SIGNAL( shipKilled() ), SLOT( slotShipKilled() ) );
    connect( view, SIGNAL( rockHit(int) ), SLOT( slotRockHit(int) ) );
    connect( view, SIGNAL( rocksRemoved() ), SLOT( slotRocksRemoved() ) );
    connect( view, SIGNAL( updateVitals() ), SLOT( slotUpdateVitals() ) );

    Q3VBoxLayout *vb = new Q3VBoxLayout( mainWin );
    Q3HBoxLayout *hb = new Q3HBoxLayout;
    Q3HBoxLayout *hbd = new Q3HBoxLayout;
    vb->addLayout( hb );

    QFont labelFont( "helvetica", 24 );
    QColorGroup grp( Qt::darkGreen, Qt::black, QColor( 128, 128, 128 ),
	    QColor( 64, 64, 64 ), Qt::black, Qt::darkGreen, Qt::black );
    QPalette pal( grp, grp, grp );

    mainWin->setPalette( pal );

    hb->addSpacing( 10 );

    QLabel *label;
    label = new QLabel( tr("Score"), mainWin );
    label->setFont( labelFont );
    label->setPalette( pal );
    label->setFixedWidth( label->sizeHint().width() );
    hb->addWidget( label );

    scoreLCD = new QLCDNumber( 6, mainWin );
    scoreLCD->setFrameStyle( Q3Frame::NoFrame );
    scoreLCD->setSegmentStyle( QLCDNumber::Flat );
    scoreLCD->setFixedWidth( 150 );
    scoreLCD->setPalette( pal );
    hb->addWidget( scoreLCD );
    hb->addStretch( 10 );

    label = new QLabel( tr("Level"), mainWin );
    label->setFont( labelFont );
    label->setPalette( pal );
    label->setFixedWidth( label->sizeHint().width() );
    hb->addWidget( label );

    levelLCD = new QLCDNumber( 2, mainWin );
    levelLCD->setFrameStyle( Q3Frame::NoFrame );
    levelLCD->setSegmentStyle( QLCDNumber::Flat );
    levelLCD->setFixedWidth( 70 );
    levelLCD->setPalette( pal );
    hb->addWidget( levelLCD );
    hb->addStretch( 10 );

    label = new QLabel( tr("Ships"), mainWin );
    label->setFont( labelFont );
    label->setFixedWidth( label->sizeHint().width() );
    label->setPalette( pal );
    hb->addWidget( label );

    shipsLCD = new QLCDNumber( 1, mainWin );
    shipsLCD->setFrameStyle( Q3Frame::NoFrame );
    shipsLCD->setSegmentStyle( QLCDNumber::Flat );
    shipsLCD->setFixedWidth( 40 );
    shipsLCD->setPalette( pal );
    hb->addWidget( shipsLCD );

    hb->addStrut( 30 );

    vb->addWidget( view, 10 );

// -- bottom layout:
    vb->addLayout( hbd );

    QFont smallFont( "helvetica", 14 );
    hbd->addSpacing( 10 );

    QString sprites_prefix = ":/trolltech/examples/graphicsview/portedasteroids/sprites/";
/*
    label = new QLabel( tr( "T" ), mainWin );
    label->setFont( smallFont );
    label->setFixedWidth( label->sizeHint().width() );
    label->setPalette( pal );
    hbd->addWidget( label );

    teleportsLCD = new QLCDNumber( 1, mainWin );
    teleportsLCD->setFrameStyle( QFrame::NoFrame );
    teleportsLCD->setSegmentStyle( QLCDNumber::Flat );
    teleportsLCD->setPalette( pal );
    teleportsLCD->setFixedHeight( 20 );
    hbd->addWidget( teleportsLCD );

    hbd->addSpacing( 10 );
*/
    QPixmap pm( sprites_prefix + "powerups/brake.png" );
    label = new QLabel( mainWin );
    label->setPixmap( pm );
    label->setFixedWidth( label->sizeHint().width() );
    label->setPalette( pal );
    hbd->addWidget( label );

    brakesLCD = new QLCDNumber( 1, mainWin );
    brakesLCD->setFrameStyle( Q3Frame::NoFrame );
    brakesLCD->setSegmentStyle( QLCDNumber::Flat );
    brakesLCD->setPalette( pal );
    brakesLCD->setFixedHeight( 20 );
    hbd->addWidget( brakesLCD );

    hbd->addSpacing( 10 );

    pm.load( sprites_prefix + "powerups/shield.png" );
    label = new QLabel( mainWin );
    label->setPixmap( pm );
    label->setFixedWidth( label->sizeHint().width() );
    label->setPalette( pal );
    hbd->addWidget( label );

    shieldLCD = new QLCDNumber( 1, mainWin );
    shieldLCD->setFrameStyle( Q3Frame::NoFrame );
    shieldLCD->setSegmentStyle( QLCDNumber::Flat );
    shieldLCD->setPalette( pal );
    shieldLCD->setFixedHeight( 20 );
    hbd->addWidget( shieldLCD );

    hbd->addSpacing( 10 );

    pm.load( sprites_prefix + "powerups/shoot.png" );
    label = new QLabel( mainWin );
    label->setPixmap( pm );
    label->setFixedWidth( label->sizeHint().width() );
    label->setPalette( pal );
    hbd->addWidget( label );

    shootLCD = new QLCDNumber( 1, mainWin );
    shootLCD->setFrameStyle( Q3Frame::NoFrame );
    shootLCD->setSegmentStyle( QLCDNumber::Flat );
    shootLCD->setPalette( pal );
    shootLCD->setFixedHeight( 20 );
    hbd->addWidget( shootLCD );

    hbd->addStretch( 1 );

    label = new QLabel( tr( "Fuel" ), mainWin );
    label->setFont( smallFont );
    label->setFixedWidth( label->sizeHint().width() + 10 );
    label->setPalette( pal );
    hbd->addWidget( label );

    powerMeter = new KALedMeter( mainWin );
    powerMeter->setFrameStyle( Q3Frame::Box | Q3Frame::Plain );
    powerMeter->setRange( MAX_POWER_LEVEL );
    powerMeter->addColorRange( 10, Qt::darkRed );
    powerMeter->addColorRange( 20, QColor(160, 96, 0) );
    powerMeter->addColorRange( 70, Qt::darkGreen );
    powerMeter->setCount( 40 );
    powerMeter->setPalette( pal );
    powerMeter->setFixedSize( 200, 12 );
    hbd->addWidget( powerMeter );

    shipsRemain = 3;
    showHiscores = FALSE;

    actions.insert( Qt::Key_Up, Thrust );
    actions.insert( Qt::Key_Left, RotateLeft );
    actions.insert( Qt::Key_Right, RotateRight );
    actions.insert( Qt::Key_Space, Shoot );
    actions.insert( Qt::Key_Z, Teleport );
    actions.insert( Qt::Key_X, Brake );
    actions.insert( Qt::Key_S, Shield );
    actions.insert( Qt::Key_P, Pause );
    actions.insert( Qt::Key_L, Launch );
    actions.insert( Qt::Key_N, NewGame );

    view->showText( tr( "Press N to start playing" ), Qt::yellow );
}
Пример #9
0
FSBrowser::FSBrowser(QWidget *parent, FSBrowser::BrowseMode mode) : QWidget(parent)
{
	QLabel *label = NULL;

	_browseMode = mode;
	_viewType = FSBrowser::IconView;

	QGridLayout *layout = new QGridLayout(this);
	layout->setContentsMargins(12, 12, 0, 0);  //Position all file and folder elements asn recent file label
	setLayout(layout);
		
	switch(mode)
		
	{		
	case FSBrowser::BrowseRecentFiles:
		label = new QLabel("Recent Files");
		break;
		
	case FSBrowser::BrowseExamples:
		label = new QLabel("Examples");		
		break;
		
	case FSBrowser::BrowseCurrent:
		layout->addWidget(new QLabel(QString("Double-click on the file below to synchronize or use ") + getShortCutKey() + "-Y"));
		break;
		
	default:
		break;		
	}
	
	if (label)
	{
		QFont f= QFont("SansSerif");
		f.setPointSize(18);
		label->setFont(f);
		QSizePolicy sp = label->sizePolicy();
		sp.setHorizontalStretch(1);
		label->setSizePolicy(sp);
		label->setContentsMargins(0, 0, 0, 0);
		layout->addWidget(label);
	}
	
	_scrollArea = new VerticalScrollArea(this);
	_scrollArea->setFrameShape(QScrollArea::NoFrame);
	layout->addWidget(_scrollArea);

	_scrollPane = new QWidget;
	_scrollArea->setWidget(_scrollPane);

	_scrollPaneLayout = new QVBoxLayout(_scrollPane);
	_scrollPaneLayout->setSpacing(1);
	_scrollPaneLayout->setSizeConstraint(QLayout::SetMinAndMaxSize);
	_scrollPane->setLayout(_scrollPaneLayout);

	_buttonGroup = new QButtonGroup(this);

	_authWidget = new AuthWidget(this);
	_authWidget->hide();

	_processLabel = new QLabel(this);
	_processLabel->setAlignment(Qt::AlignCenter);
	_processLabel->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
	_processLabel->setMovie(new QMovie(":/icons/loading.gif", QByteArray(), _processLabel));
	_processLabel->setHidden(true);
	layout->addWidget(_processLabel);

	connect(_authWidget, SIGNAL(loginRequested(QString,QString)), this, SLOT(loginRequested(QString,QString)));
}
Пример #10
0
//
// user_edit_dialog
//
user_edit_dialog::user_edit_dialog(int role_oid)
{
  m_role_oid = role_oid;
  setWindowTitle(role_oid==0?tr("Add a database user"):tr("Edit a database user"));
  m_mode = (role_oid==0)?new_user:existing_user;

  user u;
  if (m_mode == existing_user)
    u.fetch_by_oid(role_oid);

  QVBoxLayout* top_layout = new QVBoxLayout;

  db_cnx db;
  QString dbname=QString(tr("Current database: <b>%1</b>")).arg(db.dbname().toHtmlEscaped());
  QLabel* ldb = new QLabel(dbname);
  ldb->setTextFormat(Qt::RichText);
  top_layout->addWidget(ldb, 0, Qt::AlignHCenter);

  QFormLayout* layout = new QFormLayout;
  m_fullname = new QLineEdit;
#ifdef PERM_LOGIN
  m_perm_login = new QCheckBox;
#endif
  m_perm_connect = new QCheckBox;
  m_registered = new QCheckBox;

  m_email = new QLineEdit;

  /* m_login, m_password and m_password2 should keep the same width
     even though m_password is part of a QHBoxLayout and the others
     are not (as they're tied to the outer QFormLayout). This is why
     they're implemented as instance of the "field_follow_size" class */

  m_login = new field_follow_size; //QLineEdit;
  m_login->setMaxLength(name_maxlength);
  m_password = new field_follow_size;
  m_password2 = new field_follow_size;
  connect(m_password, SIGNAL(resized(const QSize)),
	  m_password2, SLOT(follow_resize(const QSize)));
  connect(m_password, SIGNAL(resized(const QSize)),
	  m_login, SLOT(follow_resize(const QSize)));
  m_change_password_btn = new QCheckBox(tr("Change"));
  m_password->setEchoMode(QLineEdit::Password);
  m_password2->setEchoMode(QLineEdit::Password);
  m_password->setMaxLength(name_maxlength);
  m_password2->setMaxLength(name_maxlength);

  QHBoxLayout* vlpassw = new QHBoxLayout;
  vlpassw->addWidget(m_password);
  vlpassw->addWidget(m_change_password_btn);
  if (m_mode==existing_user) {
    m_password->setEnabled(false);
    m_password2->setEnabled(false);
    m_change_password_btn->setEnabled(true);
    connect(m_change_password_btn, SIGNAL(clicked()),
	    this, SLOT(enable_alter_user()));
  }
  else {
    m_change_password_btn->setEnabled(false);
  }

  m_qlist_roles = new QListWidget;

  QList<user> roles_list = users_repository::get_list();

  QList<QString> assigned_roles = user::granted_roles(m_role_oid);

  for (int ri=0; ri<roles_list.size(); ri++) {
    const user& u = roles_list.at(ri);
    if (!u.m_can_login && u.m_role_oid>0) {
      // keep only entries from pg_roles without the LOGIN privilege
      // they're supposed to be roles to assign rather than users
      QListWidgetItem* item = new QListWidgetItem(u.m_db_login, m_qlist_roles);
      item->setFlags(Qt::ItemIsUserCheckable|/*Qt::ItemIsSelectable|*/Qt::ItemIsEnabled);
      item->setCheckState(assigned_roles.indexOf(u.m_db_login) >= 0 ?
			  Qt::Checked : Qt::Unchecked);
    }
  }
  //  m_case_sensitive = new QCheckBox;
  m_custom1 = new custom_user_field;
  m_custom2 = new custom_user_field;
  m_custom3 = new custom_user_field;

  if (u.m_is_superuser) {
    QLabel* label = new QLabel(tr("<b>Superuser account: unrestricted permissions.</b>"));
    layout->addRow(QString(), label);
  }

  layout->addRow(tr("Login <sup>(*)</sup>:"), m_login);

  layout->addRow(tr("Password <sup>(*)</sup>:"), /*m_password*/ vlpassw);
  layout->addRow(tr("Retype password <sup>(*)</sup>:"), m_password2);
  /*
  m_password2->resize(QSize(m_password->width(), m_password2->height()));
  m_password2->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
  */
#ifdef PERM_LOGIN
  add_field_with_help(layout,
		       tr("Active <sup>(*)</sup>:"),
		       m_perm_login,
		       tr("The database role has the LOGIN capability."));
#endif

  add_field_with_help(layout,
		      tr("Can connect <sup>(**)</sup>:"),
		      m_perm_connect,
		      tr("The login has CONNECT permission on this database."));

  add_field_with_help(layout,
		      tr("Registered <sup>(**)</sup>:"),
		      m_registered,
		      tr("The user account corresponds to an operator in this database."));

  layout->addRow(tr("Operator name <sup>(*)</sup>:"), m_fullname);

  layout->addRow(tr("Groups <sup>(*)</sup>:"), m_qlist_roles);

  layout->addRow(tr("Custom field #1 <sup>(**)</sup>:"), m_custom1);
  layout->addRow(tr("Custom field #2 <sup>(**)</sup>:"), m_custom2);
  layout->addRow(tr("Custom field #3 <sup>(**)</sup>:"), m_custom3);

  top_layout->addLayout(layout);

  QLabel* lremark = new QLabel(tr("(*)  Fields marked with <sup>(*)</sup> apply across all databases of this server.<br>(**) Fields marked with <sup>(**)</sup> apply only to the current database: <b>%1</b>.").arg(db.dbname().toHtmlEscaped()));
  QFont smf = lremark->font();
  smf.setPointSize((smf.pointSize()*8)/10);
  lremark->setFont(smf);
  top_layout->addWidget(lremark);

  m_buttons = new QDialogButtonBox(QDialogButtonBox::Ok |
				   QDialogButtonBox::Cancel);
  top_layout->addWidget(m_buttons);
  connect(m_buttons, SIGNAL(accepted()), this, SLOT(accept()));
  connect(m_buttons, SIGNAL(rejected()), this, SLOT(reject()));

  setLayout(top_layout);

  m_user_id = 0;

  if (role_oid!=0) {
    /* set readOnly but not disabled because disabled is hard to read
       and the login is the major information */
    m_login->setReadOnly(true); //m_login->setEnabled(false);

    // u is loaded (for an existing role) at the top of the function
    m_user_id = u.m_user_id;
    m_fullname->setText(u.m_fullname);
    m_login->setText(u.m_login);
    m_initial_login = u.m_login;
    m_custom1->setPlainText(u.m_custom_field1);
    m_custom2->setPlainText(u.m_custom_field2);
    m_custom3->setPlainText(u.m_custom_field3);
#ifdef PERM_LOGIN
    m_perm_login->setChecked(u.m_can_login);
#endif
    m_perm_connect->setChecked(u.m_can_connect);
    m_registered->setChecked(u.m_user_id!=0);
  }

  connect(m_registered, SIGNAL(clicked()), this, SLOT(enable_fields()));
  enable_fields();
}
Пример #11
0
void QtHelpers::GenAdjustWidgetAppearanceToOS(QWidget *rootWidget)
{
    if (rootWidget == NULL)
            return;

        QObject *child = NULL;
        QObjectList Containers;
        QObject *container  = NULL;
        QStringList DoNotAffect;

        // Make an exception list (Objects not to be affected)
        DoNotAffect.append("aboutTitleLabel");     // about Dialog
        DoNotAffect.append("aboutVersionLabel");   // about Dialog
        DoNotAffect.append("aboutCopyrightLabel"); // about Dialog
        DoNotAffect.append("aboutUrlLabel");       // about Dialog
        DoNotAffect.append("aboutLicenseLabel");   // about Dialog

        // Set sizes according to OS:
    #ifdef __APPLE__
        int ButtonHeight = 35;
        int cmbxHeight = 30;
        QFont cntrlFont("Myriad Pro", 14);
        QFont txtFont("Myriad Pro", 14);
    #elif _WIN32 // Win XP/7
        int ButtonHeight = 24;
        int cmbxHeight = 20;
        QFont cntrlFont("MS Shell Dlg 2", 8);
        QFont txtFont("MS Shell Dlg 2", 8);
    #else
        int ButtonHeight = 24;
        int cmbxHeight = 24;
        QFont cntrlFont("Ubuntu Condensed", 10);
        QFont txtFont("Ubuntu", 10);
    #endif

        // Append root to containers
        Containers.append(rootWidget);
        while (!Containers.isEmpty())
        {
            container = Containers.takeFirst();
            if (container != NULL)
            {
                for (int ChIdx=0; ChIdx < container->children().size(); ChIdx++)
                {
                    child = container->children()[ChIdx];
                    if (!child->isWidgetType() || DoNotAffect.contains(child->objectName()))
                        continue;
                    // Append containers to Stack for recursion
                    if (child->children().size() > 0)
                        Containers.append(child);
                    else
                    {
                        // Cast child object to button and label
                        // (if the object is not of the correct type, it will be NULL)
                        QPushButton *button = qobject_cast<QPushButton *>(child);
                        QLabel *label = qobject_cast<QLabel *>(child);
                        QComboBox *cmbx = qobject_cast<QComboBox *>(child);
                        QLineEdit *ln = qobject_cast<QLineEdit *>(child);
                        QTreeWidget *tree = qobject_cast<QTreeWidget *>(child);
                        QPlainTextEdit *plain = qobject_cast<QPlainTextEdit *>(child);
                        QCheckBox *check = qobject_cast<QCheckBox *>(child);
                        if (button != NULL)
                        {
                            button->setMinimumHeight(ButtonHeight); // Win
                            button->setMaximumHeight(ButtonHeight); // Win
                            button->setFont(cntrlFont);
                        }
                        else if (cmbx != NULL)
                        {
                            cmbx->setFont(cntrlFont);
                            cmbx->setMaximumHeight(cmbxHeight);
                        }
                        else if (label != NULL)
                            label->setFont(txtFont);
                        else if (ln != NULL)
                            ln->setFont(txtFont);
                        else if (tree != NULL)
                        {
                            tree->header()->setFont(txtFont);
                        }
                        else if (plain != NULL)
                            plain->setFont(txtFont);
                        else if (check != NULL)
                            check->setFont(txtFont);
                    }
                }
            }
        }
}
Пример #12
0
/**
 * First Panel - Meta Info
 * All the usual MetaData are displayed and can be changed.
 **/
MetaPanel::MetaPanel( QWidget *parent,
                      intf_thread_t *_p_intf )
                      : QWidget( parent ), p_intf( _p_intf )
{
    QGridLayout *metaLayout = new QGridLayout( this );
    metaLayout->setVerticalSpacing( 0 );

    QFont smallFont = QApplication::font();
    smallFont.setPointSize( smallFont.pointSize() - 1 );
    smallFont.setBold( true );

    int line = 0; /* Counter for GridLayout */
    p_input = NULL;
    QLabel *label;

#define ADD_META( string, widget, col, colspan ) {                        \
    label = new QLabel( qtr( string ) ); label->setFont( smallFont );     \
    label->setContentsMargins( 3, 2, 0, 0 );                              \
    metaLayout->addWidget( label, line++, col, 1, colspan );              \
    widget = new QLineEdit;                                               \
    metaLayout->addWidget( widget, line, col, 1, colspan );               \
    CONNECT( widget, textEdited( QString ), this, enterEditMode() );      \
}

    /* Title, artist and album*/
    ADD_META( VLC_META_TITLE, title_text, 0, 10 ); line++;
    ADD_META( VLC_META_ARTIST, artist_text, 0, 10 ); line++;
    ADD_META( VLC_META_ALBUM, collection_text, 0, 7 );

    /* Date */
    label = new QLabel( qtr( VLC_META_DATE ) );
    label->setFont( smallFont ); label->setContentsMargins( 3, 2, 0, 0 );
    metaLayout->addWidget( label, line - 1, 7, 1, 2 );

    /* Date (Should be in years) */
    date_text = new QLineEdit;
    date_text->setAlignment( Qt::AlignRight );
    date_text->setInputMask("0000");
    date_text->setMaximumWidth( 128 );
    metaLayout->addWidget( date_text, line, 7, 1, -1 );
    line++;

    /* Genre Name */
    /* TODO List id3genres.h is not includable yet ? */
    ADD_META( VLC_META_GENRE, genre_text, 0, 7 );

    /* Number - on the same line */
    label = new QLabel( qtr( VLC_META_TRACK_NUMBER ) );
    label->setFont( smallFont ); label->setContentsMargins( 3, 2, 0, 0 );
    metaLayout->addWidget( label, line - 1, 7, 1, 3  );

    tracknumber_text = new QLineEdit;
    tracknumber_text->setAlignment( Qt::AlignRight );
    tracknumber_text->setInputMask("0000/0000");
    tracknumber_text->setMaximumWidth( 128 );
    metaLayout->addWidget( tracknumber_text, line, 7, 1, -1 );

    line++;

    /* Rating - on the same line */
    /*
    metaLayout->addWidget( new QLabel( qtr( VLC_META_RATING ) ), line, 4, 1, 2 );
    rating_text = new QSpinBox; setSpinBounds( rating_text );
    metaLayout->addWidget( rating_text, line, 6, 1, 1 );
    */

    /* Now Playing - Useful for live feeds (HTTP, DVB, ETC...) */
    ADD_META( VLC_META_NOW_PLAYING, nowplaying_text, 0, 7 );
    nowplaying_text->setReadOnly( true ); line--;

    /* Language on the same line */
    ADD_META( VLC_META_LANGUAGE, language_text, 7, -1 ); line++;
    ADD_META( VLC_META_PUBLISHER, publisher_text, 0, 7 ); line++;

    lblURL = new QLabel;
    lblURL->setOpenExternalLinks( true );
    lblURL->setTextFormat( Qt::RichText );
    metaLayout->addWidget( lblURL, line -1, 7, 1, -1 );

    ADD_META( VLC_META_COPYRIGHT, copyright_text, 0,  7 ); line++;

    /* ART_URL */
    art_cover = new CoverArtLabel( this, p_intf );
    metaLayout->addWidget( art_cover, line, 7, 6, 3, Qt::AlignLeft );

    ADD_META( VLC_META_ENCODED_BY, encodedby_text, 0, 7 ); line++;

    label = new QLabel( qtr( N_("Comments") ) ); label->setFont( smallFont );
    label->setContentsMargins( 3, 2, 0, 0 );
    metaLayout->addWidget( label, line++, 0, 1, 7 );
    description_text = new QTextEdit;
    description_text->setAcceptRichText( false );
    metaLayout->addWidget( description_text, line, 0, 1, 7 );
    // CONNECT( description_text, textChanged(), this, enterEditMode() ); //FIXME
    line++;

    /* VLC_META_SETTING: Useless */
    /* ADD_META( TRACKID )  Useless ? */
    /* ADD_URI - Do not show it, done outside */

    metaLayout->setColumnStretch( 1, 20 );
    metaLayout->setColumnMinimumWidth ( 1, 80 );
    metaLayout->setRowStretch( line, 10 );
#undef ADD_META

    CONNECT( tracknumber_text, textEdited( QString ), this, enterEditMode() );

    CONNECT( date_text, textEdited( QString ), this, enterEditMode() );
//    CONNECT( THEMIM->getIM(), artChanged( QString ), this, enterEditMode() );
/*    CONNECT( rating_text, valueChanged( QString ), this, enterEditMode( QString ) );*/

    /* We are not yet in Edit Mode */
    b_inEditMode = false;
}
Пример #13
0
PickerPopup::PickerPopup(DatePicker *picker)
    : QFrame(NULL, "calendar", WType_Popup | WStyle_Customize | WStyle_Tool | WDestructiveClose)
{
    m_picker = picker;

    setFrameShape(PopupPanel);
    setFrameShadow(Sunken);
    setLineWidth(1);

    QDate d = QDate::currentDate();
    QLabel *lbl = new QLabel(this);
    lbl->setBackgroundMode(PaletteBase);
    QVBoxLayout *l = new QVBoxLayout(this);
    QHBoxLayout *hLay = new QHBoxLayout(l);
    hLay->setMargin(0);
    hLay->setSpacing(4);

    m_monthBox = new MonthSpinBox(this);
    hLay->addWidget(m_monthBox);
    m_yearBox = new QSpinBox(this);
    m_yearBox->setMaxValue(d.year());
    m_yearBox->setMinValue(d.year() - 200);
    m_monthBox->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed));
    hLay->addWidget(m_yearBox);
    connect(m_monthBox, SIGNAL(valueChanged(int)), this, SLOT(monthChanged(int)));
    connect(m_yearBox, SIGNAL(valueChanged(int)), this, SLOT(yearChanged(int)));
    l->addWidget(lbl);
    l->setMargin(6);
    l->setSpacing(4);

    QPalette pal(palette());
    pal.setColor(QColorGroup::Text, QColor(127, 0, 0));
    pal.setColor(QColorGroup::Foreground, QColor(255, 0, 0));
    QFont f(font());
    f.setBold(true);

    m_labels = new QLabel*[7 * 6];
    QGridLayout *lay = new QGridLayout(lbl, 7, 7);
    lay->setMargin(6);
    lay->setSpacing(4);
    unsigned n = 0;
    for (unsigned j = 0; j < 6; j++) {
        for (unsigned i = 0; i < 7; i++) {
            QLabel *l = new PickerLabel(lbl);
            l->setFont(f);
            l->setAlignment(AlignRight);
            l->setText("99");
            l->setMinimumSize(l->sizeHint());
            l->setText(QString::number(n));
            l->setBackgroundMode(PaletteBase);
            lay->addWidget(l, i, j + 1);
            m_labels[n++] = l;
            if (i >= 5)
                l->setPalette(pal);
            connect(l, SIGNAL(clicked(PickerLabel*)), this, SLOT(dayClick(PickerLabel*)));
        }
    }
    for (unsigned i = 0; i < 7; i++) {
        QLabel *l = new QLabel(lbl);
        l->setFont(f);
        l->setText(i18n(day_name[i]));
        l->setBackgroundMode(PaletteBase);
        lay->addWidget(l, i, 0);
        if (i >= 5)
            l->setPalette(pal);
    }
    int month = m_picker->getDate().month();
    int year = m_picker->getDate().year();

    if ((month == 0) || (year == 0)) {
        month = d.month();
        year  = d.year();
    }
    m_monthBox->setValue(month - 1);
    m_yearBox->setValue(year);
    monthChanged(month - 1);
    yearChanged(year);
}
SensorWindow::SensorWindow() : QWidget() {
  QGridLayout *layout = new QGridLayout;

  QLabel* sensorLabel = new QLabel("Sensor");
  sensorLabel->setFont( QFont( "Arial", 10, QFont::Bold ) );
  
  QLabel* rawLabel = new QLabel("Raw");
  rawLabel->setFont( QFont( "Arial", 10, QFont::Bold ) );
  
  QLabel* rawDeltaLabel = new QLabel(QString::fromWCharArray(L"Raw Δ"));
  rawDeltaLabel->setFont( QFont( "Arial", 10, QFont::Bold ) );
  
  QLabel* processedLabel = new QLabel("Proc");
  processedLabel->setFont( QFont( "Arial", 10, QFont::Bold ) );
  
  QLabel* processedDeltaLabel = new QLabel(QString::fromWCharArray(L"Proc Δ"));
  processedDeltaLabel->setFont( QFont( "Arial", 10, QFont::Bold ) );

  QLabel* visionLabel = new QLabel("Vis");
  visionLabel->setFont( QFont( "Arial", 10, QFont::Bold ) );
  
  QLabel* visionDeltaLabel = new QLabel(QString::fromWCharArray(L"Vis Δ"));
  visionDeltaLabel->setFont( QFont( "Arial", 10, QFont::Bold ) );
  
  layout->addWidget(sensorLabel,0,0);
  layout->addWidget(rawLabel,0,1);
  layout->addWidget(rawDeltaLabel,0,2);
  layout->addWidget(processedLabel,0,3);
  layout->addWidget(processedDeltaLabel,0,4);
  layout->addWidget(visionLabel,0,5);
  layout->addWidget(visionDeltaLabel,0,6);
  
  sensorLabels = new QLabel[NUM_SENSORS];
  rawLabels = new QLabel[NUM_SENSORS];
  processedLabels = new QLabel[NUM_SENSORS];
  visionLabels = new QLabel[NUM_SENSORS];
  rawDeltaLabels = new QLabel[NUM_SENSORS];
  processedDeltaLabels = new QLabel[NUM_SENSORS];
  visionDeltaLabels = new QLabel[NUM_SENSORS];

  numSonarValues = 1;
  if (numSonarValues > NUM_SONAR_VALS) 
    numSonarValues = NUM_SONAR_VALS;

  sensorLeftSonarLabels = new QLabel[numSonarValues];
  sensorRightSonarLabels = new QLabel[numSonarValues];
  rawLeftSonarLabels = new QLabel[numSonarValues];
  rawRightSonarLabels = new QLabel[numSonarValues];
  processedLeftSonarLabels = new QLabel[numSonarValues];
  processedRightSonarLabels = new QLabel[numSonarValues];
  visionLeftSonarLabels = new QLabel[numSonarValues];
  visionRightSonarLabels = new QLabel[numSonarValues];

  float maxWidth = 40.0f;
  for(int i = 0; i < NUM_SENSORS; i++) {
    rawLabels[i].setMaximumWidth(maxWidth);
    processedLabels[i].setMaximumWidth(maxWidth);
    visionLabels[i].setMaximumWidth(maxWidth);

    rawDeltaLabels[i].setMaximumWidth(maxWidth);
    processedDeltaLabels[i].setMaximumWidth(maxWidth);
    visionDeltaLabels[i].setMaximumWidth(maxWidth);
  }

  for(int i = 0; i < numSonarValues; i++) {
    sensorLeftSonarLabels->setMaximumWidth(maxWidth); 
    sensorRightSonarLabels->setMaximumWidth(maxWidth); 
    rawLeftSonarLabels->setMaximumWidth(maxWidth); 
    rawRightSonarLabels->setMaximumWidth(maxWidth); 
    processedLeftSonarLabels->setMaximumWidth(maxWidth); 
    processedRightSonarLabels->setMaximumWidth(maxWidth); 
    visionLeftSonarLabels->setMaximumWidth(maxWidth); 
    visionRightSonarLabels->setMaximumWidth(maxWidth); 
  }

  int offset = 0;

  // set joints
  for (int i = 0; i < NUM_SENSORS; i++) {
    sensorLabels[i].setText(getSensorString((Sensor)i));
    rawLabels[i].setText(QString::number(0));
    processedLabels[i].setText(QString::number(0));
    visionLabels[i].setText(QString::number(0));

    // add to layout
    layout->addWidget(&sensorLabels[i], offset+i+1, 0);
    layout->addWidget(&rawLabels[i], offset+i+1, 1);
    layout->addWidget(&processedLabels[i], offset+i+1, 3);
    layout->addWidget(&visionLabels[i], offset+i+1, 5);
    
    if(i >= FIRST_ANGLE_SENSOR && i <= LAST_ANGLE_SENSOR) {
      rawDeltaLabels[i].setText(QString::number(0));
      processedDeltaLabels[i].setText(QString::number(0));
      visionDeltaLabels[i].setText(QString::number(0));
      
      layout->addWidget(&rawDeltaLabels[i], offset+i+1, 2);
      layout->addWidget(&processedDeltaLabels[i], offset+i+1, 4);
      layout->addWidget(&visionDeltaLabels[i], offset+i+1, 6);
    }
  }
  offset += NUM_SENSORS;

  // raw sonar values
  for (int i = 0; i < numSonarValues; i++) {
    sensorLeftSonarLabels[i].setText(QString("US/Left") + QString::number(i));
    rawLeftSonarLabels[i].setText(QString::number(0));
    processedLeftSonarLabels[i].setText(QString::number(0));
    visionLeftSonarLabels[i].setText(QString::number(0));
    // add to layout
    layout->addWidget(&sensorLeftSonarLabels[i], offset+i+1, 0);
    layout->addWidget(&rawLeftSonarLabels[i], offset+i+1, 1);
    layout->addWidget(&processedLeftSonarLabels[i], offset+i+1, 3);
    layout->addWidget(&visionLeftSonarLabels[i], offset+i+1, 5);
  }
  offset += numSonarValues;

  // raw sonar values - right 
  for (int i = 0; i < numSonarValues; i++) {
    sensorRightSonarLabels[i].setText(QString("US/Right") + QString::number(i));
    rawRightSonarLabels[i].setText(QString::number(0));
    processedRightSonarLabels[i].setText(QString::number(0));
    visionRightSonarLabels[i].setText(QString::number(0));
    // add to layout
    layout->addWidget(&sensorRightSonarLabels[i], offset+i+1, 0);
    layout->addWidget(&rawRightSonarLabels[i], offset+i+1, 1);
    layout->addWidget(&processedRightSonarLabels[i], offset+i+1, 3);
    layout->addWidget(&visionRightSonarLabels[i], offset+i+1, 5);
  }
  offset += numSonarValues;
  setLayout(layout);

  resize(120,200);

  setWindowTitle(tr("Sensors"));
}
Пример #15
0
InspectorNote::InspectorNote(QWidget* parent)
   : InspectorBase(parent)
      {
      b.setupUi(addWidget());
      n.setupUi(addWidget());
      c.setupUi(addWidget());
      s.setupUi(addWidget());

      static const int heads[] = {
            Note::HEAD_NORMAL,
            Note::HEAD_CROSS,
            Note::HEAD_DIAMOND,
            Note::HEAD_TRIANGLE,
            Note::HEAD_SLASH,
            Note::HEAD_XCIRCLE,
            Note::HEAD_DO,
            Note::HEAD_RE,
            Note::HEAD_MI,
            Note::HEAD_FA,
            Note::HEAD_SOL,
            Note::HEAD_LA,
            Note::HEAD_TI,
            Note::HEAD_BREVIS_ALT
            };

      //
      // fix order of note heads
      //
      for (int i = 0; i < Note::HEAD_GROUPS; ++i)
            n.noteHeadGroup->setItemData(i, QVariant(heads[i]));

      // noteHeadType starts at -1
      for (int i = 0; i < 5; ++i)
            n.noteHeadType->setItemData(i, i-1);

      iList = {
            { P_COLOR,          0, 0, b.color,         b.resetColor         },
            { P_VISIBLE,        0, 0, b.visible,       b.resetVisible       },
            { P_USER_OFF,       0, 0, b.offsetX,       b.resetX             },
            { P_USER_OFF,       1, 0, b.offsetY,       b.resetY             },

            { P_SMALL,          0, 0, n.small,         n.resetSmall         },
            { P_HEAD_GROUP,     0, 0, n.noteHeadGroup, n.resetNoteHeadGroup },
            { P_HEAD_TYPE,      0, 0, n.noteHeadType,  n.resetNoteHeadType  },
            { P_MIRROR_HEAD,    0, 0, n.mirrorHead,    n.resetMirrorHead    },
            { P_DOT_POSITION,   0, 0, n.dotPosition,   n.resetDotPosition   },
            { P_TUNING,         0, 0, n.tuning,        n.resetTuning        },
            { P_VELO_TYPE,      0, 0, n.velocityType,  n.resetVelocityType  },
            { P_VELO_OFFSET,    0, 0, n.velocity,      n.resetVelocity      },

            { P_USER_OFF,       0, 1, c.offsetX,       c.resetX             },
            { P_USER_OFF,       1, 1, c.offsetY,       c.resetY             },
            { P_SMALL,          0, 1, c.small,         c.resetSmall         },
            { P_NO_STEM,        0, 1, c.stemless,      c.resetStemless      },
            { P_STEM_DIRECTION, 0, 1, c.stemDirection, c.resetStemDirection },

            { P_LEADING_SPACE,  0, 2, s.leadingSpace,  s.resetLeadingSpace  },
            { P_TRAILING_SPACE, 0, 2, s.trailingSpace, s.resetTrailingSpace }
            };

      mapSignals();

      //
      // Select
      //
      QLabel* l = new QLabel;
      l->setText(tr("Select"));
      QFont font(l->font());
      font.setBold(true);
      l->setFont(font);
      l->setAlignment(Qt::AlignHCenter);
      _layout->addWidget(l);
      QFrame* f = new QFrame;
      f->setFrameStyle(QFrame::HLine | QFrame::Raised);
      f->setLineWidth(2);
      _layout->addWidget(f);

      QHBoxLayout* hbox = new QHBoxLayout;
      dot1 = new QToolButton(this);
      dot1->setText(tr("Dot1"));
      dot1->setEnabled(false);
      hbox->addWidget(dot1);
      dot2 = new QToolButton(this);
      dot2->setText(tr("Dot2"));
      dot2->setEnabled(false);
      hbox->addWidget(dot2);
      dot3 = new QToolButton(this);
      dot3->setText(tr("Dot3"));
      dot3->setEnabled(false);
      hbox->addWidget(dot3);
      hook = new QToolButton(this);
      hook->setText(tr("Hook"));
      hook->setEnabled(false);
      hbox->addWidget(hook);
      _layout->addLayout(hbox);

      hbox = new QHBoxLayout;
      stem = new QToolButton(this);
      stem->setText(tr("Stem"));
      stem->setEnabled(false);
      hbox->addWidget(stem);
      beam = new QToolButton(this);
      beam->setText(tr("Beam"));
      beam->setEnabled(false);
      hbox->addWidget(beam);
      _layout->addLayout(hbox);

      connect(dot1,     SIGNAL(clicked()),     SLOT(dot1Clicked()));
      connect(dot2,     SIGNAL(clicked()),     SLOT(dot2Clicked()));
      connect(dot3,     SIGNAL(clicked()),     SLOT(dot3Clicked()));
      connect(hook,     SIGNAL(clicked()),     SLOT(hookClicked()));
      connect(stem,     SIGNAL(clicked()),     SLOT(stemClicked()));
      connect(beam,     SIGNAL(clicked()),     SLOT(beamClicked()));
      }
Пример #16
0
ProfileForm::ProfileForm(QWidget *parent) :
    QWidget(parent)
{
    bodyUI = new Ui::IdentitySettings;
    bodyUI->setupUi(this);
    core = Core::getInstance();

    head = new QWidget(this);
    QHBoxLayout* headLayout = new QHBoxLayout();
    head->setLayout(headLayout);

    QLabel* imgLabel = new QLabel();
    headLayout->addWidget(imgLabel);

    QLabel* nameLabel = new QLabel();
    QFont bold;
    bold.setBold(true);
    nameLabel->setFont(bold);
    headLayout->addWidget(nameLabel);
    headLayout->addStretch(1);

    nameLabel->setText(tr("User Profile"));
    imgLabel->setPixmap(QPixmap(":/img/settings/identity.png").scaledToHeight(40, Qt::SmoothTransformation));

    // tox
    toxId = new ClickableTE();
    toxId->setReadOnly(true);
    toxId->setFrame(false);
    toxId->setFont(Style::getFont(Style::Small));
    toxId->setToolTip(bodyUI->toxId->toolTip());

    QVBoxLayout *toxIdGroup = qobject_cast<QVBoxLayout*>(bodyUI->toxGroup->layout());
    toxIdGroup->replaceWidget(bodyUI->toxId, toxId);
    bodyUI->toxId->hide();

    bodyUI->qrLabel->setWordWrap(true);

    profilePicture = new MaskablePixmapWidget(this, QSize(64, 64), ":/img/avatar_mask.svg");
    profilePicture->setPixmap(QPixmap(":/img/contact_dark.svg"));
    profilePicture->setClickable(true);
    connect(profilePicture, SIGNAL(clicked()), this, SLOT(onAvatarClicked()));
    QHBoxLayout *publicGrouplayout = qobject_cast<QHBoxLayout*>(bodyUI->publicGroup->layout());
    publicGrouplayout->insertWidget(0, profilePicture);
    publicGrouplayout->insertSpacing(1, 7);

    timer.setInterval(750);
    timer.setSingleShot(true);
    connect(&timer, &QTimer::timeout, this, [=]() {bodyUI->toxIdLabel->setText(bodyUI->toxIdLabel->text().replace(" ✔", "")); hasCheck = false;});

    connect(bodyUI->toxIdLabel, SIGNAL(clicked()), this, SLOT(copyIdClicked()));
    connect(toxId, SIGNAL(clicked()), this, SLOT(copyIdClicked()));
    connect(core, &Core::idSet, this, &ProfileForm::setToxId);
    connect(core, &Core::statusSet, this, &ProfileForm::onStatusSet);
    connect(bodyUI->userName, SIGNAL(editingFinished()), this, SLOT(onUserNameEdited()));
    connect(bodyUI->statusMessage, SIGNAL(editingFinished()), this, SLOT(onStatusMessageEdited()));
    connect(bodyUI->loadButton, &QPushButton::clicked, this, &ProfileForm::onLoadClicked);
    connect(bodyUI->renameButton, &QPushButton::clicked, this, &ProfileForm::onRenameClicked);
    connect(bodyUI->exportButton, &QPushButton::clicked, this, &ProfileForm::onExportClicked);
    connect(bodyUI->deleteButton, &QPushButton::clicked, this, &ProfileForm::onDeleteClicked);
    connect(bodyUI->importButton, &QPushButton::clicked, this, &ProfileForm::onImportClicked);
    connect(bodyUI->newButton, &QPushButton::clicked, this, &ProfileForm::onNewClicked);

    connect(core, &Core::avStart, this, &ProfileForm::disableSwitching);
    connect(core, &Core::avStarting, this, &ProfileForm::disableSwitching);
    connect(core, &Core::avInvite, this, &ProfileForm::disableSwitching);
    connect(core, &Core::avRinging, this, &ProfileForm::disableSwitching);
    connect(core, &Core::avCancel, this, &ProfileForm::enableSwitching);
    connect(core, &Core::avEnd, this, &ProfileForm::enableSwitching);
    connect(core, &Core::avEnding, this, &ProfileForm::enableSwitching);
    connect(core, &Core::avPeerTimeout, this, &ProfileForm::enableSwitching);
    connect(core, &Core::avRequestTimeout, this, &ProfileForm::enableSwitching);

    connect(core, &Core::usernameSet, this, [=](const QString& val) { bodyUI->userName->setText(val); });
    connect(core, &Core::statusMessageSet, this, [=](const QString& val) { bodyUI->statusMessage->setText(val); });

    for (QComboBox* cb : findChildren<QComboBox*>())
    {
            cb->installEventFilter(this);
            cb->setFocusPolicy(Qt::StrongFocus);
    }
}
Пример #17
0
NoteWidget::NoteWidget(QString title, QString text, QWidget *parent)
    : QWidget(parent)
{
	ui.setupUi(this);
	setBackgroundImage();
	this->setContentsMargins(0,0,0,0);
	
	/* create the GUI objects */
	backButton = new ButtonLabel(QPixmap(":/icons/backButton.png"), QPixmap(":/icons/backButtonPushed.png"), this);
	connect(backButton, SIGNAL(released()), this, SLOT(close()));
	quitButton = new ButtonLabel(QPixmap(":/icons/quitButton.png"), QPixmap(":/icons/quitButtonPushed.png"), this);
	connect(quitButton, SIGNAL(released()), QApplication::instance(), SLOT(quit()));
	patientIcon = new QLabel(this);
	patientIcon->setPixmap(QPixmap(":/icons/patientIcon.png"));
	
	/* initialize the footer object */
	footer = new ChangePatientFooter(this);
	
    QLabel *headerText = new QLabel(this);
    headerText->setStyleSheet("font-family: arial; font-weight: bold; font-size: 18px;");
    headerText->setText("<font color=\"#622181\">Paziente</font><font color=\"#9C9E9F\"> / </font><font color=\"#0B72B5\">Immagini</font>");
        
	QHBoxLayout *headerLayout = new QHBoxLayout();
	headerLayout->setContentsMargins(13, 13, 13, 0);
	headerLayout->addWidget(patientIcon);
	headerLayout->addSpacing(3);
	headerLayout->addWidget(headerText);
	headerLayout->setAlignment(headerText, Qt::AlignVCenter);
	headerLayout->addStretch();	
	headerLayout->addWidget(quitButton);
	
	QLabel *titleLabel = new QLabel("<font color=\"black\">Soggetto<br/></font> <font color=\"white\" >"+ title +"</font>", this);
	titleLabel->setMinimumHeight(100);
	titleLabel->setAutoFillBackground(true);
	titleLabel->setFont(QFont("helvetica"));
	titleLabel->setAlignment(Qt::AlignVCenter);
	QPalette titlePal(titleLabel->palette());
	titlePal.setColor(QPalette::Background, QColor(190,10,38));
	titleLabel->setPalette(titlePal);
	
	QLabel *note = new QLabel(text, this);
	note->setFont(QFont("helvetica"));
	QPalette notePal(note->palette());
	notePal.setColor(QPalette::Text, Qt::black);
	note->setPalette(notePal);
	note->setWordWrap(true);
	note->setAlignment(Qt::AlignJustify);
	note->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
	
	QScrollArea *scrollArea = new QScrollArea();
	scrollArea->setWidgetResizable(true);
	scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
	scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
	scrollArea->setWidget(note);
	scrollArea->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
	
	QVBoxLayout *mainLayout = new QVBoxLayout();
	mainLayout->addLayout(headerLayout);
	mainLayout->addWidget(titleLabel);
	
	QHBoxLayout *backHLayout = new QHBoxLayout();
	backHLayout->setContentsMargins(15, 0,0,0);
	backHLayout->addWidget(backButton);
	
	QHBoxLayout *scrollLayout = new QHBoxLayout();
	scrollLayout->addWidget(scrollArea);
	scrollLayout->setAlignment(scrollArea, Qt::AlignVCenter);
	mainLayout->addLayout(scrollLayout);
	mainLayout->addStretch(3);
	mainLayout->addLayout(backHLayout);
	mainLayout->addStretch(1);
	mainLayout->addWidget(footer);
			
	setLayout(mainLayout);
}
Пример #18
0
QmitkFastMarchingTool3DGUI::QmitkFastMarchingTool3DGUI() : QmitkToolGUI(), m_TimeIsConnected(false)
{
  this->setContentsMargins(0, 0, 0, 0);

  // create the visible widgets
  QVBoxLayout *widgetLayout = new QVBoxLayout(this);
  widgetLayout->setContentsMargins(0, 0, 0, 0);

  QFont fntHelp;
  fntHelp.setBold(true);

  QLabel *lblHelp = new QLabel(this);
  lblHelp->setText("Press shift-click to add seeds repeatedly.");
  lblHelp->setFont(fntHelp);

  widgetLayout->addWidget(lblHelp);

  // Sigma controls
  {
    QHBoxLayout *hlayout = new QHBoxLayout();
    hlayout->setSpacing(2);

    QLabel *lbl = new QLabel(this);
    lbl->setText("Sigma: ");
    hlayout->addWidget(lbl);

    QSpacerItem *sp2 = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
    hlayout->addItem(sp2);

    widgetLayout->addItem(hlayout);
  }

  m_slSigma = new ctkSliderWidget(this);
  m_slSigma->setMinimum(0.1);
  m_slSigma->setMaximum(5.0);
  m_slSigma->setPageStep(0.1);
  m_slSigma->setSingleStep(0.01);
  m_slSigma->setValue(1.0);
  m_slSigma->setTracking(false);
  m_slSigma->setToolTip("The \"sigma\" parameter in the Gradient Magnitude filter.");
  connect(m_slSigma, SIGNAL(valueChanged(double)), this, SLOT(OnSigmaChanged(double)));
  widgetLayout->addWidget(m_slSigma);

  // Alpha controls
  {
    QHBoxLayout *hlayout = new QHBoxLayout();
    hlayout->setSpacing(2);

    QLabel *lbl = new QLabel(this);
    lbl->setText("Alpha: ");
    hlayout->addWidget(lbl);

    QSpacerItem *sp2 = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
    hlayout->addItem(sp2);

    widgetLayout->addItem(hlayout);
  }

  m_slAlpha = new ctkSliderWidget(this);
  m_slAlpha->setMinimum(-10);
  m_slAlpha->setMaximum(0);
  m_slAlpha->setPageStep(0.1);
  m_slAlpha->setSingleStep(0.01);
  m_slAlpha->setValue(-2.5);
  m_slAlpha->setTracking(false);
  m_slAlpha->setToolTip("The \"alpha\" parameter in the Sigmoid mapping filter.");
  connect(m_slAlpha, SIGNAL(valueChanged(double)), this, SLOT(OnAlphaChanged(double)));
  widgetLayout->addWidget(m_slAlpha);

  // Beta controls
  {
    QHBoxLayout *hlayout = new QHBoxLayout();
    hlayout->setSpacing(2);

    QLabel *lbl = new QLabel(this);
    lbl->setText("Beta: ");
    hlayout->addWidget(lbl);

    QSpacerItem *sp2 = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
    hlayout->addItem(sp2);

    widgetLayout->addLayout(hlayout);
  }

  m_slBeta = new ctkSliderWidget(this);
  m_slBeta->setMinimum(0);
  m_slBeta->setMaximum(100);
  m_slBeta->setPageStep(0.1);
  m_slBeta->setSingleStep(0.01);
  m_slBeta->setValue(3.5);
  m_slBeta->setTracking(false);
  m_slBeta->setToolTip("The \"beta\" parameter in the Sigmoid mapping filter.");
  connect(m_slBeta, SIGNAL(valueChanged(double)), this, SLOT(OnBetaChanged(double)));
  widgetLayout->addWidget(m_slBeta);

  // stopping value controls
  {
    QHBoxLayout *hlayout = new QHBoxLayout();
    hlayout->setSpacing(2);

    QLabel *lbl = new QLabel(this);
    lbl->setText("Stopping value: ");
    hlayout->addWidget(lbl);

    QSpacerItem *sp2 = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
    hlayout->addItem(sp2);

    widgetLayout->addLayout(hlayout);
  }

  m_slStoppingValue = new ctkSliderWidget(this);
  m_slStoppingValue->setMinimum(0);
  m_slStoppingValue->setMaximum(10000);
  m_slStoppingValue->setPageStep(10);
  m_slStoppingValue->setSingleStep(1);
  m_slStoppingValue->setValue(2000);
  m_slStoppingValue->setDecimals(0);
  m_slStoppingValue->setTracking(false);
  m_slStoppingValue->setToolTip("The \"stopping value\" parameter in the fast marching 3D algorithm");
  connect(m_slStoppingValue, SIGNAL(valueChanged(double)), this, SLOT(OnStoppingValueChanged(double)));
  widgetLayout->addWidget(m_slStoppingValue);

  // threshold controls
  {
    QHBoxLayout *hlayout = new QHBoxLayout();
    hlayout->setSpacing(2);

    QLabel *lbl = new QLabel(this);
    lbl->setText("Threshold: ");
    hlayout->addWidget(lbl);

    QSpacerItem *sp2 = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
    hlayout->addItem(sp2);

    widgetLayout->addLayout(hlayout);
  }

  m_slwThreshold = new ctkRangeWidget(this);
  m_slwThreshold->setMinimum(-100);
  m_slwThreshold->setMaximum(5000);
  m_slwThreshold->setMinimumValue(-100);
  m_slwThreshold->setMaximumValue(2000);
  m_slwThreshold->setDecimals(0);
  m_slwThreshold->setTracking(false);
  m_slwThreshold->setToolTip("The lower and upper thresholds for the final thresholding");
  connect(m_slwThreshold, SIGNAL(valuesChanged(double, double)), this, SLOT(OnThresholdChanged(double, double)));
  widgetLayout->addWidget(m_slwThreshold);

  m_btClearSeeds = new QPushButton("Clear");
  m_btClearSeeds->setToolTip("Clear current result and start over again");
  widgetLayout->addWidget(m_btClearSeeds);
  connect(m_btClearSeeds, SIGNAL(clicked()), this, SLOT(OnClearSeeds()));

  m_btConfirm = new QPushButton("Confirm Segmentation");
  m_btConfirm->setToolTip("Incorporate current result in your working session.");
  m_btConfirm->setEnabled(false);
  widgetLayout->addWidget(m_btConfirm);
  connect(m_btConfirm, SIGNAL(clicked()), this, SLOT(OnConfirmSegmentation()));

  connect(this, SIGNAL(NewToolAssociated(mitk::Tool *)), this, SLOT(OnNewToolAssociated(mitk::Tool *)));

  this->setEnabled(false);

  m_slSigma->setDecimals(2);
  m_slBeta->setDecimals(2);
  m_slAlpha->setDecimals(2);
}
Пример #19
0
void SettingWidget::createValueWidget()
{
    rsArgument* argument = task->getArgument(option->name);
    
    switch(option->type) {
        case G_OPTION_ARG_FILENAME:
        case G_OPTION_ARG_STRING:
        case G_OPTION_ARG_STRING_ARRAY:
        case G_OPTION_ARG_CALLBACK:
        case G_OPTION_ARG_INT:
        case G_OPTION_ARG_INT64:
        case G_OPTION_ARG_DOUBLE:
            {
                // Display text box if number of values is not restricted
                if ( option->allowedValues == NULL ) {
                    if ( option->nLines < 2 ) {
                        QLineEdit *w = new QLineEdit();
                        valueWidget = w;
                        w->setPlaceholderText(option->cli_arg_description);
                        connect(w, SIGNAL(textChanged(QString)), this, SLOT(textChanged(QString)));
                        if ( argument != NULL ) {
                            w->setText(argument->value);
                        } else if ( option->defaultValue != NULL ) {
                            w->setText(option->defaultValue);
                        }
                    } else { // create a QTextEdit field instead
                        QPlainTextEdit *w = new QPlainTextEdit();
                        valueWidget = w;
                        connect(w, SIGNAL(textChanged()), this, SLOT(textChanged()));
                        if ( argument != NULL ) {
                            w->setPlainText(argument->value);
                        } else if ( option->defaultValue != NULL ) {
                            w->setPlainText(option->defaultValue);
                        }
                        QFontMetrics m(w->font()) ;
                        int rowHeight = m.lineSpacing() ;
                        w->setFixedHeight(option->nLines * rowHeight) ;
                        w->setLineWrapMode(QPlainTextEdit::NoWrap);
                    }
                } else { // if the allowed values are restricted display radio buttons instead
                    QWidget *w = new QWidget();
                    QBoxLayout *wLayout = new QBoxLayout(QBoxLayout::TopToBottom);
                    QButtonGroup *buttonGroup = new QButtonGroup();
                    buttonGroup->setExclusive(true);
                    valueWidget = w;
                    connect(buttonGroup, SIGNAL(buttonClicked(int)), this, SLOT(buttonClicked(int)));
                    
                    // go through all options and add a radio button for them
                    rsUIOptionValue** values = option->allowedValues;
                    for (size_t i=0; values[i] != NULL; i++ ) {
                        // add radio button
                        QRadioButton *b = new QRadioButton(QString("'")+QString(values[i]->name)+QString("'"));
                        QFont f("Arial", 12, QFont::Bold);
                        b->setFont(f);
                        buttonGroup->addButton(b, (int)i);
                        wLayout->addWidget(b);
                        
                        // set it to checked if it is the default or set value
                        b->setChecked(false);
                        if ( argument != NULL ) {
                            if ( ! strcmp(argument->value,values[i]->name) ) {
                                b->setChecked(true);
                            }
                        } else if ( ! strcmp(option->defaultValue,values[i]->name) ) {
                            b->setChecked(true);
                        }
                        
                        // add its description
                        QLabel *label = new QLabel(values[i]->description);
                        label->setIndent(22);
                        label->setWordWrap(true);
                        label->setContentsMargins(0, 0, 0, 4);
                        QFont f2("Arial", 11, QFont::Normal);
                        label->setFont(f2);
                        wLayout->addWidget(label);
                    }
                    w->setLayout(wLayout);
                }
            }
            break;
        /*
        case G_OPTION_ARG_INT:
        case G_OPTION_ARG_INT64:
            valueWidget = new QSpinBox();
            break;
        case G_OPTION_ARG_DOUBLE:
            valueWidget = new QDoubleSpinBox();
            break;
        */
        case G_OPTION_ARG_NONE:
            {
                QCheckBox *w = new QCheckBox("Enabled"); // new SwitchWidget();
                valueWidget = w;
                connect(w, SIGNAL(stateChanged(int)), this, SLOT(stateChanged(int)));
                if ( argument != NULL ) {
                    w->setCheckState(Qt::Checked);
                } else {
                    w->setCheckState(Qt::Unchecked);
                }
            }
            break;
        default:
            throw std::invalid_argument("UI argument type unknown");
    }
}
Пример #20
0
void RatingWidget::createLineEditWidgetRate()
{
	QFont fontLine("Arial", 10);

	m_LineResistance60sDivTestVoltage = new QLineEdit(this);
	m_LineResistance60sDivTestVoltage->setReadOnly(true);
	m_LineResistance60sDivTestVoltage->setFont(fontLine);

	m_LineRateResistance60sDivTestVoltage = new QLineEdit(this);
	m_LineRateResistance60sDivTestVoltage->setReadOnly(true);
	m_LineRateResistance60sDivTestVoltage->setFont(fontLine);

	m_LineTimeShortCircuitR = new QLineEdit(this);
	m_LineTimeShortCircuitR->setReadOnly(true);
	m_LineTimeShortCircuitR->setFont(fontLine);

	m_LineRateTimeShortCircuit = new QLineEdit(this);
	m_LineRateTimeShortCircuit->setReadOnly(true);
	m_LineRateTimeShortCircuit->setFont(fontLine);

	m_LineMaxVoltageDivTestVoltage = new QLineEdit(this);
	m_LineMaxVoltageDivTestVoltage->setReadOnly(true);
	m_LineMaxVoltageDivTestVoltage->setFont(fontLine);

	m_LineRateMaxVoltageDivTestVoltage = new QLineEdit(this);
	m_LineRateMaxVoltageDivTestVoltage->setReadOnly(true);
	m_LineRateMaxVoltageDivTestVoltage->setFont(fontLine);

	m_LineTimeReconstructionR = new QLineEdit(this);
	m_LineTimeReconstructionR->setReadOnly(true);
	m_LineTimeReconstructionR->setFont(fontLine);

	m_LineRateTimeReconstruction = new QLineEdit(this);
	m_LineRateTimeReconstruction->setReadOnly(true);
	m_LineRateTimeReconstruction->setFont(fontLine);

	m_LineResistance60DivResistance15s = new QLineEdit(this);
	m_LineResistance60DivResistance15s ->setReadOnly(true);
	m_LineResistance60DivResistance15s->setFont(fontLine);

	m_LineRateResistance60DivResistance15s = new QLineEdit(this);
	m_LineRateResistance60DivResistance15s->setReadOnly(true);
	m_LineRateResistance60DivResistance15s->setFont(fontLine);

	m_LineRateTotal = new QLineEdit(this);
	m_LineRateTotal->setReadOnly(true);
	m_LineRateTotal->setFont(fontLine);

	QFont fontLabel("Arial", 10);

	QLabel *labelMaxVoltageDivTestVoltage = new QLabel(tr("Rezystancja R60 przez napięcie probiercze [kΩ/V]"), this);
	labelMaxVoltageDivTestVoltage->setFont(fontLabel);

	QLabel *labelTimeShortCircuit= new QLabel(tr("Czas zwarcia [s]:"), this);
	labelTimeShortCircuit->setFont(fontLabel);

	QLabel *labelResistance60sDivTestVoltage = new QLabel(tr("Napięcie odbudowy przez napięcie probiercze:"), this);
	labelResistance60sDivTestVoltage->setFont(fontLabel);

	QLabel *labelTimeReconstruction= new QLabel(tr("Czas odbudowy [s]:"), this);
	labelTimeReconstruction->setFont(fontLabel);

	QLabel *labelResistance60DivResistance15s = new QLabel(tr("Rezystancja R60 przez R15:"), this);
	labelResistance60DivResistance15s->setFont(fontLabel);

	QLabel *labelTotal = new QLabel(tr("Ocena ogólna:"), this);
	labelTotal->setFont(fontLabel);

	QGridLayout *gBox = new QGridLayout(this);

	gBox->addWidget(labelMaxVoltageDivTestVoltage, 0 , 0);
	gBox->addWidget(labelTimeShortCircuit, 1 , 0);
	gBox->addWidget(labelResistance60sDivTestVoltage, 2 , 0);
	gBox->addWidget(labelTimeReconstruction, 3, 0);
	gBox->addWidget(labelResistance60DivResistance15s, 4 , 0);
	gBox->addWidget(labelTotal, 5, 0);

	gBox->addWidget(m_LineResistance60sDivTestVoltage, 0 , 1);
	gBox->addWidget(m_LineTimeShortCircuitR, 1 , 1);
	gBox->addWidget(m_LineMaxVoltageDivTestVoltage, 2 , 1);
	gBox->addWidget(m_LineTimeReconstructionR, 3 , 1);
	gBox->addWidget(m_LineResistance60DivResistance15s, 4 , 1);
	gBox->addWidget(m_LineRateTotal, 5, 1);

	gBox->addWidget(m_LineRateResistance60sDivTestVoltage, 0 , 2);
	gBox->addWidget(m_LineRateTimeShortCircuit, 1 , 2);
	gBox->addWidget(m_LineRateMaxVoltageDivTestVoltage, 2 , 2);
	gBox->addWidget(m_LineRateTimeReconstruction, 3 , 2);
	gBox->addWidget(m_LineRateResistance60DivResistance15s, 4 , 2);

	m_LineEditRate = new QGroupBox(tr("Ocena"), this);
	m_LineEditRate->setFont(QFont("Arial", 12, QFont::Bold));
	m_LineEditRate->setStyleSheet("QGroupBox{border:1px; border-style:outset; border-color: gray; margin:10px;} "
							"QGroupBox::title{subcontrol-origin: margin; subcontrol-position:top left}");

	m_LineEditRate->setLayout(gBox);
}
Пример #21
0
void Qt_masked_grid_summary::init( const Geostat_grid* grid ) {
  //TL modified
  const Reduced_grid * rgrid = dynamic_cast<const Reduced_grid*>(grid);
  if( !rgrid ) return;

  //geostat_grid_ = cgrid;
  GsTLCoordVector cell_dims = rgrid->cell_dimensions();
  GsTLPoint origin = rgrid->origin();

  desc_widget_ = new QGroupBox( 1, Qt::Horizontal );
  QGroupBox* groupbox = (QGroupBox*) desc_widget_;
  groupbox->setInsideSpacing( 4 );

  QString count;
  QFont font;
  font.setBold(true);


  QLabel * title;
  title = new QLabel(QString("Grid with inactive cells"),groupbox);
  title->setFont(font);


  // number of cells
  QLabel* dimslabel;
  dimslabel = new QLabel ("Bounding box", groupbox);
  dimslabel->setFont( font );
  count.setNum( rgrid->nx() );
  new QLabel( QString("X: ")+count, groupbox );
  count.setNum( rgrid->ny() );
  new QLabel( QString("Y: ")+count, groupbox );
  count.setNum( rgrid->nz() );
  new QLabel( QString("Z: ")+count, groupbox );

  //TL modified
  QLabel * num;
  num = new QLabel(QString("# of active cells: ")+count.setNum(rgrid->numActive()), groupbox);
  num->setFont(font);


  // cell dimensions
  groupbox->addSpace( 8 );
  QLabel* sizelabel = new QLabel( "Cells dimensions", groupbox );
  sizelabel->setFont( font );
  count.setNum( cell_dims.x() );
  new QLabel( QString("X: ")+count, groupbox );
  count.setNum( cell_dims.y() );
  new QLabel( QString("Y: ")+count, groupbox );
  count.setNum( cell_dims.z() );
  new QLabel( QString("Z: ")+count, groupbox );

  // Origin
  groupbox->addSpace( 8 );
  QLabel* originlabel = new QLabel( "Origin (center of origin cell)", groupbox );
  originlabel->setFont( font );
  count.setNum( origin.x() );
  new QLabel( QString("X: ")+count, groupbox );
  count.setNum( origin.y() );
  new QLabel( QString("Y: ")+count, groupbox );
  count.setNum( origin.z() );
  new QLabel( QString("Z: ")+count, groupbox );

}
Пример #22
0
void RatingWidget::createLineEditWidget()
{
	QFont fontLine("Arial", 10);

	m_LineMaxVoltage = new QLineEdit(this);
	m_LineMaxVoltage->setReadOnly(true);
	m_LineMaxVoltage->setFont(fontLine);

	m_LineTimeReconstruction = new QLineEdit(this);
	m_LineTimeReconstruction->setReadOnly(true);
	m_LineTimeReconstruction->setFont(fontLine);

	m_LineRatedVoltage = new QLineEdit(this);
	m_LineRatedVoltage->setFont(fontLine);

	m_LineTestVoltage = new QLineEdit(this);
	m_LineTestVoltage->setFont(fontLine);

	m_LineResistanceAfter60s = new QLineEdit(this);
	m_LineResistanceAfter60s->setFont(fontLine);

	m_LineResistanceAfter15s = new QLineEdit(this);
	m_LineResistanceAfter15s->setFont(fontLine);

	m_LineTimeShortCircuit = new QLineEdit(this);
	m_LineTimeShortCircuit->setFont(fontLine);

	QFont fontLabel("Arial", 10);

	QLabel *labelMaxVoltage = new QLabel(tr("Napięcie odbudowy [V]:"), this);
	labelMaxVoltage->setFont(fontLabel);

	QLabel *labelTimeReconstruction = new QLabel(tr("Czas odbudowy [s]:"), this);
	labelTimeReconstruction->setFont(fontLabel);

	QLabel *labelRatedVoltage = new QLabel(tr("Napięcie znamionowe [V]:"), this);
	labelRatedVoltage->setFont(fontLabel);

	QLabel *labelTestVoltage = new QLabel(tr("Napięcie probiercze [V]:"), this);
	labelTestVoltage->setFont(fontLabel);

	QLabel *labelResistanceAfter60s = new QLabel(tr("Rezystancja po 60 sekundach [MΩ]:"), this);
	labelResistanceAfter60s->setFont(fontLabel);

	QLabel *labelResistanceAfter15s = new QLabel(tr("Rezystancja po 15 sekundach [MΩ]:"), this);
	labelResistanceAfter15s->setFont(fontLabel);

	QLabel *labelTimeShortCircuit = new QLabel(tr("Czas zwarcia [s]:"), this);
	labelTimeShortCircuit->setFont(fontLabel);

	QGridLayout *gBox = new QGridLayout(this);
	gBox->addWidget(m_LineMaxVoltage, 0, 1);
	gBox->addWidget(m_LineTimeReconstruction, 1, 1);
	gBox->addWidget(m_LineRatedVoltage, 2, 1);
	gBox->addWidget(m_LineTestVoltage, 3, 1);
	gBox->addWidget(m_LineResistanceAfter60s, 4, 1);
	gBox->addWidget(m_LineResistanceAfter15s, 5, 1);
	gBox->addWidget(m_LineTimeShortCircuit, 6, 1);

	gBox->addWidget(labelMaxVoltage, 0, 0);
	gBox->addWidget(labelTimeReconstruction, 1, 0);
	gBox->addWidget(labelRatedVoltage, 2, 0);
	gBox->addWidget(labelTestVoltage, 3, 0);
	gBox->addWidget(labelResistanceAfter60s, 4, 0);
	gBox->addWidget(labelResistanceAfter15s, 5, 0);
	gBox->addWidget(labelTimeShortCircuit, 6, 0);

	m_LineEdit = new QGroupBox(tr("Dane techniczne"), this);
	m_LineEdit->setFont(QFont("Arial", 12, QFont::Bold));
	m_LineEdit->setStyleSheet("QGroupBox{border:1px; border-style:outset; border-color: gray; margin:10px} "
								"QGroupBox::title{subcontrol-origin: margin; subcontrol-position:top left}");
	m_LineEdit->setLayout(gBox);
	m_LineEdit->setMinimumWidth(350);
	m_LineEdit->setMaximumWidth(350);
}
Пример #23
0
void SummaryWidget::updateView()
{
  mLayouts.setAutoDelete( true );
  mLayouts.clear();
  mLayouts.setAutoDelete( false );

  mLabels.setAutoDelete( true );
  mLabels.clear();
  mLabels.setAutoDelete( false );

  if ( mStations.count() == 0 ) {
    kdDebug(5602) << "No weather stations defined..." << endl;
    return;
  }


  QValueList<WeatherData> dataList = mWeatherMap.values();
  qHeapSort( dataList );

  QValueList<WeatherData>::Iterator it;
  for ( it = dataList.begin(); it != dataList.end(); ++it ) {
    QString cover;
    for ( uint i = 0; i < (*it).cover().count(); ++i )
      cover += QString( "- %1\n" ).arg( (*it).cover()[ i ] );

    QImage img;
    img = (*it).icon();

    QGridLayout *layout = new QGridLayout( mLayout, 3, 3, 3 );
    mLayouts.append( layout );

    KURLLabel* urlLabel = new KURLLabel( this );
    urlLabel->installEventFilter( this );
    urlLabel->setURL( (*it).stationID() );
    urlLabel->setPixmap( img.smoothScale( 32, 32 ) );
    urlLabel->setMaximumSize( urlLabel->sizeHint() );
    urlLabel->setAlignment( AlignTop );
    layout->addMultiCellWidget( urlLabel, 0, 1, 0, 0 );
    mLabels.append( urlLabel );
    connect ( urlLabel, SIGNAL( leftClickedURL( const QString& ) ),
              this, SLOT( showReport( const QString& ) ) );

    QLabel* label = new QLabel( this );
    label->setText( QString( "%1 (%2)" ).arg( (*it).name() ).arg( (*it).temperature() ) );
    QFont font = label->font();
    font.setBold( true );
    label->setFont( font );
    label->setAlignment( AlignLeft );
    layout->addMultiCellWidget( label, 0, 0, 1, 2 );
    mLabels.append( label );

    QString labelText;
    labelText = QString( "<b>%1:</b> %2<br>"
                         "<b>%3:</b> %4<br>"
                         "<b>%5:</b> %6" )
                         .arg( i18n( "Last updated on" ) )
                         .arg( (*it).date() )
                         .arg( i18n( "Wind Speed" ) )
                         .arg( (*it).windSpeed() )
                         .arg( i18n( "Rel. Humidity" ) )
                         .arg( (*it).relativeHumidity() );

    QToolTip::add( label, labelText.replace( " ", "&nbsp;" ) );

    label = new QLabel( cover, this );
    label->setAlignment( AlignLeft );
    layout->addMultiCellWidget( label, 1, 1, 1, 2 );
    mLabels.append( label );
  }

  for ( QLabel *label = mLabels.first(); label; label = mLabels.next() )
    label->show();
}
Пример #24
0
TrackParameterBox::TrackParameterBox(QWidget *parent) :
    RosegardenParameterBox(tr("Track"), tr("Track Parameters"), parent),
    m_doc(NULL),
    m_selectedTrackId(NO_TRACK),
    m_lastInstrumentType(Instrument::InvalidInstrument)
{
    setObjectName("Track Parameter Box");

    QFontMetrics metrics(m_font);
    const int width11 = metrics.width("12345678901");
    const int width20 = metrics.width("12345678901234567890");
    const int width22 = metrics.width("1234567890123456789012");
    const int width25 = metrics.width("1234567890123456789012345");

    // Widgets

    // Label
    m_trackLabel = new SqueezedLabel(tr("<untitled>"), this);
    m_trackLabel->setAlignment(Qt::AlignCenter);
    m_trackLabel->setFont(m_font);

    // Playback parameters

    // Outer collapsing frame
    CollapsingFrame *playbackParametersFrame = new CollapsingFrame(
            tr("Playback parameters"), this, "trackparametersplayback", true);

    // Inner fixed widget
    // We need an inner widget so that we can have a layout.  The outer
    // CollapsingFrame already has its own layout.
    QWidget *playbackParameters = new QWidget(playbackParametersFrame);
    playbackParametersFrame->setWidget(playbackParameters);
    playbackParameters->setContentsMargins(3, 3, 3, 3);

    // Device
    QLabel *playbackDeviceLabel = new QLabel(tr("Device"), playbackParameters);
    playbackDeviceLabel->setFont(m_font);
    m_playbackDevice = new QComboBox(playbackParameters);
    m_playbackDevice->setToolTip(tr("<qt><p>Choose the device this track will use for playback.</p><p>Click <img src=\":pixmaps/toolbar/manage-midi-devices.xpm\"> to connect this device to a useful output if you do not hear sound</p></qt>"));
    m_playbackDevice->setMinimumWidth(width25);
    m_playbackDevice->setFont(m_font);
    connect(m_playbackDevice, SIGNAL(activated(int)),
            this, SLOT(slotPlaybackDeviceChanged(int)));

    // Instrument
    QLabel *instrumentLabel = new QLabel(tr("Instrument"), playbackParameters);
    instrumentLabel->setFont(m_font);
    m_instrument = new QComboBox(playbackParameters);
    m_instrument->setFont(m_font);
    m_instrument->setToolTip(tr("<qt><p>Choose the instrument this track will use for playback. (Configure the instrument in <b>Instrument Parameters</b>).</p></qt>"));
    m_instrument->setMaxVisibleItems(16);
    m_instrument->setMinimumWidth(width22);
    connect(m_instrument, SIGNAL(activated(int)),
            this, SLOT(slotInstrumentChanged(int)));

    // Archive
    QLabel *archiveLabel = new QLabel(tr("Archive"), playbackParameters);
    archiveLabel->setFont(m_font);
    m_archive = new QCheckBox(playbackParameters);
    m_archive->setFont(m_font);
    m_archive->setToolTip(tr("<qt><p>Check this to archive a track.  Archived tracks will not make sound.</p></qt>"));
    connect(m_archive, SIGNAL(clicked(bool)),
            this, SLOT(slotArchiveChanged(bool)));

    // Playback parameters layout

    // This automagically becomes playbackParameters's layout.
    QGridLayout *groupLayout = new QGridLayout(playbackParameters);
    groupLayout->setContentsMargins(5,0,0,5);
    groupLayout->setVerticalSpacing(2);
    groupLayout->setHorizontalSpacing(5);
    // Row 0: Device
    groupLayout->addWidget(playbackDeviceLabel, 0, 0);
    groupLayout->addWidget(m_playbackDevice, 0, 1);
    // Row 1: Instrument
    groupLayout->addWidget(instrumentLabel, 1, 0);
    groupLayout->addWidget(m_instrument, 1, 1);
    // Row 2: Archive
    groupLayout->addWidget(archiveLabel, 2, 0);
    groupLayout->addWidget(m_archive, 2, 1);
    // Let column 1 fill the rest of the space.
    groupLayout->setColumnStretch(1, 1);

    // Recording filters

    m_recordingFiltersFrame = new CollapsingFrame(
            tr("Recording filters"), this, "trackparametersrecord", false);

    QWidget *recordingFilters = new QWidget(m_recordingFiltersFrame);
    m_recordingFiltersFrame->setWidget(recordingFilters);
    recordingFilters->setContentsMargins(3, 3, 3, 3);

    // Device
    QLabel *recordDeviceLabel = new QLabel(tr("Device"), recordingFilters);
    recordDeviceLabel->setFont(m_font);
    m_recordingDevice = new QComboBox(recordingFilters);
    m_recordingDevice->setFont(m_font);
    m_recordingDevice->setToolTip(tr("<qt><p>This track will only record Audio/MIDI from the selected device, filtering anything else out</p></qt>"));
    m_recordingDevice->setMinimumWidth(width25);
    connect(m_recordingDevice, SIGNAL(activated(int)),
            this, SLOT(slotRecordingDeviceChanged(int)));

    // Channel
    QLabel *channelLabel = new QLabel(tr("Channel"), recordingFilters);
    channelLabel->setFont(m_font);
    m_recordingChannel = new QComboBox(recordingFilters);
    m_recordingChannel->setFont(m_font);
    m_recordingChannel->setToolTip(tr("<qt><p>This track will only record Audio/MIDI from the selected channel, filtering anything else out</p></qt>"));
    m_recordingChannel->setMaxVisibleItems(17);
    m_recordingChannel->setMinimumWidth(width11);
    m_recordingChannel->addItem(tr("All"));
    for (int i = 1; i < 17; ++i) {
        m_recordingChannel->addItem(QString::number(i));
    }
    connect(m_recordingChannel, SIGNAL(activated(int)),
            this, SLOT(slotRecordingChannelChanged(int)));

    // Thru Routing
    QLabel *thruLabel = new QLabel(tr("Thru Routing"), recordingFilters);
    thruLabel->setFont(m_font);
    m_thruRouting = new QComboBox(recordingFilters);
    m_thruRouting->setFont(m_font);
    //m_thruRouting->setToolTip(tr("<qt><p>Routing from the input device and channel to the instrument.</p></qt>"));
    m_thruRouting->setMinimumWidth(width11);
    m_thruRouting->addItem(tr("Auto"), Track::Auto);
    m_thruRouting->addItem(tr("On"), Track::On);
    m_thruRouting->addItem(tr("Off"), Track::Off);
    m_thruRouting->addItem(tr("When Armed"), Track::WhenArmed);
    connect(m_thruRouting, SIGNAL(activated(int)),
            this, SLOT(slotThruRoutingChanged(int)));

    // Recording filters layout

    groupLayout = new QGridLayout(recordingFilters);
    groupLayout->setContentsMargins(5,0,0,5);
    groupLayout->setVerticalSpacing(2);
    groupLayout->setHorizontalSpacing(5);
    // Row 0: Device
    groupLayout->addWidget(recordDeviceLabel, 0, 0);
    groupLayout->addWidget(m_recordingDevice, 0, 1);
    // Row 1: Channel
    groupLayout->addWidget(channelLabel, 1, 0);
    groupLayout->addWidget(m_recordingChannel, 1, 1);
    // Row 2: Thru Routing
    groupLayout->addWidget(thruLabel, 2, 0);
    groupLayout->addWidget(m_thruRouting, 2, 1);
    // Let column 1 fill the rest of the space.
    groupLayout->setColumnStretch(1, 1);

    // Staff export options

    m_staffExportOptionsFrame = new CollapsingFrame(
            tr("Staff export options"), this, "trackstaffgroup", false);

    QWidget *staffExportOptions = new QWidget(m_staffExportOptionsFrame);
    m_staffExportOptionsFrame->setWidget(staffExportOptions);
    staffExportOptions->setContentsMargins(2, 2, 2, 2);

    // Notation size (export only)
    //
    // NOTE: This is the only way to get a \small or \tiny inserted before the
    // first note in LilyPond export.  Setting the actual staff size on a
    // per-staff (rather than per-score) basis is something the author of the
    // LilyPond documentation has no idea how to do, so we settle for this,
    // which is not as nice, but actually a lot easier to implement.
    QLabel *notationSizeLabel = new QLabel(tr("Notation size:"), staffExportOptions);
    notationSizeLabel->setFont(m_font);
    m_notationSize = new QComboBox(staffExportOptions);
    m_notationSize->setFont(m_font);
    m_notationSize->setToolTip(tr("<qt><p>Choose normal, \\small or \\tiny font size for notation elements on this (normal-sized) staff when exporting to LilyPond.</p><p>This is as close as we get to enabling you to print parts in cue size</p></qt>"));
    m_notationSize->setMinimumWidth(width11);
    m_notationSize->addItem(tr("Normal"), StaffTypes::Normal);
    m_notationSize->addItem(tr("Small"), StaffTypes::Small);
    m_notationSize->addItem(tr("Tiny"), StaffTypes::Tiny);
    connect(m_notationSize, SIGNAL(activated(int)),
            this, SLOT(slotNotationSizeChanged(int)));

    // Bracket type
    // Staff bracketing (export only at the moment, but using this for GUI
    // rendering would be nice in the future!) //!!! 
    QLabel *bracketTypeLabel = new QLabel(tr("Bracket type:"), staffExportOptions);
    bracketTypeLabel->setFont(m_font);
    m_bracketType = new QComboBox(staffExportOptions);
    m_bracketType->setFont(m_font);
    m_bracketType->setToolTip(tr("<qt><p>Bracket staffs in LilyPond<br>(fragile, use with caution)</p><qt>"));
    m_bracketType->setMinimumWidth(width11);
    m_bracketType->addItem(tr("-----"), Brackets::None);
    m_bracketType->addItem(tr("[----"), Brackets::SquareOn);
    m_bracketType->addItem(tr("----]"), Brackets::SquareOff);
    m_bracketType->addItem(tr("[---]"), Brackets::SquareOnOff);
    m_bracketType->addItem(tr("{----"), Brackets::CurlyOn);
    m_bracketType->addItem(tr("----}"), Brackets::CurlyOff);
    m_bracketType->addItem(tr("{[---"), Brackets::CurlySquareOn);
    m_bracketType->addItem(tr("---]}"), Brackets::CurlySquareOff);
    connect(m_bracketType, SIGNAL(activated(int)),
            this, SLOT(slotBracketTypeChanged(int)));

    // Staff export options layout

    groupLayout = new QGridLayout(staffExportOptions);
    groupLayout->setContentsMargins(5,0,0,5);
    groupLayout->setVerticalSpacing(2);
    groupLayout->setHorizontalSpacing(5);
    groupLayout->setColumnStretch(1, 1);
    // Row 0: Notation size
    groupLayout->addWidget(notationSizeLabel, 0, 0, Qt::AlignLeft);
    groupLayout->addWidget(m_notationSize, 0, 1, 1, 2);
    // Row 1: Bracket type
    groupLayout->addWidget(bracketTypeLabel, 1, 0, Qt::AlignLeft);
    groupLayout->addWidget(m_bracketType, 1, 1, 1, 2);

    // Create segments with

    m_createSegmentsWithFrame = new CollapsingFrame(
            tr("Create segments with"), this, "trackparametersdefaults", false);

    QWidget *createSegmentsWith = new QWidget(m_createSegmentsWithFrame);
    m_createSegmentsWithFrame->setWidget(createSegmentsWith);
    createSegmentsWith->setContentsMargins(3, 3, 3, 3);

    // Preset
    m_presetLabel = new QLabel(tr("Preset"), createSegmentsWith);
    m_presetLabel->setFont(m_font);

    m_preset = new QLabel(tr("<none>"), createSegmentsWith);
    m_preset->setFont(m_font);
    m_preset->setObjectName("SPECIAL_LABEL");
    m_preset->setFrameStyle(QFrame::Panel | QFrame::Sunken);
    m_preset->setMinimumWidth(width20);

    m_load = new QPushButton(tr("Load"), createSegmentsWith);
    m_load->setFont(m_font);
    m_load->setToolTip(tr("<qt><p>Load a segment parameters preset from our comprehensive database of real-world instruments.</p><p>When you create new segments, they will have these parameters at the moment of creation.  To use these parameters on existing segments (eg. to convert an existing part in concert pitch for playback on a Bb trumpet) use <b>Segments -> Convert notation for</b> in the notation editor.</p></qt>"));
    connect(m_load, SIGNAL(released()),
            SLOT(slotLoadPressed()));

    // Clef
    m_clefLabel = new QLabel(tr("Clef"), createSegmentsWith);
    m_clefLabel->setFont(m_font);
    m_clef = new QComboBox(createSegmentsWith);
    m_clef->setFont(m_font);
    m_clef->setToolTip(tr("<qt><p>New segments will be created with this clef inserted at the beginning</p></qt>"));
    m_clef->setMinimumWidth(width11);
    m_clef->addItem(tr("treble", "Clef name"), TrebleClef);
    m_clef->addItem(tr("bass", "Clef name"), BassClef);
    m_clef->addItem(tr("crotales", "Clef name"), CrotalesClef);
    m_clef->addItem(tr("xylophone", "Clef name"), XylophoneClef);
    m_clef->addItem(tr("guitar", "Clef name"), GuitarClef);
    m_clef->addItem(tr("contrabass", "Clef name"), ContrabassClef);
    m_clef->addItem(tr("celesta", "Clef name"), CelestaClef);
    m_clef->addItem(tr("old celesta", "Clef name"), OldCelestaClef);
    m_clef->addItem(tr("french", "Clef name"), FrenchClef);
    m_clef->addItem(tr("soprano", "Clef name"), SopranoClef);
    m_clef->addItem(tr("mezzosoprano", "Clef name"), MezzosopranoClef);
    m_clef->addItem(tr("alto", "Clef name"), AltoClef);
    m_clef->addItem(tr("tenor", "Clef name"), TenorClef);
    m_clef->addItem(tr("baritone", "Clef name"), BaritoneClef);
    m_clef->addItem(tr("varbaritone", "Clef name"), VarbaritoneClef);
    m_clef->addItem(tr("subbass", "Clef name"), SubbassClef);
    m_clef->addItem(tr("twobar", "Clef name"), TwoBarClef);
    connect(m_clef, SIGNAL(activated(int)),
            this, SLOT(slotClefChanged(int)));

    // Transpose
    m_transposeLabel = new QLabel(tr("Transpose"), createSegmentsWith);
    m_transposeLabel->setFont(m_font);
    m_transpose = new QComboBox(createSegmentsWith);
    m_transpose->setFont(m_font);
    m_transpose->setToolTip(tr("<qt><p>New segments will be created with this transpose property set</p></qt>"));
    connect(m_transpose, SIGNAL(activated(int)),
            SLOT(slotTransposeChanged(int)));

    int transposeRange = 48;
    for (int i = -transposeRange; i < transposeRange + 1; i++) {
        m_transpose->addItem(QString("%1").arg(i));
        if (i == 0)
            m_transpose->setCurrentIndex(m_transpose->count() - 1);
    }

    // Pitch
    m_pitchLabel = new QLabel(tr("Pitch"), createSegmentsWith);
    m_pitchLabel->setFont(m_font);

    // Lowest playable note
    m_lowestLabel = new QLabel(tr("Lowest"), createSegmentsWith);
    m_lowestLabel->setFont(m_font);

    m_lowest = new QPushButton(tr("---"), createSegmentsWith);
    m_lowest->setFont(m_font);
    m_lowest->setToolTip(tr("<qt><p>Choose the lowest suggested playable note, using a staff</p></qt>"));
    connect(m_lowest, SIGNAL(released()),
            SLOT(slotLowestPressed()));

    // Highest playable note
    m_highestLabel = new QLabel(tr("Highest"), createSegmentsWith);
    m_highestLabel->setFont(m_font);

    m_highest = new QPushButton(tr("---"), createSegmentsWith);
    m_highest->setFont(m_font);
    m_highest->setToolTip(tr("<qt><p>Choose the highest suggested playable note, using a staff</p></qt>"));
    connect(m_highest, SIGNAL(released()),
            SLOT(slotHighestPressed()));

    // Color
    QLabel *colorLabel = new QLabel(tr("Color"), createSegmentsWith);
    colorLabel->setFont(m_font);
    m_color = new QComboBox(createSegmentsWith);
    m_color->setFont(m_font);
    m_color->setToolTip(tr("<qt><p>New segments will be created using this color</p></qt>"));
    m_color->setEditable(false);
    m_color->setMaxVisibleItems(20);
    connect(m_color, SIGNAL(activated(int)),
            SLOT(slotColorChanged(int)));

    // "Create segments with" layout

    groupLayout = new QGridLayout(createSegmentsWith);
    groupLayout->setContentsMargins(5,0,0,5);
    groupLayout->setVerticalSpacing(2);
    groupLayout->setHorizontalSpacing(5);
    // Row 0: Preset/Load
    groupLayout->addWidget(m_presetLabel, 0, 0, Qt::AlignLeft);
    groupLayout->addWidget(m_preset, 0, 1, 1, 3);
    groupLayout->addWidget(m_load, 0, 4, 1, 2);
    // Row 1: Clef/Transpose
    groupLayout->addWidget(m_clefLabel, 1, 0, Qt::AlignLeft);
    groupLayout->addWidget(m_clef, 1, 1, 1, 2);
    groupLayout->addWidget(m_transposeLabel, 1, 3, 1, 2, Qt::AlignRight);
    groupLayout->addWidget(m_transpose, 1, 5, 1, 1);
    // Row 2: Pitch/Lowest/Highest
    groupLayout->addWidget(m_pitchLabel, 2, 0, Qt::AlignLeft);
    groupLayout->addWidget(m_lowestLabel, 2, 1, Qt::AlignRight);
    groupLayout->addWidget(m_lowest, 2, 2, 1, 1);
    groupLayout->addWidget(m_highestLabel, 2, 3, Qt::AlignRight);
    groupLayout->addWidget(m_highest, 2, 4, 1, 2);
    // Row 3: Color
    groupLayout->addWidget(colorLabel, 3, 0, Qt::AlignLeft);
    groupLayout->addWidget(m_color, 3, 1, 1, 5);

    groupLayout->setColumnStretch(1, 1);
    groupLayout->setColumnStretch(2, 2);

    // Connections

    connect(Instrument::getStaticSignals().data(),
            SIGNAL(changed(Instrument *)),
            this,
            SLOT(slotInstrumentChanged(Instrument *)));

    // Layout

    QGridLayout *mainLayout = new QGridLayout(this);
    mainLayout->setMargin(0);
    mainLayout->setSpacing(1);
    mainLayout->addWidget(m_trackLabel, 0, 0);
    mainLayout->addWidget(playbackParametersFrame, 1, 0);
    mainLayout->addWidget(m_recordingFiltersFrame, 2, 0);
    mainLayout->addWidget(m_staffExportOptionsFrame, 3, 0);
    mainLayout->addWidget(m_createSegmentsWithFrame, 4, 0);

    // Box

    setContentsMargins(2, 7, 2, 2);

    updateWidgets2();
}
Пример #25
0
		StageSelectionDialog(QWidget *parent) : QDialog(parent) {
			Environment *env = Environment::Instance();

			QVBoxLayout *layout = new QVBoxLayout;
			QHBoxLayout *hlayout;
			QLabel *label;

			label = new QLabel;
			QFont f = label->font();
			f.setBold(true);
			f.setPointSize(f.pointSize()*150/100);
			label->setFont(f);
			label->setText(tr("Select configuration mode"));
			label->setAlignment(Qt::AlignCenter);
			layout->addWidget(label);

			layout->addSpacing(fontMetrics().ascent());

			// Create dialog here
			_systemMode = new QPushButton;
			_systemMode->setSizePolicy(QSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum));
			_systemMode->setIcon(QIcon(":/res/icons/system-settings.png"));
			_systemMode->setIconSize(QSize(72,72));

			label = new QLabel;
			label->setWordWrap(true);
			label->setAlignment(Qt::AlignCenter);
			label->setText(QString(tr("Manage system configuration in <i>%1</i>.")).arg(env->appConfigDir().c_str()));

			hlayout = new QHBoxLayout;
			hlayout->addStretch();
			hlayout->addWidget(_systemMode);
			hlayout->addStretch();

			layout->addLayout(hlayout);
			layout->addWidget(label);

			QFrame *frame = new QFrame;
			frame->setFrameShape(QFrame::HLine);

			layout->addWidget(frame);

			_userMode = new QPushButton;
			_userMode->setSizePolicy(QSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum));
			_userMode->setIcon(QIcon(":/res/icons/user-settings.png"));
			_userMode->setIconSize(QSize(72,72));

			label = new QLabel;
			label->setWordWrap(true);
			label->setAlignment(Qt::AlignCenter);
			label->setText(QString(tr("Manage user configuration in <i>%1</i>.")).arg(env->configDir().c_str()));
			hlayout = new QHBoxLayout;
			hlayout->addStretch();
			hlayout->addWidget(_userMode);
			hlayout->addStretch();

			layout->addLayout(hlayout);
			layout->addWidget(label);

			layout->addStretch();

			setLayout(layout);

			connect(_userMode, SIGNAL(clicked()), this, SLOT(accept()));
			connect(_systemMode, SIGNAL(clicked()), this, SLOT(accept()));
		}
Пример #26
0
Palette::Palette(Editor* editor) : QDockWidget(editor, Qt::Tool)
{
	this->editor = editor;
	
	QWidget* paletteContent = new QWidget();
	//paletteContent->setWindowFlags(Qt::FramelessWindowHint);
	
	sliderRed = new QSlider(Qt::Horizontal);
	sliderGreen = new QSlider(Qt::Horizontal);
	sliderBlue = new QSlider(Qt::Horizontal);
	sliderAlpha = new QSlider(Qt::Horizontal);
	sliderRed->setRange(0,255);
	sliderGreen->setRange(0,255);
	sliderBlue->setRange(0,255);
	sliderAlpha->setRange(0,255);
	QLabel* labelRed = new QLabel(tr("Red"));
	QLabel* labelGreen = new QLabel(tr("Green"));
	QLabel* labelBlue = new QLabel(tr("Blue"));
	QLabel* labelAlpha = new QLabel(tr("Alpha"));
	labelRed->setFont( QFont("Helvetica", 10) );
	labelGreen->setFont( QFont("Helvetica", 10) );
	labelBlue->setFont( QFont("Helvetica", 10) );
	labelAlpha->setFont( QFont("Helvetica", 10) );
	
	QGridLayout* sliderLayout = new QGridLayout();
	sliderLayout->setSpacing(3);
	sliderLayout->addWidget(labelRed, 0, 0);
	sliderLayout->addWidget(sliderRed, 0, 1);
	sliderLayout->addWidget(labelGreen, 1, 0);
	sliderLayout->addWidget(sliderGreen, 1, 1);
	sliderLayout->addWidget(labelBlue, 2, 0);
	sliderLayout->addWidget(sliderBlue, 2, 1);
	sliderLayout->addWidget(labelAlpha, 3, 0);
	sliderLayout->addWidget(sliderAlpha, 3, 1);
	sliderLayout->setMargin(10);
	sliderLayout->setSpacing(2);
	
	//QWidget* sliders = new QWidget();
	//sliders->setLayout(sliderLayout);
	//sliders->setFixedHeight(60);
	
	listOfColours = new QListWidget();
	
	QToolBar *buttons = new QToolBar();
	addButton = new QToolButton();
	removeButton = new QToolButton();
	addButton->setIcon(QIcon(":icons/add.png"));
	addButton->setToolTip("Add Colour");
	addButton->setFixedSize(30,30);
	removeButton->setIcon(QIcon(":icons/remove.png"));
	removeButton->setToolTip("Remove Colour");
	removeButton->setFixedSize(30,30);
	
	QLabel* spacer = new QLabel();
	spacer->setFixedWidth(10);
	
	colourSwatch = new QToolButton(); //QLabel();
	colourSwatch->setFixedSize( 40, 40 );
	QPixmap colourPixmap(30,30);
	colourPixmap.fill( Qt::black );
	colourSwatch->setIcon(QIcon(colourPixmap)); //colourSwatch->setPixmap(colourPixmap);
	/*QFrame* colourSwatchFrame = new QFrame();
	colourSwatchFrame->setFixedSize( 50, 50 );
	//colourSwatchFrame->setFrameStyle(QFrame::Panel | QFrame::Sunken);
	QVBoxLayout *colourSwatchLayout = new QVBoxLayout();
	colourSwatchLayout->addWidget(colourSwatch);
	colourSwatchFrame->setLayout(colourSwatchLayout);*/
	
	//QGridLayout *buttonLayout = new QGridLayout();
	buttons->addWidget(spacer);
	buttons->addWidget(colourSwatch);
	buttons->addWidget(addButton);
	buttons->addWidget(removeButton);
	//buttons->setFixedSize(100,34);
	//buttons->layout()->setMargin(0);
	//buttons->layout()->setSpacing(0);
	//buttonLayout->setMargin(0);
	//buttonLayout->setSpacing(0);
	//buttons->setLayout(buttonLayout);
	
	listOfColours->setFrameStyle(QFrame::Panel | QFrame::Sunken);
	listOfColours->setLineWidth(1);
	listOfColours->setFocusPolicy(Qt::NoFocus);
	//listOfColours->setMinimumWidth(100);
	
	QVBoxLayout *layout = new QVBoxLayout();
	layout->addLayout(sliderLayout);
	layout->addWidget(buttons);
	layout->addWidget(listOfColours);
	layout->setMargin(0);
	
	paletteContent->setLayout(layout);
	setWidget(paletteContent);
	
	#ifndef Q_WS_MAC
		setStyleSheet ("QToolBar { border: 0px none black; }");
	#endif

	//setFrameStyle(QFrame::Panel);
	//setWindowFlags(Qt::Tool);
	setWindowFlags(Qt::WindowStaysOnTopHint);
	//setWindowFlags(Qt::SubWindow);
	setFloating(true);
	//setAllowedAreas(Qt::NoDockWidgetArea);
	//setMinimumSize(100, 300);
	paletteContent->setFixedWidth(150);  /// otherwise the palette is naturally too wide. Someone please fix this.
	//setFloating(false);
	//setFixedWidth(130);
	
	//setGeometry(10,60,100, 300);
	//setFocusPolicy(Qt::NoFocus);
	//setWindowOpacity(0.7);
	setWindowTitle(tr("Colours"));
	
	connect(sliderRed, SIGNAL(sliderMoved(int)), this, SLOT(updateColour()));
	connect(sliderGreen, SIGNAL(sliderMoved(int)), this, SLOT(updateColour()));
	connect(sliderBlue, SIGNAL(sliderMoved(int)), this, SLOT(updateColour()));
	connect(sliderAlpha, SIGNAL(sliderMoved(int)), this, SLOT(updateColour()));
	
	connect(sliderRed, SIGNAL(sliderReleased()), this, SLOT(changeColour()));
	connect(sliderGreen, SIGNAL(sliderReleased()), this, SLOT(changeColour()));
	connect(sliderBlue, SIGNAL(sliderReleased()), this, SLOT(changeColour()));
	connect(sliderAlpha, SIGNAL(sliderReleased()), this, SLOT(changeColour()));

	connect(listOfColours, SIGNAL(currentItemChanged(QListWidgetItem *, QListWidgetItem *)), this, SLOT(selectColour(QListWidgetItem *, QListWidgetItem *)));
	connect(listOfColours, SIGNAL(itemClicked ( QListWidgetItem *)), this, SLOT(selectAndApplyColour( QListWidgetItem *)));
	//connect(listOfColours, SIGNAL(itemDoubleClicked ( QListWidgetItem *)), this, SLOT(changeColour( QListWidgetItem *)));
	connect(listOfColours, SIGNAL(itemDoubleClicked ( QListWidgetItem *)), this, SLOT(changeColourName( QListWidgetItem *)));
	
	connect(addButton, SIGNAL(clicked()), this, SLOT(addClick()));
	connect(removeButton, SIGNAL(clicked()), this, SLOT(rmClick()));
	
	connect(colourSwatch, SIGNAL(clicked()), this, SLOT(colourSwatchClicked()));
	
	connect(this, SIGNAL(topLevelChanged(bool)), this, SLOT(closeIfDocked(bool)));
}
Пример #27
0
InteractiveConsole::InteractiveConsole(QWidget *parent)
    : QDialog(parent),
      m_splitter(new QSplitter(Qt::Vertical, this)),
      m_editorPart(0),
      m_editor(0),
      m_output(0),
      m_loadAction(KStandardAction::open(this, SLOT(openScriptFile()), this)),
      m_saveAction(KStandardAction::saveAs(this, SLOT(saveScript()), this)),
      m_clearAction(KStandardAction::clear(this, SLOT(clearEditor()), this)),
      m_executeAction(new QAction(QIcon::fromTheme(QStringLiteral("system-run")), i18n("&Execute"), this)),
      m_plasmaAction(new QAction(QIcon::fromTheme(QStringLiteral("plasma")), i18nc("Toolbar Button to switch to Plasma Scripting Mode", "Plasma"), this)),
      m_kwinAction(new QAction(QIcon::fromTheme(QStringLiteral("kwin")), i18nc("Toolbar Button to switch to KWin Scripting Mode", "KWin"), this)),
      m_snippetsMenu(new QMenu(i18n("Templates"), this)),
      m_fileDialog(0),
      m_closeWhenCompleted(false),
      m_mode(PlasmaConsole)
{
    addAction(KStandardAction::close(this, SLOT(close()), this));
    addAction(m_saveAction);
    addAction(m_clearAction);

    setWindowTitle(i18n("Desktop Shell Scripting Console"));
    setAttribute(Qt::WA_DeleteOnClose);
    //setButtons(QDialog::None);

    QWidget *widget = new QWidget(m_splitter);
    QVBoxLayout *editorLayout = new QVBoxLayout(widget);

    QLabel *label = new QLabel(i18n("Editor"), widget);
    QFont f = label->font();
    f.setBold(true);
    label->setFont(f);
    editorLayout->addWidget(label);

    connect(m_snippetsMenu, &QMenu::aboutToShow, this, &InteractiveConsole::populateTemplatesMenu);

    QToolButton *loadTemplateButton = new QToolButton(this);
    loadTemplateButton->setPopupMode(QToolButton::InstantPopup);
    loadTemplateButton->setMenu(m_snippetsMenu);
    loadTemplateButton->setText(i18n("Load"));
    connect(loadTemplateButton, &QToolButton::triggered, this, &InteractiveConsole::loadTemplate);

    QToolButton *useTemplateButton = new QToolButton(this);
    useTemplateButton->setPopupMode(QToolButton::InstantPopup);
    useTemplateButton->setMenu(m_snippetsMenu);
    useTemplateButton->setText(i18n("Use"));
    connect(useTemplateButton, &QToolButton::triggered, this, &InteractiveConsole::useTemplate);

    QActionGroup *modeGroup = new QActionGroup(this);
    modeGroup->addAction(m_plasmaAction);
    modeGroup->addAction(m_kwinAction);
    m_plasmaAction->setCheckable(true);
    m_kwinAction->setCheckable(true);
    m_plasmaAction->setChecked(true);
    connect(modeGroup, &QActionGroup::triggered, this, &InteractiveConsole::modeSelectionChanged);

    KToolBar *toolBar = new KToolBar(this, true, false);
    toolBar->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
    toolBar->addAction(m_loadAction);
    toolBar->addAction(m_saveAction);
    toolBar->addAction(m_clearAction);
    toolBar->addAction(m_executeAction);
    toolBar->addAction(m_plasmaAction);
    toolBar->addAction(m_kwinAction);
    toolBar->addWidget(loadTemplateButton);
    toolBar->addWidget(useTemplateButton);

    editorLayout->addWidget(toolBar);

    KService::List offers = KServiceTypeTrader::self()->query(QStringLiteral("KTextEditor/Document"));
    foreach (const KService::Ptr service, offers) {
        m_editorPart = service->createInstance<KTextEditor::Document>(widget);
        if (m_editorPart) {
            m_editorPart->setHighlightingMode(QStringLiteral("JavaScript/PlasmaDesktop"));

            KTextEditor::View * view = m_editorPart->createView(widget);
            view->setContextMenu(view->defaultContextMenu());

            KTextEditor::ConfigInterface *config = qobject_cast<KTextEditor::ConfigInterface*>(view);
            if (config) {
                config->setConfigValue(QStringLiteral("line-numbers"), true);
                config->setConfigValue(QStringLiteral("dynamic-word-wrap"), true);
            }

            editorLayout->addWidget(view);
            connect(m_editorPart, &KTextEditor::Document::textChanged,
                    this, &InteractiveConsole::scriptTextChanged);
            break;
        }
    }
Пример #28
0
SearchView::SearchView(QWidget *parent) : QWidget(parent) {

    QFont biggerFont = FontUtils::big();
    QFont smallerFont = FontUtils::smallBold();

#if defined(APP_MAC) | defined(APP_WIN)
    // speedup painting since we'll paint the whole background
    // by ourselves anyway in paintEvent()
    setAttribute(Qt::WA_OpaquePaintEvent);
#endif

    QBoxLayout *mainLayout = new QVBoxLayout();
    mainLayout->setMargin(0);
    mainLayout->setSpacing(0);

    // hidden message widget
    message = new QLabel(this);
    message->hide();
    mainLayout->addWidget(message);

#ifdef APP_DEMO
    QLabel *buy = new QLabel(this);
    buy->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Preferred);
    buy->setText(QString("<a style='color:palette(text);text-decoration:none' href='%1'>%2</a>").arg(
            QString(Constants::WEBSITE) + "#download",
            tr("Get the full version").toUpper()
            ));
    buy->setOpenExternalLinks(true);
    buy->setMargin(7);
    buy->setAlignment(Qt::AlignRight);
    buy->setStyleSheet("QLabel {"
                       "background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #CCD6E0, stop: 1 #ADBCCC);"
                       "border-bottom-left-radius: 8px;"
                       "border-bottom-right-radius: 8px;"
                       "font-size: 10px;"
                       "margin-right: 50px;"
                       "}");
    mainLayout->addWidget(buy, 0, Qt::AlignRight);
#endif

    mainLayout->addStretch();
    mainLayout->addSpacing(PADDING);

    QBoxLayout *hLayout = new QHBoxLayout();
    hLayout->setAlignment(Qt::AlignCenter);
    mainLayout->addLayout(hLayout);

    QLabel *logo = new QLabel(this);
    logo->setPixmap(QPixmap(":/images/app.png"));
    hLayout->addWidget(logo, 0, Qt::AlignTop);
    hLayout->addSpacing(PADDING);

    QVBoxLayout *layout = new QVBoxLayout();
    layout->setAlignment(Qt::AlignCenter);
    hLayout->addLayout(layout);

    QLabel *welcomeLabel =
            new QLabel("<h1 style='font-weight:normal'>" +
                       tr("Welcome to <a href='%1'>%2</a>,")
                       // .replace("<a ", "<a style='color:palette(text)'")
                       .replace("<a href", "<a style='text-decoration:none; color:palette(text); font-weight:bold' href")
                       .arg(Constants::WEBSITE, Constants::APP_NAME)
                       + "</h1>", this);
    welcomeLabel->setOpenExternalLinks(true);
    layout->addWidget(welcomeLabel);

    layout->addSpacing(PADDING / 2);

    QBoxLayout *tipLayout = new QHBoxLayout();
    tipLayout->setSpacing(10);

    //: "Enter", as in "type". The whole frase says: "Enter a keyword to start watching videos"
    QLabel *tipLabel = new QLabel(tr("Enter"), this);
    tipLabel->setFont(biggerFont);
    tipLayout->addWidget(tipLabel);

    typeCombo = new QComboBox(this);
    typeCombo->addItem(tr("a keyword"));
    typeCombo->addItem(tr("a channel"));
    typeCombo->setFont(biggerFont);
    connect(typeCombo, SIGNAL(currentIndexChanged(int)), SLOT(searchTypeChanged(int)));
    tipLayout->addWidget(typeCombo);

    tipLabel = new QLabel(tr("to start watching videos."), this);
    tipLabel->setFont(biggerFont);
    tipLayout->addWidget(tipLabel);
    layout->addLayout(tipLayout);

    layout->addSpacing(PADDING / 2);

    QHBoxLayout *searchLayout = new QHBoxLayout();
    searchLayout->setAlignment(Qt::AlignVCenter);

    queryEdit = new SearchLineEdit(this);
    queryEdit->setFont(biggerFont);
    queryEdit->setMinimumWidth(queryEdit->fontInfo().pixelSize()*15);
    queryEdit->sizeHint();
    queryEdit->setFocus(Qt::OtherFocusReason);
    connect(queryEdit, SIGNAL(search(const QString&)), this, SLOT(watch(const QString&)));
    connect(queryEdit, SIGNAL(textChanged(const QString &)), this, SLOT(textChanged(const QString &)));

    youtubeSuggest = new YouTubeSuggest(this);
    channelSuggest = new ChannelSuggest(this);
    searchTypeChanged(0);

    searchLayout->addWidget(queryEdit);
    searchLayout->addSpacing(10);

    watchButton = new QPushButton(tr("Watch"), this);
    watchButton->setDefault(true);
    watchButton->setEnabled(false);
    watchButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
    connect(watchButton, SIGNAL(clicked()), this, SLOT(watch()));
    searchLayout->addWidget(watchButton);

    layout->addItem(searchLayout);

    layout->addSpacing(PADDING / 2);

    QHBoxLayout *otherLayout = new QHBoxLayout();
    otherLayout->setMargin(0);
    otherLayout->setSpacing(10);

    recentKeywordsLayout = new QVBoxLayout();
    recentKeywordsLayout->setSpacing(5);
    recentKeywordsLayout->setAlignment(Qt::AlignTop | Qt::AlignLeft);
    recentKeywordsLabel = new QLabel(tr("Recent keywords").toUpper(), this);
#if defined(APP_MAC) | defined(APP_WIN)
    QPalette palette = recentKeywordsLabel->palette();
    palette.setColor(QPalette::WindowText, QColor(0x65, 0x71, 0x80));
    recentKeywordsLabel->setPalette(palette);
#else
    recentKeywordsLabel->setForegroundRole(QPalette::Dark);
#endif
    recentKeywordsLabel->hide();
    recentKeywordsLabel->setFont(smallerFont);
    recentKeywordsLayout->addWidget(recentKeywordsLabel);

    otherLayout->addLayout(recentKeywordsLayout);

    // recent channels
    recentChannelsLayout = new QVBoxLayout();
    recentChannelsLayout->setSpacing(5);
    recentChannelsLayout->setAlignment(Qt::AlignTop | Qt::AlignLeft);
    recentChannelsLabel = new QLabel(tr("Recent channels").toUpper(), this);
#if defined(APP_MAC) | defined(APP_WIN)
    palette = recentChannelsLabel->palette();
    palette.setColor(QPalette::WindowText, QColor(0x65, 0x71, 0x80));
    recentChannelsLabel->setPalette(palette);
#else
    recentChannelsLabel->setForegroundRole(QPalette::Dark);
#endif
    recentChannelsLabel->hide();
    recentChannelsLabel->setFont(smallerFont);
    recentChannelsLayout->addWidget(recentChannelsLabel);

    otherLayout->addLayout(recentChannelsLayout);

    layout->addLayout(otherLayout);

    mainLayout->addSpacing(PADDING);
    mainLayout->addStretch();

    setLayout(mainLayout);

    updateChecker = 0;

#ifndef APP_MAC_STORE
    checkForUpdate();
#endif

}
Пример #29
0
QBalloonTip::QBalloonTip(QSystemTrayIcon::MessageIcon icon, const QString& title,
                         const QString& message, QSystemTrayIcon *ti)
    : QWidget(0, Qt::ToolTip), trayIcon(ti), timerId(-1)
{
    setAttribute(Qt::WA_DeleteOnClose);
    QObject::connect(ti, SIGNAL(destroyed()), this, SLOT(close()));

    QLabel *titleLabel = new QLabel;
    titleLabel->installEventFilter(this);
    titleLabel->setText(title);
    QFont f = titleLabel->font();
    f.setBold(true);
#ifdef Q_OS_WINCE
    f.setPointSize(f.pointSize() - 2);
#endif
    titleLabel->setFont(f);
    titleLabel->setTextFormat(Qt::PlainText); // to maintain compat with windows

#ifdef Q_OS_WINCE
    const int iconSize = style()->pixelMetric(QStyle::PM_SmallIconSize);
    const int closeButtonSize = style()->pixelMetric(QStyle::PM_SmallIconSize) - 2;
#else
    const int iconSize = 18;
    const int closeButtonSize = 15;
#endif

    QPushButton *closeButton = new QPushButton;
    closeButton->setIcon(style()->standardIcon(QStyle::SP_TitleBarCloseButton));
    closeButton->setIconSize(QSize(closeButtonSize, closeButtonSize));
    closeButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
    closeButton->setFixedSize(closeButtonSize, closeButtonSize);
    QObject::connect(closeButton, SIGNAL(clicked()), this, SLOT(close()));

    QLabel *msgLabel = new QLabel;
#ifdef Q_OS_WINCE
    f.setBold(false);
    msgLabel->setFont(f);
#endif
    msgLabel->installEventFilter(this);
    msgLabel->setText(message);
    msgLabel->setTextFormat(Qt::PlainText);
    msgLabel->setAlignment(Qt::AlignTop | Qt::AlignLeft);

    // smart size for the message label
#ifdef Q_OS_WINCE
    int limit = QApplication::desktop()->availableGeometry(msgLabel).size().width() / 2;
#else
    int limit = QApplication::desktop()->availableGeometry(msgLabel).size().width() / 3;
#endif
    if (msgLabel->sizeHint().width() > limit) {
        msgLabel->setWordWrap(true);
        if (msgLabel->sizeHint().width() > limit) {
            msgLabel->d_func()->ensureTextControl();
            if (QTextControl *control = msgLabel->d_func()->control) {
                QTextOption opt = control->document()->defaultTextOption();
                opt.setWrapMode(QTextOption::WrapAnywhere);
                control->document()->setDefaultTextOption(opt);
            }
        }
#ifdef Q_OS_WINCE
        // Make sure that the text isn't wrapped "somewhere" in the balloon widget
        // in the case that we have a long title label.
        setMaximumWidth(limit);
#else
        // Here we allow the text being much smaller than the balloon widget
        // to emulate the weird standard windows behavior.
        msgLabel->setFixedSize(limit, msgLabel->heightForWidth(limit));
#endif
    }

    QIcon si;
    switch (icon) {
    case QSystemTrayIcon::Warning:
        si = style()->standardIcon(QStyle::SP_MessageBoxWarning);
        break;
    case QSystemTrayIcon::Critical:
	si = style()->standardIcon(QStyle::SP_MessageBoxCritical);
        break;
    case QSystemTrayIcon::Information:
	si = style()->standardIcon(QStyle::SP_MessageBoxInformation);
        break;
    case QSystemTrayIcon::NoIcon:
    default:
        break;
    }

    QGridLayout *layout = new QGridLayout;
    if (!si.isNull()) {
        QLabel *iconLabel = new QLabel;
        iconLabel->setPixmap(si.pixmap(iconSize, iconSize));
        iconLabel->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
        iconLabel->setMargin(2);
        layout->addWidget(iconLabel, 0, 0);
        layout->addWidget(titleLabel, 0, 1);
    } else {
        layout->addWidget(titleLabel, 0, 0, 1, 2);
    }

    layout->addWidget(closeButton, 0, 2);
    layout->addWidget(msgLabel, 1, 0, 1, 3);
    layout->setSizeConstraint(QLayout::SetFixedSize);
    layout->setMargin(3);
    setLayout(layout);

    QPalette pal = palette();
    pal.setColor(QPalette::Window, QColor(0xff, 0xff, 0xe1));
    pal.setColor(QPalette::WindowText, Qt::black);
    setPalette(pal);
}
Пример #30
0
void MainWindow::refresh()
{
    sortedValues->setVisible(false);
    if (tree.size() >= 1) {
        deleteKeyButton->setVisible(true);
        searchButton->setVisible(true);
    } else {
        deleteKeyButton->setVisible(false);
        searchButton->setVisible(false);
    }
    if (tree.size() >= 2) sortButton->setVisible(true);
    else sortButton->setVisible(false);

    delete treeWidget;
    treeWidget = nullptr;
    treeWidget = new QWidget();

    QHBoxLayout *treeLayout = new QHBoxLayout();
    treeLayout->setAlignment(Qt::AlignTop | Qt::AlignCenter);

    tree.inOrder();
    std::vector<int> values = tree.getInorderVector();
    std::vector<int> heights = tree.getHeights();

    for (int i = 0; i < (int)values.size(); i++) {
        QVBoxLayout *vl = new QVBoxLayout();
        QLabel *ql = new QLabel(QString::fromStdString(std::to_string(values[i])));

        vl->addWidget(ql);
        vl->setAlignment(Qt::AlignTop);
        vl->setSpacing(0);

        QPalette pal = ql->palette();
        int cval = (heights[i] * 10) % 125;
        pal.setColor(QPalette::Window, QColor(50+cval, 120+cval, 100+(cval *1.01), 128));

        if(heights[i]-1 == 0) {
            pal.setColor(QPalette::Window, QColor(200,200,50,128));
        }
        if(found && values[i] == foundVal) {
            pal.setColor(QPalette::Window, QColor(150,122, 200, 128));
            found = false;
        }
        ql->setAutoFillBackground(true);
        ql->setPalette(pal);
        ql->setFixedHeight(20);

        for (int j = 0; j < heights[i]-1; j++) {
            QLabel *littlel = new QLabel(" ");
            vl->addWidget(littlel);
            littlel->setAutoFillBackground(true);
            littlel->setPalette(pal);
            littlel->setFixedHeight(20);
        }

        QFont f;
        f.setPointSize(17);
        f.setBold(true);
        ql->setFont(f);


        treeLayout->addLayout(vl);
    }
    treeWidget->setLayout(treeLayout);
    mainLayout->addWidget(treeWidget);
    mainLayout->addWidget(sortButton);
}