コード例 #1
0
ファイル: qsystemtrayicon.cpp プロジェクト: CodeDJ/qt5-hidpi
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 (QWidgetTextControl *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);
}
コード例 #2
0
ファイル: window.cpp プロジェクト: guziemic/QtTraining
Window::Window(QWidget *parent)
    : QWidget(parent)
{
    //create sort filter models
    sortFilterModel = new QSortFilterProxyModel(this);
    customSortFilterModel = new MySortFilterProxyModel;

    // create views
    sourceView = new QTreeView;
    sourceView->setRootIsDecorated(false);
    sourceView->setAlternatingRowColors(true);

    proxyView = new QTreeView;
    proxyView->setRootIsDecorated(false);
    proxyView->setAlternatingRowColors(true);
    proxyView->setModel(sortFilterModel);
    proxyView->setSortingEnabled(true);

    //layouting
    sourceGroupBox = new QGroupBox(tr("Original Model"));
    proxyGroupBox = new QGroupBox(tr("Sorted/Filtered model"));

    QHBoxLayout *sourceLayout = new QHBoxLayout;
    sourceLayout->addWidget(sourceView);
    sourceGroupBox->setLayout(sourceLayout);

    QGridLayout *proxyLayout = new QGridLayout;
    proxyLayout->addWidget(proxyView, 0, 0, 1, 3);

    proxyGroupBox->setLayout(proxyLayout);

    simpleRadioBtn = new QRadioButton(tr("Si&mple"));
    advancedRadioBtn = new QRadioButton(tr("&Advanced"));
    customModelCheckBox = new QCheckBox(tr("&Custom model"));
    QHBoxLayout *radioButtonsLayout = new QHBoxLayout;
    radioButtonsLayout->addWidget(simpleRadioBtn);
    radioButtonsLayout->addWidget(advancedRadioBtn);
    radioButtonsLayout->addWidget(customModelCheckBox);
    QWidget *radioWidget = new QWidget;
    radioWidget->setLayout(radioButtonsLayout);

    simpleRadioBtn->setChecked(true);
    customModelCheckBox->setChecked(false);

    QVBoxLayout *mainLayout = new QVBoxLayout;
    mainLayout->addWidget(radioWidget);
    mainLayout->addWidget(sourceGroupBox);
    mainLayout->addWidget(proxyGroupBox);

    setLayout(mainLayout);
    setWindowTitle(tr("Basic sort / filter model"));
    resize(600, 450);


    //adding more advance controls
    sortCaseSessitivityCheckBox = new QCheckBox(tr("Case sensitive sorting"));
    filterCaseSensitivityCheckBox = new QCheckBox(tr("Case sensitive filter"));

    filterPatternLineEdit = new QLineEdit;
    filterPatternLabel = new QLabel(tr("&Filter pattern:"));
    filterPatternLabel->setBuddy(filterPatternLineEdit);

    filterSyntaxComboBox = new QComboBox;
    filterSyntaxComboBox->addItem(tr("Regular expression"), QRegExp::RegExp);
    filterSyntaxComboBox->addItem(tr("Wildcard"), QRegExp::Wildcard);
    filterSyntaxComboBox->addItem(tr("Fixed string"), QRegExp::FixedString);
    filterSyntaxLabel = new QLabel(tr("Filter &syntax:"));
    filterSyntaxLabel->setBuddy(filterSyntaxComboBox);

    filterColumnComboBox = new QComboBox;
    filterColumnComboBox->addItem(tr("Hotel"));
    filterColumnComboBox->addItem(tr("Price"));
    filterColumnComboBox->addItem(tr("Sender"));
    filterColumnComboBox->addItem(tr("Date"));
    filterColumnLabel = new QLabel(tr("Filter &column"));
    filterColumnLabel->setBuddy(filterColumnComboBox);

    connect(filterPatternLineEdit, &QLineEdit::textChanged, this, &Window::filterRegExpChanged);
    connect(filterSyntaxComboBox, static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
            this, &Window::filterRegExpChanged);
    connect(filterColumnComboBox, static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
            this, &Window::filterColumnChanged);
    connect(filterCaseSensitivityCheckBox, &QCheckBox::toggled, this, &Window::filterRegExpChanged);
    connect(sortCaseSessitivityCheckBox, &QCheckBox::toggled, this, &Window::sortChanged);

    //date filtering widgets
    fromDateEdit = new QDateEdit;
    fromDateEdit->setDate(QDate(1970, 01, 01));
    fromDateLabel = new QLabel(tr("&From:"));
    fromDateLabel->setBuddy(fromDateEdit);

    toDateEdit = new QDateEdit;
    toDateEdit->setDate(QDate(2099, 12, 31));
    toDateLabel = new QLabel(tr("&To"));
    toDateLabel->setBuddy(toDateEdit);
    //and connect it to handling slots
    connect(fromDateEdit, &QDateEdit::dateChanged, this, &Window::dateFilterChanged);
    connect(toDateEdit, &QDateEdit::dateChanged, this, &Window::dateFilterChanged);

    fromDateEdit->hide();
    fromDateLabel->hide();
    toDateEdit->hide();
    toDateLabel->hide();

    proxyLayout->addWidget(filterPatternLabel, 1, 0);
    proxyLayout->addWidget(filterPatternLineEdit, 1, 1, 1, 2);
    proxyLayout->addWidget(filterSyntaxLabel, 2, 0);
    proxyLayout->addWidget(filterSyntaxComboBox, 2, 1, 1, 2);
    proxyLayout->addWidget(filterColumnLabel, 3, 0);
    proxyLayout->addWidget(filterColumnComboBox, 3, 1, 1, 2);
    proxyLayout->addWidget(filterCaseSensitivityCheckBox, 4, 0 , 1, 2);
    proxyLayout->addWidget(sortCaseSessitivityCheckBox, 4, 2);
    proxyLayout->addWidget(fromDateLabel, 5, 0);
    proxyLayout->addWidget(fromDateEdit, 5, 1, 1, 2);
    proxyLayout->addWidget(toDateLabel, 6, 0);
    proxyLayout->addWidget(toDateEdit, 6, 1, 1, 2);

    disableAdvanceMode();

    connect(simpleRadioBtn, &QRadioButton::clicked, this, &Window::radioToggled);
    connect(advancedRadioBtn, &QRadioButton::clicked, this, &Window::radioToggled);
    connect(customModelCheckBox, &QCheckBox::clicked, this, &Window::manualFilterToggled);
}
コード例 #3
0
ファイル: BatchExportDlg.cpp プロジェクト: Siddharthk/opticks
BatchExportDlg::BatchExportDlg(ExporterResource& exporter, const vector<PlugInDescriptor*>& availablePlugIns,
                               QWidget* pParent) :
   QDialog(pParent),
   mpExporter(exporter)
{
   // Directory
   QLabel* pDirectoryLabel = new QLabel("Directory:", this);
   mpDirectoryEdit = new QLineEdit(this);

   QIcon icnBrowse(":/icons/Open");

   QPushButton* pBrowseButton = new QPushButton(icnBrowse, QString(), this);
   pBrowseButton->setFixedWidth(27);

   // Exporter
   QLabel* pExporterLabel = new QLabel("Exporter:", this);
   mpExporterCombo = new QComboBox(this);
   mpExporterCombo->setEditable(false);

   // File extension
   QLabel* pExtensionLabel = new QLabel("File Extension:", this);
   mpExtensionCombo = new QComboBox(this);
   mpExtensionCombo->setEditable(false);

   // Horizontal line
   QFrame* pHLine = new QFrame(this);
   pHLine->setFrameStyle(QFrame::HLine | QFrame::Sunken);

   // Buttons
   QDialogButtonBox* pButtonBox = new QDialogButtonBox(this);
   pButtonBox->setOrientation(Qt::Horizontal);
   pButtonBox->setStandardButtons(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);

   // Layout
   QGridLayout* pGrid = new QGridLayout(this);
   pGrid->setMargin(10);
   pGrid->setSpacing(10);
   pGrid->addWidget(pDirectoryLabel, 0, 0);
   pGrid->addWidget(mpDirectoryEdit, 0, 1);
   pGrid->addWidget(pBrowseButton, 0, 2);
   pGrid->addWidget(pExporterLabel, 1, 0);
   pGrid->addWidget(mpExporterCombo, 1, 1, 1, 2);
   pGrid->addWidget(pExtensionLabel, 2, 0);
   pGrid->addWidget(mpExtensionCombo, 2, 1, 1, 2, Qt::AlignLeft);
   pGrid->addWidget(pHLine, 3, 0, 1, 3, Qt::AlignBottom);
   pGrid->addWidget(pButtonBox, 4, 0, 1, 3);
   pGrid->setRowStretch(3, 10);
   pGrid->setColumnStretch(1, 10);

   // Initialization
   mpDirectoryEdit->setText(QDir::currentPath());

   vector<PlugInDescriptor*>::const_iterator iter;
   for (iter = availablePlugIns.begin(); iter != availablePlugIns.end(); ++iter)
   {
      PlugInDescriptor* pDescriptor = *iter;
      if (pDescriptor != NULL)
      {
         // Exporters
         QString strExporter = QString::fromStdString(pDescriptor->getName());
         mpExporterCombo->addItem(strExporter);

         // File extensions
         QStringList extensions;

         string filters = pDescriptor->getFileExtensions();
         if (filters.empty() == false)
         {
            QString strFilters = QString::fromStdString(filters);
            QStringList filterList = strFilters.split(";;", QString::SkipEmptyParts);

            for (int i = 0; i < filterList.count(); ++i)
            {
               QString strFilter = filterList[i];
               if (strFilter.isEmpty() == false)
               {
                  QFileInfo filterInfo(strFilter);
                  QString strDefault = filterInfo.completeSuffix();

                  int parenIndex = strDefault.indexOf(")");
                  int spaceIndex = strDefault.indexOf(" ");

                  int index = parenIndex;
                  if (parenIndex != -1)
                  {
                     if ((spaceIndex < parenIndex) && (spaceIndex != -1))
                     {
                        index = spaceIndex;
                     }

                     strDefault.truncate(index);

                     QString strExtension = strDefault.trimmed();
                     if (strExtension.isEmpty() == false)
                     {
                        extensions.append(strExtension);
                     }
                  }
               }
            }
         }

         mpExtensionCombo->addItems(extensions);
         mFileExtensions.insert(strExporter, extensions);
      }
   }

   updateExporter(mpExporterCombo->currentText());
   updateFileExtensions();

   setModal(true);
   setWindowTitle("Export");
   resize(450, 200);

   // Connections
   VERIFYNR(connect(pBrowseButton, SIGNAL(clicked()), this, SLOT(browse())));
   VERIFYNR(connect(mpExporterCombo, SIGNAL(currentIndexChanged(const QString&)), this,
      SLOT(updateExporter(const QString&))));
   VERIFYNR(connect(mpExporterCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(updateFileExtensions())));
   VERIFYNR(connect(pButtonBox, SIGNAL(accepted()), this, SLOT(accept())));
   VERIFYNR(connect(pButtonBox, SIGNAL(rejected()), this, SLOT(reject())));
}
コード例 #4
0
/** The constructor for a single set of widgets containing parameters for the labeling and format of an axis.
*  @param app :: the containing application window
*  @param graph :: the graph the dialog is settign the options for
*  @param mappedaxis :: the QwtPlot::axis value that corresponds to this axis
*  @param parent :: the QWidget that acts as this widget's parent in the hierachy
*/
AxisDetails::AxisDetails(ApplicationWindow* app, Graph* graph, int mappedaxis, QWidget *parent) : QWidget(parent)
{
  m_app = app;
  m_graph = graph;
  m_tablesList = m_app->tableNames();
  m_mappedaxis = mappedaxis;
  m_initialised = false;
  QHBoxLayout * topLayout = new QHBoxLayout();

  m_chkShowAxis = new QCheckBox(tr("Show"));
  topLayout->addWidget(m_chkShowAxis);

  m_grpTitle = new QGroupBox(tr("Title"));
  topLayout->addWidget(m_grpTitle);

  QVBoxLayout *titleBoxLayout = new QVBoxLayout(m_grpTitle);
  titleBoxLayout->setSpacing(2);

  m_txtTitle = new QTextEdit();
  m_txtTitle->setTextFormat(Qt::PlainText);
  QFontMetrics metrics(this->font());
  m_txtTitle->setMaximumHeight(3 * metrics.height());
  titleBoxLayout->addWidget(m_txtTitle);

  QHBoxLayout *hl = new QHBoxLayout();
  hl->setMargin(0);
  hl->setSpacing(2);
  m_btnLabelFont = new QPushButton(tr("&Font"));
  hl->addWidget(m_btnLabelFont);

  m_formatButtons = new TextFormatButtons(m_txtTitle, TextFormatButtons::AxisLabel);
  hl->addWidget(m_formatButtons);
  hl->addStretch();

  m_txtTitle->setMaximumWidth(m_btnLabelFont->width() + m_formatButtons->width());
  titleBoxLayout->addLayout(hl);

  QHBoxLayout * bottomLayout = new QHBoxLayout();

  m_grpAxisDisplay = new QGroupBox(QString());
  bottomLayout->addWidget(m_grpAxisDisplay);
  QGridLayout * leftBoxLayout = new QGridLayout(m_grpAxisDisplay);

  leftBoxLayout->addWidget(new QLabel(tr("Type")), 0, 0);

  m_cmbAxisType = new QComboBox();
  m_cmbAxisType->addItem(tr("Numeric"));
  m_cmbAxisType->addItem(tr("Text from table"));
  m_cmbAxisType->addItem(tr("Day of the week"));
  m_cmbAxisType->addItem(tr("Month"));
  m_cmbAxisType->addItem(tr("Time"));
  m_cmbAxisType->addItem(tr("Date"));
  m_cmbAxisType->addItem(tr("Column Headings"));
  leftBoxLayout->addWidget(m_cmbAxisType, 0, 1);

  leftBoxLayout->addWidget(new QLabel(tr("Font")), 1, 0);

  m_btnAxesFont = new QPushButton();
  m_btnAxesFont->setText(tr("Axis &Font"));
  leftBoxLayout->addWidget(m_btnAxesFont, 1, 1);

  leftBoxLayout->addWidget(new QLabel(tr("Color")), 2, 0);
  m_cbtnAxisColor = new ColorButton();
  leftBoxLayout->addWidget(m_cbtnAxisColor, 2, 1);

  leftBoxLayout->addWidget(new QLabel(tr("Major Ticks")), 3, 0);

  m_cmbMajorTicksType = new QComboBox();
  m_cmbMajorTicksType->addItem(tr("None"));
  m_cmbMajorTicksType->addItem(tr("Out"));
  m_cmbMajorTicksType->addItem(tr("In & Out"));
  m_cmbMajorTicksType->addItem(tr("In"));
  leftBoxLayout->addWidget(m_cmbMajorTicksType, 3, 1);

  leftBoxLayout->addWidget(new QLabel(tr("Minor Ticks")), 4, 0);

  m_cmbMinorTicksType = new QComboBox();
  m_cmbMinorTicksType->addItem(tr("None"));
  m_cmbMinorTicksType->addItem(tr("Out"));
  m_cmbMinorTicksType->addItem(tr("In & Out"));
  m_cmbMinorTicksType->addItem(tr("In"));
  leftBoxLayout->addWidget(m_cmbMinorTicksType, 4, 1);

  leftBoxLayout->addWidget(new QLabel(tr("Stand-off")), 5, 0);
  m_spnBaseline = new QSpinBox();
  m_spnBaseline->setRange(0, 1000);
  leftBoxLayout->addWidget(m_spnBaseline);

  m_grpShowLabels = new QGroupBox(tr("Show Labels"));
  m_grpShowLabels->setCheckable(true);
  m_grpShowLabels->setChecked(true);

  bottomLayout->addWidget(m_grpShowLabels);
  QGridLayout *rightBoxLayout = new QGridLayout(m_grpShowLabels);

  m_lblColumn = new QLabel(tr("Column"));
  rightBoxLayout->addWidget(m_lblColumn, 0, 0);

  m_cmbColName = new QComboBox();
  rightBoxLayout->addWidget(m_cmbColName, 0, 1);

  m_lblTable = new QLabel(tr("Table"));
  rightBoxLayout->addWidget(m_lblTable, 1, 0);

  m_cmbTableName = new QComboBox();
  m_cmbTableName->insertStringList(m_tablesList);
  m_cmbColName->insertStringList(m_app->columnsList(Table::All));
  rightBoxLayout->addWidget(m_cmbTableName, 1, 1);

  m_lblFormat = new QLabel(tr("Format"));
  rightBoxLayout->addWidget(m_lblFormat, 2, 0);

  m_cmbFormat = new QComboBox();
  m_cmbFormat->setDuplicatesEnabled(false);
  rightBoxLayout->addWidget(m_cmbFormat, 2, 1);

  m_lblPrecision = new QLabel(tr("Precision"));
  rightBoxLayout->addWidget(m_lblPrecision, 3, 0);
  m_spnPrecision = new QSpinBox();
  m_spnPrecision->setRange(0, 10);
  rightBoxLayout->addWidget(m_spnPrecision, 3, 1);

  rightBoxLayout->addWidget(new QLabel(tr("Angle")), 4, 0);

  m_spnAngle = new QSpinBox();
  m_spnAngle->setRange(-90, 90);
  m_spnAngle->setSingleStep(5);
  rightBoxLayout->addWidget(m_spnAngle, 4, 1);

  rightBoxLayout->addWidget(new QLabel(tr("Color")), 5, 0);
  m_cbtnAxisNumColor = new ColorButton();
  rightBoxLayout->addWidget(m_cbtnAxisNumColor, 5, 1);

  m_chkShowFormula = new QCheckBox(tr("For&mula"));
  rightBoxLayout->addWidget(m_chkShowFormula, 6, 0);

  m_txtFormula = new QTextEdit();
  m_txtFormula->setTextFormat(Qt::PlainText);
  m_txtFormula->setMaximumHeight(3 * metrics.height());
  //m_txtFormula->hide();
  rightBoxLayout->addWidget(m_txtFormula, 6, 1);
  rightBoxLayout->setRowStretch(7, 1);

  QVBoxLayout * rightLayout = new QVBoxLayout(this);
  rightLayout->addLayout(topLayout);
  rightLayout->addLayout(bottomLayout);
  rightLayout->addStretch(1);

  connect(m_chkShowFormula, SIGNAL(clicked()), this, SLOT(enableFormulaBox()));
  connect(m_cmbAxisType, SIGNAL(activated(int)), this, SLOT(setAxisFormatOptions(int)));

  connect(m_grpShowLabels, SIGNAL(clicked(bool)), this,  SLOT(showAxis()));
  connect(m_chkShowAxis, SIGNAL(clicked()), this, SLOT(showAxis()));
  connect(m_cmbFormat, SIGNAL(activated(int)), this,  SLOT(showAxis()));

  connect(m_btnAxesFont, SIGNAL(clicked()), this, SLOT(setScaleFont()));
  connect(m_btnLabelFont, SIGNAL(clicked()), this, SLOT(setLabelFont()));

  initWidgets();
}
コード例 #5
0
ファイル: info_panels.cpp プロジェクト: Flameeyes/vlc
/**
 * 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() - 2 );
    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  );

    seqnum_text = new QLineEdit;
    seqnum_text->setMaximumWidth( 60 );
    metaLayout->addWidget( seqnum_text, line, 7, 1, 1 );

    label = new QLabel( "/" ); label->setFont( smallFont );
    metaLayout->addWidget( label, line, 8, 1, 1 );

    seqtot_text = new QLineEdit;
    seqtot_text->setMaximumWidth( 60 );
    metaLayout->addWidget( seqtot_text, line, 9, 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( seqnum_text, textEdited( QString ), this, enterEditMode() );
    CONNECT( seqtot_text, textEdited( QString ), this, enterEditMode() );

    CONNECT( date_text, textEdited( QString ), this, enterEditMode() );
/*    CONNECT( rating_text, valueChanged( QString ), this, enterEditMode( QString ) );*/

    /* We are not yet in Edit Mode */
    b_inEditMode = false;
}
コード例 #6
0
ViewSettingsTab::ViewSettingsTab(Mode mode, QWidget* parent) :
    QWidget(parent),
    m_mode(mode),
    m_defaultSizeSlider(0),
    m_previewSizeSlider(0),
    m_fontRequester(0),
    m_widthBox(0),
    m_maxLinesBox(0),
    m_expandableFolders(0)
{
    QVBoxLayout* topLayout = new QVBoxLayout(this);

    // Create "Icon Size" group
    QGroupBox* iconSizeGroup = new QGroupBox(this);
    iconSizeGroup->setTitle(i18nc("@title:group", "Icon Size"));

    const int minRange = ZoomLevelInfo::minimumLevel();
    const int maxRange = ZoomLevelInfo::maximumLevel();

    QLabel* defaultLabel = new QLabel(i18nc("@label:listbox", "Default:"), this);
    m_defaultSizeSlider = new QSlider(Qt::Horizontal, this);
    m_defaultSizeSlider->setPageStep(1);
    m_defaultSizeSlider->setTickPosition(QSlider::TicksBelow);
    m_defaultSizeSlider->setRange(minRange, maxRange);
    connect(m_defaultSizeSlider, SIGNAL(valueChanged(int)),
            this, SLOT(slotDefaultSliderMoved(int)));

    QLabel* previewLabel = new QLabel(i18nc("@label:listbox", "Preview:"), this);
    m_previewSizeSlider = new QSlider(Qt::Horizontal, this);
    m_previewSizeSlider->setPageStep(1);
    m_previewSizeSlider->setTickPosition(QSlider::TicksBelow);
    m_previewSizeSlider->setRange(minRange, maxRange);
    connect(m_previewSizeSlider, SIGNAL(valueChanged(int)),
            this, SLOT(slotPreviewSliderMoved(int)));

    QGridLayout* layout = new QGridLayout(iconSizeGroup);
    layout->addWidget(defaultLabel, 0, 0, Qt::AlignRight);
    layout->addWidget(m_defaultSizeSlider, 0, 1);
    layout->addWidget(previewLabel, 1, 0, Qt::AlignRight);
    layout->addWidget(m_previewSizeSlider, 1, 1);

    // Create "Text" group
    QGroupBox* textGroup = new QGroupBox(i18nc("@title:group", "Text"), this);

    QLabel* fontLabel = new QLabel(i18nc("@label:listbox", "Font:"), textGroup);
    m_fontRequester = new DolphinFontRequester(textGroup);

    QGridLayout* textGroupLayout = new QGridLayout(textGroup);
    textGroupLayout->addWidget(fontLabel, 0, 0, Qt::AlignRight);
    textGroupLayout->addWidget(m_fontRequester, 0, 1);

    switch (m_mode) {
    case IconsMode: {
        QLabel* widthLabel = new QLabel(i18nc("@label:listbox", "Width:"), textGroup);
        m_widthBox = new KComboBox(textGroup);
        m_widthBox->addItem(i18nc("@item:inlistbox Text width", "Small"));
        m_widthBox->addItem(i18nc("@item:inlistbox Text width", "Medium"));
        m_widthBox->addItem(i18nc("@item:inlistbox Text width", "Large"));
        m_widthBox->addItem(i18nc("@item:inlistbox Text width", "Huge"));

        QLabel* maxLinesLabel = new QLabel(i18nc("@label:listbox", "Maximum lines:"), textGroup);
        m_maxLinesBox = new KComboBox(textGroup);
        m_maxLinesBox->addItem(i18nc("@item:inlistbox Maximum lines", "Unlimited"));
        m_maxLinesBox->addItem(i18nc("@item:inlistbox Maximum lines", "1"));
        m_maxLinesBox->addItem(i18nc("@item:inlistbox Maximum lines", "2"));
        m_maxLinesBox->addItem(i18nc("@item:inlistbox Maximum lines", "3"));
        m_maxLinesBox->addItem(i18nc("@item:inlistbox Maximum lines", "4"));
        m_maxLinesBox->addItem(i18nc("@item:inlistbox Maximum lines", "5"));

        textGroupLayout->addWidget(widthLabel, 2, 0, Qt::AlignRight);
        textGroupLayout->addWidget(m_widthBox, 2, 1);
        textGroupLayout->addWidget(maxLinesLabel, 3, 0, Qt::AlignRight);
        textGroupLayout->addWidget(m_maxLinesBox, 3, 1);
        break;
    }
    case CompactMode: {
        QLabel* maxWidthLabel = new QLabel(i18nc("@label:listbox", "Maximum width:"), textGroup);
        m_widthBox = new KComboBox(textGroup);
        m_widthBox->addItem(i18nc("@item:inlistbox Maximum width", "Unlimited"));
        m_widthBox->addItem(i18nc("@item:inlistbox Maximum width", "Small"));
        m_widthBox->addItem(i18nc("@item:inlistbox Maximum width", "Medium"));
        m_widthBox->addItem(i18nc("@item:inlistbox Maximum width", "Large"));

        textGroupLayout->addWidget(maxWidthLabel, 2, 0, Qt::AlignRight);
        textGroupLayout->addWidget(m_widthBox, 2, 1);
        break;
    }
    case DetailsMode:
        m_expandableFolders = new QCheckBox(i18nc("@option:check", "Expandable folders"), this);
        break;
    default:
        break;
    }

    topLayout->addWidget(iconSizeGroup);
    topLayout->addWidget(textGroup);
    topLayout->addWidget(m_expandableFolders);
    topLayout->addStretch(1);

    loadSettings();

    connect(m_defaultSizeSlider, SIGNAL(valueChanged(int)), this, SIGNAL(changed()));
    connect(m_previewSizeSlider, SIGNAL(valueChanged(int)), this, SIGNAL(changed()));
    connect(m_fontRequester, SIGNAL(changed()), this, SIGNAL(changed()));

    switch (m_mode) {
    case IconsMode:
        connect(m_widthBox, SIGNAL(currentIndexChanged(int)), this, SIGNAL(changed()));
        connect(m_maxLinesBox, SIGNAL(currentIndexChanged(int)), this, SIGNAL(changed()));
        break;
    case CompactMode:
        connect(m_widthBox, SIGNAL(currentIndexChanged(int)), this, SIGNAL(changed()));
        break;
    case DetailsMode:
        connect(m_expandableFolders, SIGNAL(toggled(bool)), this, SIGNAL(changed()));
        break;
    default:
        break;
    }
}
コード例 #7
0
cproject_matrix_widget::cproject_matrix_widget(QString projectPath)
{
    this->projectPath = projectPath;
    this->open_prof_prefs_btn = new QPushButton( QIcon( ":/resources/img/event_edit_matrix_op.png" ), tr( "Open Matrix Parser" ) );
    this->open_prof_prefs_btn->setMinimumHeight( 40 );
    this->open_prof_prefs_btn->setIconSize( QSize( 32,32 ) );
    this->grpbx_available_templates = new QGroupBox( tr( "Available Topics" ) );
    this->grpbx_available_templates->setAutoFillBackground( false );
    this->grpbx_available_templates->setEnabled( false );
    this->available_templates_listWidget = new QListWidget();
    QDir d( projectPath + "/sys/" );
    this->available_templates_listWidget->addItems( d.entryList( QStringList() << "*.xml", QDir::Files, QDir::Name ) );
    this->description = new QLabel( tr( "Click that button to open your project's preferences where you can setup the actors, who your game will contain, monsters that will appear, and other important stuff.If you're an advanced user, I'll be glad to hear to you can control the variation of variables of each topic.You can add the entry 'Age'' to the 'actors' topic by editing the /sys/templates/actor.xml in your project's folder." ) );
    this->description->setWordWrap( true );
    this->description->setAlignment( Qt::AlignHCenter );
    this->description->setSizePolicy( QSizePolicy::MinimumExpanding,
                                      QSizePolicy::Minimum );
    //this logo is only for get an easier paintEvent
    this->desc_logo = new QLabel();
//    desc_logo->setPixmap( QPixmap( ":/resources/img/html_preferences_example.png" ) );
//    desc_logo->setAlignment( Qt::AlignCenter );
    this->desc_logo->setSizePolicy( QSizePolicy::MinimumExpanding,
                                      QSizePolicy::MinimumExpanding );

    //this->pro_desc_label = new QLabel( tr( "Your project's description:" ) );
    //this->pro_desc_label->setAlignment( Qt::AlignCenter );
    //this->pro_desc_label->setWordWrap( true );
    //this->project_description_save_btn = new QPushButton( QIcon( ":/resources/img/save.png" ),
    //                                                      tr( "Save" ) );
    //QObject::connect( this->project_description_save_btn, SIGNAL(clicked()),
     //                this, SLOT(saveDescription()) );
    //this->project_description_textEdit = new QTextEdit();
//    this->project_description_textEdit->setAttribute( Qt::WA_NoBackground, true );
    //this->project_description_textEdit->setAutoFillBackground( false );
//    this->project_description_textEdit->setMask( this->project_description_textEdit->rect() );
    //this->project_description_textEdit->setWindowOpacity( (qreal) 50/100 );
    //this->loadDescription();

    QVBoxLayout* vb = new QVBoxLayout();
    vb->addWidget( this->available_templates_listWidget );
    this->grpbx_available_templates->setLayout( vb );

    QVBoxLayout* vb_btn_and_box = new QVBoxLayout();
    vb_btn_and_box->addWidget( this->open_prof_prefs_btn );
    vb_btn_and_box->addWidget( this->grpbx_available_templates );
    QWidget* w = new QWidget();
    w->setLayout( vb_btn_and_box );
    w->setFixedWidth( 230 );

    QVBoxLayout* spa = new QVBoxLayout();
    spa->addStretch();

    QGridLayout* gl = new QGridLayout();
    gl->setContentsMargins( 40,40,40,40 );
    gl->addWidget( w,                                   0,0,4,1 );
    gl->addWidget( this->description,                   0,1,1,2 );
    gl->addLayout( spa,                                 1,1,1,1 );
   // gl->addWidget( this->pro_desc_label,                2,1,1,1 );
   // gl->addWidget( this->project_description_save_btn,  2,2,1,1 );
    //gl->addWidget( this->project_description_textEdit,  3,1,1,2 );
    this->setLayout( gl );

    QObject::connect( this->open_prof_prefs_btn, SIGNAL(clicked()),
                      this, SIGNAL(please_workspace_open_an_project_preferences_widget()) );
}
コード例 #8
0
ファイル: convert.cpp プロジェクト: CSRedRat/vlc
ConvertDialog::ConvertDialog( QWidget *parent, intf_thread_t *_p_intf,
                              const QString& inputMRL )
              : QVLCDialog( parent, _p_intf )
{
    setWindowTitle( qtr( "Convert" ) );
    setWindowRole( "vlc-convert" );

    QGridLayout *mainLayout = new QGridLayout( this );
    SoutInputBox *inputBox = new SoutInputBox( this );
    inputBox->setMRL( inputMRL );
    mainLayout->addWidget( inputBox, 0, 0, 1, -1  );

    /**
     * Destination
     **/
    QGroupBox *destBox = new QGroupBox( qtr( "Destination" ) );
    QGridLayout *destLayout = new QGridLayout( destBox );

    QLabel *destLabel = new QLabel( qtr( "Destination file:" ) );
    destLayout->addWidget( destLabel, 0, 0);

    fileLine = new QLineEdit;
    fileLine->setMinimumWidth( 300 );
    fileLine->setFocus( Qt::ActiveWindowFocusReason );
    destLabel->setBuddy( fileLine );

    QPushButton *fileSelectButton = new QPushButton( qtr( "Browse" ) );
    destLayout->addWidget( fileLine, 0, 1 );
    destLayout->addWidget( fileSelectButton, 0, 2);
    BUTTONACT( fileSelectButton, fileBrowse() );

    displayBox = new QCheckBox( qtr( "Display the output" ) );
    displayBox->setToolTip( qtr( "This display the resulting media, but can "
                               "slow things down." ) );
    destLayout->addWidget( displayBox, 2, 0, 1, -1 );

    mainLayout->addWidget( destBox, 1, 0, 1, -1  );


    /* Profile Editor */
    QGroupBox *settingBox = new QGroupBox( qtr( "Settings" ) );
    QGridLayout *settingLayout = new QGridLayout( settingBox );

    profile = new VLCProfileSelector( this );
    settingLayout->addWidget( profile, 0, 0, 1, -1 );

    deinterBox = new QCheckBox( qtr( "Deinterlace" ) );
    settingLayout->addWidget( deinterBox, 1, 0 );

    dumpBox = new QCheckBox( qtr( "Dump raw input" ) );
    settingLayout->addWidget( dumpBox, 1, 1 );

    mainLayout->addWidget( settingBox, 3, 0, 1, -1  );

    /* Buttons */
    QPushButton *okButton = new QPushButton( qtr( "&Start" ) );
    QPushButton *cancelButton = new QPushButton( qtr( "&Cancel" ) );
    QDialogButtonBox *buttonBox = new QDialogButtonBox;

    okButton->setDefault( true );
    buttonBox->addButton( okButton, QDialogButtonBox::AcceptRole );
    buttonBox->addButton( cancelButton, QDialogButtonBox::RejectRole );

    mainLayout->addWidget( buttonBox, 5, 3 );

    BUTTONACT(okButton,close());
    BUTTONACT(cancelButton,cancel());

    CONNECT(dumpBox,toggled(bool),this,dumpChecked(bool));
}
コード例 #9
0
ファイル: QSoundBuffer.cpp プロジェクト: Deledrius/PlasmaShop
QSoundBuffer::QSoundBuffer(plCreatable* pCre, QWidget* parent)
            : QCreatable(pCre, kSoundBuffer, parent)
{
    plSoundBuffer* obj = plSoundBuffer::Convert(fCreatable);

    QGroupBox* flagGroup = new QGroupBox(tr("Flags"), this);
    fFlags[kIsExternal] = new QCheckBox(tr("External"), flagGroup);
    fFlags[kAlwaysExternal] = new QCheckBox(tr("Always External"), flagGroup);
    fFlags[kStreamCompressed] = new QCheckBox(tr("Stream Compressed"), flagGroup);
    fFlags[kOnlyLeftChannel] = new QCheckBox(tr("Left Channel Only"), flagGroup);
    fFlags[kOnlyRightChannel] = new QCheckBox(tr("Right Channel Only"), flagGroup);
    QGridLayout* flagLayout = new QGridLayout(flagGroup);
    flagLayout->setVerticalSpacing(0);
    flagLayout->setHorizontalSpacing(8);
    flagLayout->addWidget(fFlags[kIsExternal], 0, 0);
    flagLayout->addWidget(fFlags[kAlwaysExternal], 1, 0);
    flagLayout->addWidget(fFlags[kStreamCompressed], 2, 0);
    flagLayout->addWidget(fFlags[kOnlyLeftChannel], 0, 1);
    flagLayout->addWidget(fFlags[kOnlyRightChannel], 1, 1);

    fFlags[kIsExternal]->setChecked((obj->getFlags() & plSoundBuffer::kIsExternal) != 0);
    fFlags[kAlwaysExternal]->setChecked((obj->getFlags() & plSoundBuffer::kAlwaysExternal) != 0);
    fFlags[kStreamCompressed]->setChecked((obj->getFlags() & plSoundBuffer::kStreamCompressed) != 0);
    fFlags[kOnlyLeftChannel]->setChecked((obj->getFlags() & plSoundBuffer::kOnlyLeftChannel) != 0);
    fFlags[kOnlyRightChannel]->setChecked((obj->getFlags() & plSoundBuffer::kOnlyRightChannel) != 0);

    QGroupBox* headerGroup = new QGroupBox(tr("Header"), this);
    fFormat = new QComboBox(headerGroup);
    fFormat->addItems(QStringList() << "(Invalid)" << "PCM");
    fBitRate = new QIntEdit(headerGroup);
    fBitRate->setRange(0, 0xFFFF);
    fNumChannels = new QSpinBox(headerGroup);
    fNumChannels->setRange(0, 0xFFFF);
    fBlockAlign = new QIntEdit(headerGroup);
    fBlockAlign->setRange(0, 0xFFFF);
    fSampleRate = new QIntEdit(headerGroup);
    fSampleRate->setRange(0, 0x7FFFFFFF);
    fAvgBytesPerSec = new QIntEdit(headerGroup);
    fAvgBytesPerSec->setRange(0, 0x7FFFFFFF);
    QGridLayout* headerLayout = new QGridLayout(headerGroup);
    headerLayout->setVerticalSpacing(4);
    headerLayout->setHorizontalSpacing(8);
    headerLayout->addItem(new QSpacerItem(8, 0, QSizePolicy::Minimum, QSizePolicy::Minimum), 2, 2);
    headerLayout->addWidget(new QLabel(tr("Format:"), headerGroup), 0, 0);
    headerLayout->addWidget(fFormat, 0, 1);
    headerLayout->addWidget(new QLabel(tr("Bit Rate:"), headerGroup), 0, 3);
    headerLayout->addWidget(fBitRate, 0, 4);
    headerLayout->addWidget(new QLabel(tr("Channels:"), headerGroup), 1, 0);
    headerLayout->addWidget(fNumChannels, 1, 1);
    headerLayout->addWidget(new QLabel(tr("Block Align:"), headerGroup), 1, 3);
    headerLayout->addWidget(fBlockAlign, 1, 4);
    headerLayout->addWidget(new QLabel(tr("Sample Rate:"), headerGroup), 2, 0, 1, 3);
    headerLayout->addWidget(fSampleRate, 2, 3, 1, 2);
    headerLayout->addWidget(new QLabel(tr("Avg. Bytes/Second:"), headerGroup), 3, 0, 1, 3);
    headerLayout->addWidget(fAvgBytesPerSec, 3, 3, 1, 2);

    fFormat->setCurrentIndex(obj->getHeader().getFormatTag());
    fBlockAlign->setValue(obj->getHeader().getBlockAlign());
    fNumChannels->setValue(obj->getHeader().getNumChannels());
    fBitRate->setValue(obj->getHeader().getBitsPerSample());
    fSampleRate->setValue(obj->getHeader().getNumSamplesPerSec());
    fAvgBytesPerSec->setValue(obj->getHeader().getAvgBytesPerSec());

    fFilename = new QLineEdit(this);
    fFilename->setText(~obj->getFileName());

    QGridLayout* layout = new QGridLayout(this);
    layout->setContentsMargins(8, 8, 8, 8);
    layout->addWidget(flagGroup, 0, 0, 1, 2);
    layout->addWidget(headerGroup, 1, 0, 1, 2);
    layout->addWidget(new QLabel(tr("Filename:"), this), 2, 0);
    layout->addWidget(fFilename, 2, 1);
}
コード例 #10
0
ファイル: item_transfer.cpp プロジェクト: cwarden/quasar
ItemTransfer::ItemTransfer(MainWindow* main, Id transfer_id)
    : DataWindow(main, "ItemTransfer", transfer_id)
{
    _helpSource = "item_transfer.html";

    // Search button
    QPushButton* search = new QPushButton(tr("Search"), _buttons);
    connect(search, SIGNAL(clicked()), SLOT(slotSearch()));

    // Get the company for deposit info
    _quasar->db()->lookup(_company);

    // Create widgets
    _gltxFrame = new GltxFrame(main, tr("Adjustment No."), _frame);
    _gltxFrame->setTitle(tr("From"));
    connect(_gltxFrame->store, SIGNAL(validData()), SLOT(slotStoreChanged()));

    _items = new Table(_frame);
    _items->setVScrollBarMode(QScrollView::AlwaysOn);
    _items->setLeftMargin(fontMetrics().width("99999"));
    _items->setDisplayRows(6);
    connect(_items, SIGNAL(cellMoved(int,int)), SLOT(cellMoved(int,int)));
    connect(_items, SIGNAL(cellChanged(int,int,Variant)),
	    SLOT(cellChanged(int,int,Variant)));
    connect(_items, SIGNAL(focusNext(bool&,int&,int&,int)),
	    SLOT(focusNext(bool&,int&,int&,int)));
    connect(_items, SIGNAL(rowInserted(int)), SLOT(rowInserted(int)));
    connect(_items, SIGNAL(rowDeleted(int)), SLOT(rowDeleted(int)));

    // Lookups
    _lookup = new ItemLookup(_main, this);
    _lookup->inventoriedOnly = true;

    // Add columns
    new LookupColumn(_items, tr("Item Number"), 18, _lookup);
    new TextColumn(_items, tr("Description"), 20);
    new TextColumn(_items, tr("Size"), 10);
    new NumberColumn(_items, tr("On Hand"), 6);
    new NumberColumn(_items, tr("Quantity"), 6);
    new MoneyColumn(_items, tr("Amount"));
    if (_company.depositAccount() != INVALID_ID)
	new MoneyColumn(_items, tr("Deposit"), 4);

    // Add editors
    _size = new QComboBox(_items);
    new LookupEditor(_items, 0, new ItemEdit(_lookup, _items));
    new ComboEditor(_items, 2, _size);
    new NumberEditor(_items, 4, new DoubleEdit(_items));
    new NumberEditor(_items, 5, new MoneyEdit(_items));
    if (_company.depositAccount() != INVALID_ID)
	new NumberEditor(_items, 6, new MoneyEdit(_items));

    QGroupBox* to = new QGroupBox(tr("To"), _frame);

    QLabel* toNumberLabel = new QLabel(tr("Adjustment No."), to);
    _toNumber = new LineEdit(9, to);
    toNumberLabel->setBuddy(_toNumber);

    QLabel* toShiftLabel = new QLabel(tr("Shift:"), to);
    _toShift = new LookupEdit(new GltxLookup(_main, this, DataObject::SHIFT),
			      to);
    _toShift->setLength(10);
    _toShift->setFocusPolicy(ClickFocus);
    toShiftLabel->setBuddy(_toShift);

    QLabel* toStoreLabel = new QLabel(tr("Store:"), to);
    _toStore = new LookupEdit(new StoreLookup(_main, this), to);
    _toStore->setLength(30);
    toStoreLabel->setBuddy(_toStore);

    QGridLayout* toGrid = new QGridLayout(to, 1, 1, to->frameWidth() * 2);
    toGrid->setSpacing(3);
    toGrid->setMargin(6);
    toGrid->setColStretch(2, 1);
    toGrid->addColSpacing(2, 10);
    toGrid->setColStretch(5, 1);
    toGrid->addColSpacing(5, 10);
    toGrid->addRowSpacing(0, to->fontMetrics().height());
    toGrid->addWidget(toNumberLabel, 1, 0);
    toGrid->addWidget(_toNumber, 1, 1, AlignLeft | AlignVCenter);
    toGrid->addWidget(toShiftLabel, 1, 3);
    toGrid->addWidget(_toShift, 1, 4, AlignLeft | AlignVCenter);
    toGrid->addWidget(toStoreLabel, 1, 6);
    toGrid->addWidget(_toStore, 1, 7, AlignLeft | AlignVCenter);

    QLabel* accountLabel = new QLabel(tr("Transfer Account:"), _frame);
    AccountLookup* lookup = new AccountLookup(main, this, 
					      Account::OtherCurLiability);
    _account = new LookupEdit(lookup, _frame);
    _account->setLength(30);
    accountLabel->setBuddy(_account);

    QLabel* totalLabel = new QLabel(tr("Transfer Amount:"), _frame);
    _total = new MoneyEdit(_frame);
    _total->setLength(14);
    _total->setFocusPolicy(NoFocus);
    totalLabel->setBuddy(_total);

    _inactive->setText(tr("Voided?"));

    QGridLayout* grid = new QGridLayout(_frame);
    grid->setSpacing(3);
    grid->setMargin(3);
    grid->setColStretch(2, 1);
    grid->setRowStretch(1, 1);
    grid->addMultiCellWidget(_gltxFrame, 0, 0, 0, 4);
    grid->addMultiCellWidget(_items, 1, 1, 0, 4);
    grid->addMultiCellWidget(to, 2, 2, 0, 4);
    grid->addWidget(accountLabel, 3, 0);
    grid->addWidget(_account, 3, 1, AlignLeft | AlignVCenter);
    grid->addWidget(totalLabel, 3, 3);
    grid->addWidget(_total, 3, 4, AlignLeft | AlignVCenter);

    setCaption(tr("Item Transfer"));
    finalize();
}
コード例 #11
0
ファイル: MainPanel.cpp プロジェクト: Palabola/Client
void MainPanel::init()
{
    if (!db.init())
    {
        QMessageBox error;
        error.critical(0, "Error!", "An error occured while trying to load the database.");
        exit(EXIT_FAILURE);
        return;
    }

    stack = new QStackedWidget(this);

    QString style = getStylesheet(":/Styles/Content.css");
    // Prepare UI objects for each tab
    libraryPtr = new Library(db);
    libraryPtr->setStyleSheet(style);
    browserPtr = new Browser();
    browserPtr->setStyleSheet(style);
    stack->addWidget(libraryPtr);
    stack->addWidget(browserPtr);
    stack->setCurrentWidget(libraryPtr);

    // System layout
    QHBoxLayout* systemLayout = new QHBoxLayout;
    systemLayout->setSpacing(0);
    systemLayout->setMargin(8);

    // Header spacing
    QVBoxLayout* topLayout = new QVBoxLayout;
    topLayout->setMargin(0);

    // Header layout
    QHBoxLayout* headerLayout = new QHBoxLayout;
    headerLayout->setSpacing(0);
    headerLayout->setMargin(0);

    // Window title
    QLabel* windowTitle = new QLabel(this);
    windowTitle->setObjectName("windowTitle");
    windowTitle->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
    windowTitle->setMinimumWidth(175);
    windowTitle->setMaximumWidth(175);
    windowTitle->setAlignment(Qt::AlignTop);
    windowTitle->setFont(QFont("Sansation", 18));
    windowTitle->setText("Project \nASCENSION");
    windowTitle->setStyleSheet("color: #7D818C;");
    windowTitle->setAttribute(Qt::WA_TransparentForMouseEvents);

    // Post-initialization header spacing
    topLayout->addLayout(systemLayout);
    topLayout->addLayout(headerLayout);
    topLayout->addSpacing(10);

    headerLayout->addSpacing(20);
    headerLayout->addWidget(windowTitle);
    headerLayout->addSpacing(40);

    // Header tabs
    libraryTab = new TabLabel(this);
    libraryTab = g_tabFactory(libraryTab, "libraryTab", "LIBRARY");
    headerLayout->addSpacing(8);
    headerLayout->addWidget(libraryTab);
    libraryTab->setStyleSheet("font-weight: bold; color: lightgreen;");

    storeTab = new TabLabel(this);
    storeTab = g_tabFactory(storeTab, "storeTab", "  STORE");
    headerLayout->addSpacing(8);
    headerLayout->addWidget(storeTab);

    modsTab = new TabLabel(this);
    modsTab = g_tabFactory(modsTab, "modsTab", " MODS");
    headerLayout->addSpacing(8);
    headerLayout->addWidget(modsTab);

    newsTab = new TabLabel(this);
    newsTab = g_tabFactory(newsTab, "newsTab", "NEWS");
    headerLayout->addSpacing(8);
    headerLayout->addWidget(newsTab);

    browserTab = new TabLabel(this);
    browserTab = g_tabFactory(browserTab, "browserTab", "BROWSER");
    headerLayout->addSpacing(8);
    headerLayout->addWidget(browserTab);

    activeTab = libraryTab;

    headerLayout->addStretch();

    // System buttons
    systemLayout->addStretch();

    // Minimize
    QPushButton* pushButtonMinimize = new QPushButton("", this);
    pushButtonMinimize->setObjectName("pushButtonMinimize");
    systemLayout->addWidget(pushButtonMinimize);
    QObject::connect(pushButtonMinimize, SIGNAL(clicked()), this, SLOT(pushButtonMinimize()));

    // Maximize
    QPushButton* pushButtonMaximize = new QPushButton("", this);
    pushButtonMaximize->setObjectName("pushButtonMaximize");
    systemLayout->addWidget(pushButtonMaximize);
    QObject::connect(pushButtonMaximize, SIGNAL(clicked()), this, SLOT(pushButtonMaximize()));

    // Close
    QPushButton* pushButtonClose = new QPushButton("", this);
    pushButtonClose->setObjectName("pushButtonClose");
    systemLayout->addWidget(pushButtonClose);
    QObject::connect(pushButtonClose, SIGNAL(clicked()), this, SLOT(pushButtonClose()));

    // Main panel layout
    QGridLayout* mainGridLayout = new QGridLayout();
    mainGridLayout->setSpacing(0);
    mainGridLayout->setMargin(0);
    setLayout(mainGridLayout);

    // Central widget
    QWidget* centralWidget = new QWidget(this);
    centralWidget->setObjectName("centralWidget");
    centralWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);

    // Main panel scroll area
    QScrollArea* scrollArea = new QScrollArea(this);
    scrollArea->setWidgetResizable(true);
    scrollArea->setObjectName("mainPanelScrollArea");
    scrollArea->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);

    // Vertical layout example
    QVBoxLayout* verticalLayout = new QVBoxLayout();
    verticalLayout->setSpacing(5);
    verticalLayout->setMargin(0);
    verticalLayout->setAlignment(Qt::AlignHCenter);
    verticalLayout->addLayout(topLayout, 1);

    verticalLayout->addWidget(stack, 4);

    // Connect signals
    connect(libraryTab, SIGNAL(clicked()), this, SLOT(setTabLibrary()));
    connect(browserTab, SIGNAL(clicked()), this, SLOT(setTabBrowser()));

    // Show
    centralWidget->setLayout(verticalLayout);
    scrollArea->setWidget(centralWidget);
    mainGridLayout->addWidget(scrollArea);
}
コード例 #12
0
ファイル: item_transfer.cpp プロジェクト: cwarden/quasar
void
ItemTransfer::slotSearch()
{
    QDialog* dialog = new QDialog(this, "Search", true);
    dialog->setCaption(tr("Item Search"));

    QLabel* numberLabel = new QLabel(tr("Item Number:"), dialog);
    LineEdit* numberWidget = new LineEdit(dialog);
    QLabel* descLabel = new QLabel(tr("Description:"), dialog);
    LineEdit* descWidget = new LineEdit(dialog);
    QCheckBox* startOver = new QCheckBox(tr("Start search at top?"), dialog);

    QFrame* buttons = new QFrame(dialog);
    QPushButton* next = new QPushButton(tr("&Next"), buttons);
    QPushButton* cancel = new QPushButton(tr("&Cancel"), buttons);
    next->setDefault(true);

    QGridLayout* buttonGrid = new QGridLayout(buttons);
    buttonGrid->setMargin(6);
    buttonGrid->setSpacing(10);
    buttonGrid->addWidget(next, 0, 1);
    buttonGrid->addWidget(cancel, 0, 2);

    QGridLayout* grid = new QGridLayout(dialog);
    grid->setMargin(6);
    grid->setSpacing(10);
    grid->addWidget(numberLabel, 0, 0);
    grid->addWidget(numberWidget, 0, 1, AlignLeft | AlignVCenter);
    grid->addWidget(descLabel, 1, 0);
    grid->addWidget(descWidget, 1, 1, AlignLeft | AlignVCenter);
    grid->addMultiCellWidget(startOver, 2, 2, 0, 1, AlignLeft | AlignVCenter);
    grid->addMultiCellWidget(buttons, 3, 3, 0, 1);

    connect(next, SIGNAL(clicked()), dialog, SLOT(accept()));
    connect(cancel, SIGNAL(clicked()), dialog, SLOT(reject()));

    _items->setFocus();
    startOver->setChecked(true);

    while (true) {
	if (dialog->exec() != QDialog::Accepted)
	    break;

	QString number = numberWidget->text();
	QString desc = descWidget->text();
	if (number.isEmpty() && desc.isEmpty()) {
	    QString message = tr("No search criteria given");
	    QMessageBox::critical(this, tr("Error"), message);
	    continue;
	}

	int startRow = -1;
	if (!startOver->isChecked())
	    startRow = _items->currentRow();

	int foundRow = -1;
	for (int row = startRow + 1; row < _items->rows(); ++row) {
	    QString rowNumber = _items->cellValue(row, 0).toPlu().number();
	    QString rowDesc = _items->cellValue(row, 1).toString();

	    if (!number.isEmpty() && rowNumber.contains(number, false)) {
		foundRow = row;
		break;
	    }
	    if (!desc.isEmpty() && rowDesc.contains(desc, false)) {
		foundRow = row;
		break;
	    }
	}

	if (foundRow == -1 && startOver->isChecked()) {
	    QString message = tr("No matches found");
	    QMessageBox::critical(this, tr("Error"), message);
	} else if (foundRow == -1 && !startOver->isChecked()) {
	    QString message = tr("No further matches found");
	    int choice = QMessageBox::critical(this, tr("Error"), message,
					       tr("Start Over"), tr("Cancel"));
	    if (choice != 0) break;
	    _items->setCurrentCell(0, 0);
	    startOver->setChecked(true);
	} else {
	    _items->setCurrentCell(foundRow, 0);
	    startOver->setChecked(false);
	}
    }

    delete dialog;
}
コード例 #13
0
ファイル: LazyWord.cpp プロジェクト: san0xff/lazyword
void LazyWord::ConfigureUI()
{
	ConfigureBox = new QGroupBox(tr("Configure"));

    LibSelectLabel = new QLabel(tr("LibSelect:"));
	//WordLibBox = new QComboBox;	
	WordLibBox = WordLib();

    StimeLabel = new QLabel(tr("Showtime:"));
    ItimeLabel = new QLabel(tr("Invertaltime:"));

    StimeBox = new QSpinBox;
    StimeBox->setRange(5, 60);
    StimeBox->setSuffix(" s");
    StimeBox->setValue(Shtime);
    
    ItimeBox = new QSpinBox;
    ItimeBox->setRange(5, 180);
    ItimeBox->setSuffix(" s");
    ItimeBox->setValue(Invertime);
    
    DselectLabel = new QLabel(tr("Degree Select:"));
    show_StrangeBox = new QCheckBox(tr("Strange"));
    show_UnderstandBox = new QCheckBox(tr("Understand"));
	show_MasterBox = new QCheckBox(tr("Master"));
    show_AllBox = new QCheckBox(tr("All"));
    ShowTestButton = new QPushButton(tr("Test"));
    AboutButton = new QPushButton(tr("About"));
    InsertLibButton = new QPushButton(tr("Insert Lib"));
    OkButton = new QPushButton(tr("Start Lazy"));
    UpdateLibButton = new QPushButton(tr("Update Lib"));
    GetAllExplainButton = new QPushButton(tr("Get All Explain"));
    ChangeColorButton = new QPushButton(tr("Change Color"));
    //ShowTestButton->setDefault(true);

    QGridLayout *messageLayout = new QGridLayout;
    messageLayout->addWidget(LibSelectLabel, 0, 0);
    messageLayout->addWidget(WordLibBox, 0, 1, 1, 2);
    messageLayout->addWidget(StimeLabel, 1, 0);
    messageLayout->addWidget(StimeBox, 1, 1);
    messageLayout->addWidget(ItimeLabel, 1, 3);
    messageLayout->addWidget(ItimeBox, 1, 4);
    messageLayout->addWidget(DselectLabel, 2, 0);
	messageLayout->addWidget(show_StrangeBox, 3, 1,1,1);
	messageLayout->addWidget(show_UnderstandBox, 3, 2,1,1);
	messageLayout->addWidget(show_MasterBox, 3, 3,1,1);
	messageLayout->addWidget(show_AllBox, 3, 4,1,1);
	messageLayout->addWidget(UpdateLibButton, 4, 1);
    messageLayout->addWidget(InsertLibButton, 4, 2);
    messageLayout->addWidget(OkButton, 4, 3);
    messageLayout->addWidget(ShowTestButton, 4, 4);
    messageLayout->addWidget(GetAllExplainButton,5,2);
    messageLayout->addWidget(AboutButton,5,0);
	messageLayout->addWidget(ChangeColorButton,5,1);
    
    messageLayout->setRowStretch(4, 1);

    
    ConfigureBox->setLayout(messageLayout);
}
コード例 #14
0
ファイル: account_master.cpp プロジェクト: cwarden/quasar
AccountMaster::AccountMaster(MainWindow* main, Id account_id)
    : DataWindow(main, "AccountMaster", account_id)
{
    _helpSource = "account_master.html";

    // Create widgets
    QLabel* nameLabel = new QLabel(tr("&Name:"), _frame);
    _name = new LineEdit(_frame);
    _name->setLength(30);
    nameLabel->setBuddy(_name);

    QLabel* numberLabel = new QLabel(tr("N&umber:"), _frame);
    _number = new LineEdit(_frame);
    _number->setLength(12);
    numberLabel->setBuddy(_number);

    QLabel* typeLabel = new QLabel(tr("&Type:"), _frame);
    _type = new QComboBox(false, _frame);
    typeLabel->setBuddy(_type);
    connect(_type, SIGNAL(activated(int)), SLOT(typeChanged(int)));

    for (int type = Account::Bank; type <= Account::OtherExpense; ++type) {
	_type->insertItem(Account::typeName(Account::Type(type)));
    }
    _type->setMinimumSize(_type->sizeHint());
    _type->setMaximumSize(_type->sizeHint());

    QLabel* parentLabel = new QLabel(tr("&Parent:"), _frame);
    _parentLookup = new AccountLookup(main, this, -1, true, false);
    _parent = new LookupEdit(_parentLookup, _frame);
    parentLabel->setBuddy(_parent);

    QFrame* boxes = new QFrame(_frame);

    _header = new QCheckBox(tr("Header Account?"), boxes);

    QLabel* nextNumLabel = new QLabel(tr("Next Cheque #:"), boxes);
    _nextNum = new IntegerEdit(boxes);
    _nextNum->setLength(6);

    QLabel* lastReconLabel = new QLabel(tr("Last Reconciled:"), boxes);
    _lastRecon = new DateEdit(boxes);
    _lastRecon->setEnabled(false);

    QGroupBox* groups = new QGroupBox(tr("Groups"), boxes);
    QGridLayout* g_grid = new QGridLayout(groups, 2, 1,groups->frameWidth()*2);
    g_grid->addRowSpacing(0, groups->fontMetrics().height());

    _groups = new Table(groups);
    _groups->setVScrollBarMode(QScrollView::AlwaysOn);
    _groups->setDisplayRows(2);
    _groups->setLeftMargin(fontMetrics().width("999"));
    connect(_groups, SIGNAL(cellChanged(int,int,Variant)),
	    SLOT(groupCellChanged(int,int,Variant)));

    GroupLookup* groupLookup = new GroupLookup(_main, this, Group::ACCOUNT);
    new LookupColumn(_groups, tr("Group Name"), 15, groupLookup);
    new LookupEditor(_groups, 0, new LookupEdit(groupLookup, _groups));

    g_grid->addWidget(_groups, 1, 0);

    QGridLayout* grid1 = new QGridLayout(boxes);
    grid1->setSpacing(3);
    grid1->setMargin(3);
    grid1->setRowStretch(2, 1);
    grid1->setColStretch(1, 1);
    grid1->addWidget(_header, 0, 0);
    grid1->addWidget(nextNumLabel, 1, 0, AlignLeft | AlignVCenter);
    grid1->addWidget(_nextNum, 1, 1, AlignLeft | AlignVCenter);
    grid1->addWidget(lastReconLabel, 3, 0, AlignLeft | AlignVCenter);
    grid1->addWidget(_lastRecon, 3, 1, AlignLeft | AlignVCenter);
    grid1->addMultiCellWidget(groups, 0, 3, 2, 2);

    QGridLayout *grid = new QGridLayout(_frame);
    grid->setSpacing(3);
    grid->setMargin(3);
    grid->addWidget(nameLabel, 0, 0);
    grid->addWidget(_name, 0, 1);
    grid->addWidget(numberLabel, 0, 2);
    grid->addWidget(_number, 0, 3, AlignLeft | AlignVCenter);
    grid->addWidget(typeLabel, 1, 0);
    grid->addWidget(_type, 1, 1, AlignLeft | AlignVCenter);
    grid->addWidget(parentLabel, 1, 2);
    grid->addWidget(_parent, 1, 3);
    grid->addMultiCellWidget(boxes, 2, 2, 0, 3);

    setCaption(tr("Account Master"));
    finalize();
}
コード例 #15
0
void PMeshViewer::createWidgets()
{
    // Create vtk objects
    vtkWidget = new QVTKWidget(this);

    // QVTKWidget has already created a render window and interactor
    renderWindow = vtkWidget->GetRenderWindow();
    renderer = vtkRenderer::New();
    renderer->SetBackground(0.0, 0.0, 0.0);
    renderWindow->AddRenderer(renderer);
    
    interactor = renderWindow->GetInteractor();
    style = vtkInteractorStyleTrackballCamera::New();
    interactor->SetInteractorStyle(style);

    PMeshViewerCallback *callback = PMeshViewerCallback::New();
    callback->viewer = this;
    interactor->AddObserver(vtkCommand::RightButtonPressEvent, callback);
    callback->Delete();
    
    // Central widget
    QGridLayout *grid = new QGridLayout;
    grid->addWidget(vtkWidget, 0, 0);
    QWidget *main = new QWidget;
    main->setLayout(grid);
    setCentralWidget(main);
    
    // Overall
    setWindowTitle(appName);
    setWindowIcon(QIcon(":/images/panax-icon.png"));
    
    // Create mesh mode box
    meshModeBox = new QComboBox(this);
    QStringList choices;
    choices << "smooth surface" << "flat surface" << "flat + lines"
            << "wire frame";
    meshModeBox->insertItems(0, choices);
    connect(meshModeBox, SIGNAL(activated(int)), this,
            SLOT(setMeshMode(int)));
    
    // Create mesh table
    meshTable = new QTableWidget(NumRow, NumColumn);
    QPalette palette = meshTable->palette();

    palette.setColor(QPalette::Base, QColor(248, 248, 248));
    meshTable->setPalette(palette);
    meshTable->verticalHeader()->hide();
    meshTable->setShowGrid(false);
    meshTable->setSelectionMode(QTableWidget::SingleSelection);
    
    QStringList labels;
    labels << "" << "Colour" << "Name" << "Annotation";
    meshTable->setHorizontalHeaderLabels(labels);
    QTableWidgetItem *headerItem = new QTableWidgetItem(QString("Source"));
    headerItem->setTextAlignment(Qt::AlignLeft);
    meshTable->setHorizontalHeaderItem(4, headerItem);
    
    QList<QHeaderView::ResizeMode> modes;
    modes << QHeaderView::Fixed << QHeaderView::Fixed
          << QHeaderView::Interactive << QHeaderView::Interactive << QHeaderView::Interactive;
    QHeaderView *header = meshTable->horizontalHeader();
    for (int i = 0; i < NumColumn; ++i)
        header->setResizeMode(i, modes[i]);
    
    QList<int> widths;
    widths << 30 << 50 << 100 << 100 << 200;
    int tableWidth = 0;
    for (int i = 0; i < NumColumn; ++i)
    {
        meshTable->setColumnWidth(i, widths[i]);
        tableWidth += widths[i];
    }
    meshTable->resize(tableWidth + 50, 200);
    connect(meshTable, SIGNAL(cellClicked(int, int)),
            this, SLOT(setVisibility(int, int)));
    connect(meshTable, SIGNAL(cellDoubleClicked(int, int)),
            this, SLOT(setColor(int, int)));
    connect(meshTable, SIGNAL(cellClicked(int, int)),
            this, SLOT(blink(int, int)));
    meshTable->installEventFilter(this);
    
    // Create dock widget for right dock area.
    rightDockWidget = new QDockWidget("Mesh List");
    rightDockWidget->setWidget(meshTable);
    rightDockWidget->setAllowedAreas(Qt::RightDockWidgetArea);
    addDockWidget(Qt::RightDockWidgetArea, rightDockWidget);
}
コード例 #16
0
ファイル: editcontactdialog.cpp プロジェクト: nijel/kalcatel
EditContactDialog::EditContactDialog(AlcatelCategoryList *cat, AlcatelContactList *lst, const AlcatelContact *cont, QWidget *parent, const char *name ) : KDialog(parent,name,true) {
    contact = cont;
    list= lst;
    categories = cat;

    QLabel *label;
    QFrame *line;

    resize(500, 580 );
    if (cont == NULL) setCaption( i18n( "New contact" ) );
    else setCaption( i18n( "Edit contact" ) );

    QGridLayout *mainLayout = new QGridLayout( this );
    mainLayout->setSpacing( 6 );
    mainLayout->setMargin( 8 );

    if (cont == NULL) label = new QLabel( i18n("<b>New contact</b>"), this );
    else label = new QLabel( i18n("<b>Edit contact</b>"), this );
    mainLayout->addMultiCellWidget(label,0,0,0,3);

    line = new QFrame( this );
    line->setFrameStyle( QFrame::HLine | QFrame::Sunken );
    line->setMargin(3);
    mainLayout->addMultiCellWidget(line,1,1,0,3);

    mainLayout->setRowStretch(0, -1);
    mainLayout->setRowStretch(1, -1);

    mainLayout->addWidget(new QLabel(i18n("First name"), this), 2, 0);
    mainLayout->addWidget(editFirstName = new QLineEdit(this), 2, 1);

    mainLayout->addWidget(new QLabel(i18n("Last name"), this), 2, 2);
    mainLayout->addWidget(editLastName = new QLineEdit(this), 2, 3);

    line = new QFrame( this );
    line->setFrameStyle( QFrame::HLine | QFrame::Sunken );
    line->setMargin(3);
    mainLayout->addMultiCellWidget(line,3,3,0,3);

    mainLayout->addWidget(new QLabel(i18n("Company"), this), 4, 0);
    mainLayout->addWidget(editCompany = new QLineEdit(this), 4, 1);

    mainLayout->addWidget(new QLabel(i18n("Job title"), this), 4, 2);
    mainLayout->addWidget(editJobTitle = new QLineEdit(this), 4, 3);

    mainLayout->addWidget(new QLabel(i18n("Category"), this), 5, 0);
    mainLayout->addWidget(editCategory = new KComboBox(this), 5, 1);

    editCategory->insertItem(i18n("Not set")); /* -1 */
    editCategory->insertItem(i18n("none_category", "None")); /* 255 */
    for( AlcatelCategoryList::Iterator c_it = categories->begin(); c_it != categories->end(); ++c_it ) {
        editCategory->insertItem((*c_it).Name);
    }
//    , (*c_it).Id

    mainLayout->addWidget(new QLabel(i18n("Private"), this), 5, 2);
    mainLayout->addWidget(editPrivate = new QCheckBox(this), 5, 3);

    mainLayout->addWidget(new QLabel(i18n("Note"), this), 6, 0); /* this will be longer */
    mainLayout->addMultiCellWidget(editNote = new QLineEdit(this), 6, 6, 1, 3);

    line = new QFrame( this );
    line->setFrameStyle( QFrame::HLine | QFrame::Sunken );
    line->setMargin(3);
    mainLayout->addMultiCellWidget(line,7,7,0,3);

    mainLayout->addWidget(new QLabel(i18n("Work number"), this),8 , 0);
    mainLayout->addWidget(editWorkNumber = new QLineEdit(this),8 , 1);
    editWorkNumber->setValidator(new PhoneNumberValidator(true, true, false, editWorkNumber));

    mainLayout->addWidget(new QLabel(i18n("Main number"), this),8 , 2);
    mainLayout->addWidget(editMainNumber = new QLineEdit(this),8 , 3);
    editMainNumber->setValidator(new PhoneNumberValidator(true, true, false, editMainNumber));

    mainLayout->addWidget(new QLabel(i18n("Fax number"), this),9 , 0);
    mainLayout->addWidget(editFaxNumber = new QLineEdit(this),9 , 1);
    editFaxNumber->setValidator(new PhoneNumberValidator(true, true, false, editFaxNumber));

    mainLayout->addWidget(new QLabel(i18n("Other number"), this),9 , 2);
    mainLayout->addWidget(editOtherNumber = new QLineEdit(this),9 , 3);
    editOtherNumber->setValidator(new PhoneNumberValidator(true, true, false, editOtherNumber));

    mainLayout->addWidget(new QLabel(i18n("Pager number"), this),10 , 0);
    mainLayout->addWidget(editPagerNumber = new QLineEdit(this),10 , 1);
    editPagerNumber->setValidator(new PhoneNumberValidator(true, true, false, editPagerNumber));

    mainLayout->addWidget(new QLabel(i18n("Mobile number"), this),10 , 2);
    mainLayout->addWidget(editMobileNumber = new QLineEdit(this),10 , 3);
    editMobileNumber->setValidator(new PhoneNumberValidator(true, true, false, editMobileNumber));

    mainLayout->addWidget(new QLabel(i18n("Home number"), this),11 , 0);
    mainLayout->addWidget(editHomeNumber = new QLineEdit(this),11 , 1);
    editHomeNumber->setValidator(new PhoneNumberValidator(true, true, false, editHomeNumber));

/* what should be here?
    mainLayout->addWidget(new QLabel(i18n(""), this), , 2);*/

    line = new QFrame( this );
    line->setFrameStyle( QFrame::HLine | QFrame::Sunken );
    line->setMargin(3);
    mainLayout->addMultiCellWidget(line,12,12,0,3);

    mainLayout->addWidget(new QLabel(i18n("Email 1"), this), 13, 0);
    mainLayout->addWidget(editEmail1 = new QLineEdit(this), 13, 1);

    mainLayout->addWidget(new QLabel(i18n("Email 2"), this), 13, 2);
    mainLayout->addWidget(editEmail2 = new QLineEdit(this), 13, 3);

    line = new QFrame( this );
    line->setFrameStyle( QFrame::HLine | QFrame::Sunken );
    line->setMargin(3);
    mainLayout->addMultiCellWidget(line,14,14,0,3);

    mainLayout->addWidget(new QLabel(i18n("Address"), this), 15, 0); /* this will be longer */
    mainLayout->addMultiCellWidget(editAddress = new QLineEdit(this), 15, 15, 1, 3);

    mainLayout->addWidget(new QLabel(i18n("City"), this), 16, 0);
    mainLayout->addWidget(editCity = new QLineEdit(this), 16, 1);

    mainLayout->addWidget(new QLabel(i18n("Zip"), this), 16, 2);
    mainLayout->addWidget(editZip = new QLineEdit(this), 16, 3);

    mainLayout->addWidget(new QLabel(i18n("State"), this), 17, 0);
    mainLayout->addWidget(editState = new QLineEdit(this), 17, 1);

    mainLayout->addWidget(new QLabel(i18n("Country"), this), 17, 2);
    mainLayout->addWidget(editCountry = new QLineEdit(this), 17, 3);

    line = new QFrame( this );
    line->setFrameStyle( QFrame::HLine | QFrame::Sunken );
    line->setMargin(3);
    mainLayout->addMultiCellWidget(line,18,18,0,3);

    mainLayout->addWidget(new QLabel(i18n("Custom 1"), this), 19, 0);
    mainLayout->addWidget(editCustom1 = new QLineEdit(this), 19, 1);

    mainLayout->addWidget(new QLabel(i18n("Custom 2"), this), 19, 2);
    mainLayout->addWidget(editCustom2 = new QLineEdit(this), 19, 3);

    mainLayout->addWidget(new QLabel(i18n("Custom 3"), this), 20, 0);
    mainLayout->addWidget(editCustom3 = new QLineEdit(this), 20, 1);

    mainLayout->addWidget(new QLabel(i18n("Custom 4"), this), 20, 2);
    mainLayout->addWidget(editCustom4 = new QLineEdit(this), 20, 3);

    line = new QFrame( this );
    line->setFrameStyle( QFrame::HLine | QFrame::Sunken );
    line->setMargin(3);
    mainLayout->addMultiCellWidget(line,21,21,0,3);

    mainLayout->addWidget(new QLabel(i18n("Storage"), this), 22, 0);

    editStorage = new KComboBox(this);
    editStorage->insertItem(i18n("none_storage", "None"));
    editStorage->insertItem(i18n("PC"));
    editStorage->insertItem(i18n("SIM"));
    editStorage->insertItem(i18n("Mobile"));
    connect( editStorage, SIGNAL( activated(int)), this, SLOT( slotStorage(int)));
    editStorage->setCurrentItem(1);
    mainLayout->addWidget(editStorage, 22, 1);

    mainLayout->addWidget(new QLabel(i18n("Position"), this), 22, 2);

    editPosition = new KIntNumInput(this);
    editPosition->setRange(-1, 9999,1,false);
    editPosition->setSpecialValueText(i18n("Auto"));
    mainLayout->addWidget(editPosition, 22, 3);

    QHBoxLayout *layout = new QHBoxLayout;

    layout->setSpacing( 6 );
    layout->setMargin( 0 );
    QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
    layout->addItem( spacer );

    QPushButton *buttonOK = new QPushButton(i18n("&OK"), this);
    buttonOK->setDefault(true);
    layout->addWidget(buttonOK);

    QPushButton *buttonCancel = new QPushButton(i18n("&Cancel"), this);
    layout->addWidget(buttonCancel);

    mainLayout->addMultiCellLayout( layout, 24,24, 0,3 );

    line = new QFrame( this);
    line->setFrameStyle( QFrame::HLine | QFrame::Sunken );

    mainLayout->addMultiCellWidget( line, 23,23, 0,3 );
    connect( buttonOK, SIGNAL( clicked() ), this, SLOT( slotOK() ) );
    connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( slotCancel() ) );

    editPosition->setEnabled(false);
    loadContact();
    if (contact == NULL) editPosition->setValue(-1);
    editStorage->setEnabled(contact == NULL);
}
コード例 #17
0
//! [0]
WidgetGallery::WidgetGallery(QWidget *parent)
    : QDialog(parent)
{
    originalPalette = QApplication::palette();

    styleComboBox = new QComboBox;
    styleComboBox->addItem("NorwegianWood");
    styleComboBox->addItems(QStyleFactory::keys());

    styleLabel = new QLabel(tr("&Style:"));
    styleLabel->setBuddy(styleComboBox);

    useStylePaletteCheckBox = new QCheckBox(tr("&Use style's standard palette"));
    useStylePaletteCheckBox->setChecked(true);

    disableWidgetsCheckBox = new QCheckBox(tr("&Disable widgets"));

    createTopLeftGroupBox();
    createTopRightGroupBox();
    createBottomLeftTabWidget();
    createBottomRightGroupBox();
    createProgressBar();
//! [0]

//! [1]
    connect(styleComboBox, SIGNAL(activated(QString)),
//! [1] //! [2]
            this, SLOT(changeStyle(QString)));
    connect(useStylePaletteCheckBox, SIGNAL(toggled(bool)),
            this, SLOT(changePalette()));
    connect(disableWidgetsCheckBox, SIGNAL(toggled(bool)),
            topLeftGroupBox, SLOT(setDisabled(bool)));
    connect(disableWidgetsCheckBox, SIGNAL(toggled(bool)),
            topRightGroupBox, SLOT(setDisabled(bool)));
    connect(disableWidgetsCheckBox, SIGNAL(toggled(bool)),
            bottomLeftTabWidget, SLOT(setDisabled(bool)));
    connect(disableWidgetsCheckBox, SIGNAL(toggled(bool)),
            bottomRightGroupBox, SLOT(setDisabled(bool)));
//! [2]

//! [3]
    QHBoxLayout *topLayout = new QHBoxLayout;
//! [3] //! [4]
    topLayout->addWidget(styleLabel);
    topLayout->addWidget(styleComboBox);
    topLayout->addStretch(1);
    topLayout->addWidget(useStylePaletteCheckBox);
    topLayout->addWidget(disableWidgetsCheckBox);

    QGridLayout *mainLayout = new QGridLayout;
    mainLayout->addLayout(topLayout, 0, 0, 1, 2);
    mainLayout->addWidget(topLeftGroupBox, 1, 0);
    mainLayout->addWidget(topRightGroupBox, 1, 1);
    mainLayout->addWidget(bottomLeftTabWidget, 2, 0);
    mainLayout->addWidget(bottomRightGroupBox, 2, 1);
    mainLayout->addWidget(progressBar, 3, 0, 1, 2);
    mainLayout->setRowStretch(1, 1);
    mainLayout->setRowStretch(2, 1);
    mainLayout->setColumnStretch(0, 1);
    mainLayout->setColumnStretch(1, 1);
    setLayout(mainLayout);

    setWindowTitle(tr("Styles"));
    changeStyle("NorwegianWood");
}
コード例 #18
0
UIWizardExportAppPageBasic3::UIWizardExportAppPageBasic3()
{
    /* Create widgets: */
    QVBoxLayout *pMainLayout = new QVBoxLayout(this);
    {
        m_pLabel = new QIRichTextLabel(this);
        QGridLayout *pSettingsLayout = new QGridLayout;
        {
            m_pUsernameEditor = new QLineEdit(this);
            m_pUsernameLabel = new QLabel(this);
            {
                m_pUsernameLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
                m_pUsernameLabel->setBuddy(m_pUsernameEditor);
            }
            m_pPasswordEditor = new QLineEdit(this);
            {
                m_pPasswordEditor->setEchoMode(QLineEdit::Password);
            }
            m_pPasswordLabel = new QLabel(this);
            {
                m_pPasswordLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
                m_pPasswordLabel->setBuddy(m_pPasswordEditor);
            }
            m_pHostnameEditor = new QLineEdit(this);
            m_pHostnameLabel = new QLabel(this);
            {
                m_pHostnameLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
                m_pHostnameLabel->setBuddy(m_pHostnameEditor);
            }
            m_pBucketEditor = new QLineEdit(this);
            m_pBucketLabel = new QLabel(this);
            {
                m_pBucketLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
                m_pBucketLabel->setBuddy(m_pBucketEditor);
            }
            m_pFileSelector = new VBoxEmptyFileSelector(this);
            {
                m_pFileSelector->setMode(VBoxFilePathSelectorWidget::Mode_File_Save);
                m_pFileSelector->setEditable(true);
                m_pFileSelector->setButtonPosition(VBoxEmptyFileSelector::RightPosition);
                m_pFileSelector->setDefaultSaveExt("ova");
            }
            m_pFileSelectorLabel = new QLabel(this);
            {
                m_pFileSelectorLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
                m_pFileSelectorLabel->setBuddy(m_pFileSelector);
            }
            m_pFormatComboBox = new QComboBox(this);
            {
                const QString strFormat09("ovf-0.9");
                const QString strFormat10("ovf-1.0");
                const QString strFormat20("ovf-2.0");
                m_pFormatComboBox->addItem(strFormat09, strFormat09);
                m_pFormatComboBox->addItem(strFormat10, strFormat10);
                m_pFormatComboBox->addItem(strFormat20, strFormat20);
                connect(m_pFormatComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(sltUpdateFormatComboToolTip()));
            }
            m_pFormatComboBoxLabel = new QLabel(this);
            {
                m_pFormatComboBoxLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
                m_pFormatComboBoxLabel->setBuddy(m_pFormatComboBox);
            }
            pSettingsLayout->addWidget(m_pUsernameLabel, 0, 0);
            pSettingsLayout->addWidget(m_pUsernameEditor, 0, 1);
            pSettingsLayout->addWidget(m_pPasswordLabel, 1, 0);
            pSettingsLayout->addWidget(m_pPasswordEditor, 1, 1);
            pSettingsLayout->addWidget(m_pHostnameLabel, 2, 0);
            pSettingsLayout->addWidget(m_pHostnameEditor, 2, 1);
            pSettingsLayout->addWidget(m_pBucketLabel, 3, 0);
            pSettingsLayout->addWidget(m_pBucketEditor, 3, 1);
            pSettingsLayout->addWidget(m_pFileSelectorLabel, 4, 0);
            pSettingsLayout->addWidget(m_pFileSelector, 4, 1);
            pSettingsLayout->addWidget(m_pFormatComboBoxLabel, 5, 0);
            pSettingsLayout->addWidget(m_pFormatComboBox, 5, 1);
        }
        m_pManifestCheckbox = new QCheckBox(this);
        pMainLayout->addWidget(m_pLabel);
        pMainLayout->addLayout(pSettingsLayout);
        pMainLayout->addWidget(m_pManifestCheckbox);
        pMainLayout->addStretch();
        chooseDefaultSettings();
    }

    /* Setup connections: */
    connect(m_pUsernameEditor, SIGNAL(textChanged(const QString &)), this, SIGNAL(completeChanged()));
    connect(m_pPasswordEditor, SIGNAL(textChanged(const QString &)), this, SIGNAL(completeChanged()));
    connect(m_pHostnameEditor, SIGNAL(textChanged(const QString &)), this, SIGNAL(completeChanged()));
    connect(m_pBucketEditor, SIGNAL(textChanged(const QString &)), this, SIGNAL(completeChanged()));
    connect(m_pFileSelector, SIGNAL(pathChanged(const QString &)), this, SIGNAL(completeChanged()));

    /* Register fields: */
    registerField("format", this, "format");
    registerField("manifestSelected", this, "manifestSelected");
    registerField("username", this, "username");
    registerField("password", this, "password");
    registerField("hostname", this, "hostname");
    registerField("bucket", this, "bucket");
    registerField("path", this, "path");
}
コード例 #19
0
ファイル: noteinfodialog.cpp プロジェクト: MidoriYakumo/hippo
NoteInfoDialog::NoteInfoDialog(QWidget *parent, QString guid) :
    QDialog(parent)
{
    if (guid.isEmpty()) {
        reject();
        return;
    }

    note = Note::fromGUID(guid);
    if (note == NULL) {
        reject();
        return;
    }

    setWindowTitle("Note Info");

    QGridLayout* layout = new QGridLayout(this);

    QLabel* title = new QLabel(note->getTitle(), this);
    title->setAlignment(Qt::AlignCenter);
    QFont mainTitleFont, titleFont = title->font();
    mainTitleFont.setBold(true);
    mainTitleFont.setPointSize(15);
    title->setFont(mainTitleFont);
    layout->addWidget(title, 0, 0, 1, 4);


    layout->addWidget(new QLabel("<b>Overview</b>", this), 2, 0, 1, 4);

    titleFont.setCapitalization(QFont::AllUppercase);
    titleFont.setFamily("gotham,helvetica,arial,sans-serif");
    titleFont.setLetterSpacing(QFont::PercentageSpacing, 102);
    titleFont.setWeight(100);
    QLabel* createdTitle = new QLabel("Created:", this);
    createdTitle->setFont(titleFont);

    layout->addWidget(createdTitle, 3, 0);
    QLabel* updatedTitle = new QLabel("Updated:", this);
    updatedTitle->setFont(titleFont);
    layout->addWidget(updatedTitle, 4, 0);
    QLabel* sizeTitle = new QLabel("Size:", this);
    sizeTitle->setFont(titleFont);
    layout->addWidget(sizeTitle, 5, 0);
    QLabel* reminderTitle = new QLabel("Reminder:", this);
    reminderTitle->setFont(titleFont);
    layout->addWidget(reminderTitle, 6, 0);

    QLabel* created = new QLabel(this);
    created->setText(note->getCreated().toString("dddd, MMMM d yyyy, h:mm AP"));
    layout->addWidget(created, 3, 1, 1, 3);

    QLabel* updated = new QLabel(this);
    updated->setText(note->getUpdated().toString("dddd, MMMM d yyyy, h:mm AP"));
    layout->addWidget(updated, 4, 1, 1, 3);

    QLabel* size = new QLabel(this);
    size->setText(QString("%1 bytes").arg(note->getSize()));
    size->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Minimum);
    layout->addWidget(size, 5, 1, 1, 3);

    reminderEdit = new QDateTimeEdit(this);
    reminderEdit->setDisplayFormat("dddd, MMMM d yyyy, h:mm AP");
    reminderEdit->setCalendarPopup(true);
    reminderEdit->setMinimumDateTime(QDateTime::currentDateTime());
    reminderEdit->setHidden(true);
    layout->addWidget(reminderEdit, 6, 1);

    QPushButton *deleteReminder = new QPushButton(this);
    deleteReminder->setIcon(QIcon::fromTheme("edit-delete"));
    deleteReminder->setHidden(true);
    layout->addWidget(deleteReminder, 6, 2);
    connect(deleteReminder, SIGNAL(clicked()), reminderEdit, SLOT(hide()));
    connect(deleteReminder, SIGNAL(clicked()), deleteReminder, SLOT(hide()));

    QPushButton *setReminder = new QPushButton(this);
    setReminder->setIcon(QIcon(":/img/reminder.png"));
    layout->addWidget(setReminder, 6, 3);
    connect(setReminder, SIGNAL(clicked()), reminderEdit, SLOT(show()));
    connect(setReminder, SIGNAL(clicked()), deleteReminder, SLOT(show()));

    QDateTime reminderTime = note->getReminderOrder();
    if (!reminderTime.isNull()) {
        reminderEdit->setHidden(false);
        reminderEdit->setDateTime(reminderTime);

        deleteReminder->setHidden(false);
    }

    url = new QLineEdit(this);
    url->setPlaceholderText("Set a URL...");
    url->setText(note->getSourceURL());
    url->setMaxLength(4096);
    layout->addWidget(url, 7, 0, 1, 4);

    author = new QLineEdit(this);
    author->setPlaceholderText("Set an Author...");
    author->setText(note->getAuthor());
    author->setMaxLength(4096);
    layout->addWidget(author, 8, 0, 1, 4);

    QDialogButtonBox* buttons = new QDialogButtonBox(QDialogButtonBox::Cancel | QDialogButtonBox::Save, Qt::Horizontal, this);
    connect(buttons, SIGNAL(accepted()), this, SLOT(save()));
    connect(buttons, SIGNAL(rejected()), this, SLOT(reject()));
    layout->addWidget(buttons, 9, 0, 1, 4);

    setLayout(layout);
    setMinimumWidth(400);

}
コード例 #20
0
ファイル: Season.cpp プロジェクト: ejchet/GoldenCheetah
/*----------------------------------------------------------------------
 * EDIT SEASON DIALOG
 *--------------------------------------------------------------------*/
EditSeasonDialog::EditSeasonDialog(Context *context, Season *season) :
    QDialog(context->mainWindow, Qt::Dialog), context(context), season(season)
{
    setWindowTitle(tr("Edit Date Range"));
    QVBoxLayout *mainLayout = new QVBoxLayout(this);

    // Grid
    QGridLayout *grid = new QGridLayout;
    QLabel *name = new QLabel(tr("Name"));
    QLabel *type = new QLabel(tr("Type"));
    QLabel *from = new QLabel(tr("From"));
    QLabel *to = new QLabel(tr("To"));
    QLabel *seed = new QLabel(tr("Starting LTS"));
    QLabel *low  = new QLabel(tr("Lowest SB"));

    nameEdit = new QLineEdit(this);
    nameEdit->setText(season->getName());

    typeEdit = new QComboBox;
    typeEdit->addItem(tr("Season"), Season::season);
    typeEdit->addItem(tr("Cycle"), Season::cycle);
    typeEdit->addItem(tr("Adhoc"), Season::adhoc);
    typeEdit->setCurrentIndex(typeEdit->findData(season->getType()));

    fromEdit = new QDateEdit(this);
    fromEdit->setDate(season->getStart());

    toEdit = new QDateEdit(this);
    toEdit->setDate(season->getEnd());

    seedEdit = new QDoubleSpinBox(this);
    seedEdit->setDecimals(0);
    seedEdit->setRange(0.0, 300.0);
    seedEdit->setSingleStep(1.0);
    seedEdit->setWrapping(true);
    seedEdit->setAlignment(Qt::AlignLeft);
    seedEdit->setValue(season->getSeed());
    
    lowEdit = new QDoubleSpinBox(this);
    lowEdit->setDecimals(0);
    lowEdit->setRange(-500, 0);
    lowEdit->setSingleStep(1.0);
    lowEdit->setWrapping(true);
    lowEdit->setAlignment(Qt::AlignLeft);
    lowEdit->setValue(season->getLow());
    

    grid->addWidget(name, 0,0);
    grid->addWidget(nameEdit, 0,1);
    grid->addWidget(type, 1,0);
    grid->addWidget(typeEdit, 1,1);
    grid->addWidget(from, 2,0);
    grid->addWidget(fromEdit, 2,1);
    grid->addWidget(to, 3,0);
    grid->addWidget(toEdit, 3,1);
    grid->addWidget(seed, 4,0);
    grid->addWidget(seedEdit, 4,1);
    grid->addWidget(low, 5,0);
    grid->addWidget(lowEdit, 5,1);

    mainLayout->addLayout(grid);

    // Buttons
    QHBoxLayout *buttonLayout = new QHBoxLayout;
    buttonLayout->addStretch();
    applyButton = new QPushButton(tr("&OK"), this);
    cancelButton = new QPushButton(tr("&Cancel"), this);
    buttonLayout->addWidget(cancelButton);
    buttonLayout->addWidget(applyButton);
    mainLayout->addLayout(buttonLayout);

    // connect up slots
    connect(applyButton, SIGNAL(clicked()), this, SLOT(applyClicked()));
    connect(cancelButton, SIGNAL(clicked()), this, SLOT(cancelClicked()));
}
コード例 #21
0
ファイル: Notes.cpp プロジェクト: zaps166/KiiroNotes
Notes::Notes() :
    m_notesFileName(QStandardPaths::standardLocations(QStandardPaths::DataLocation).value(0)),
    m_settings(QApplication::applicationName()),
    m_textEdit(new QPlainTextEdit),
    m_menu(new QMenu(this)),
    m_saveTimer(new QTimer(this)),

    m_canMove(false)
{
    QAction *saveAct = new QAction(tr("Save"), this);
    saveAct->setShortcut(QKeySequence("Ctrl+S"));
    connect(saveAct, &QAction::triggered, this, &Notes::save);

    m_visibilityAct = new QAction(tr("Show"), this);
    m_visibilityAct->setProperty("SecondText", tr("Hide"));
    connect(m_visibilityAct, &QAction::triggered, this, &Notes::toggleVisibility);

    QAction *stayOnBottomAct = new QAction(tr("Stay on bottom"), this);
    stayOnBottomAct->setShortcut(QKeySequence("Alt+B"));
    stayOnBottomAct->setCheckable(true);
    connect(stayOnBottomAct, &QAction::triggered, [this, stayOnBottomAct] {
        Qt::WindowFlags flags = getNotesWindowFlags();
        if (stayOnBottomAct->isChecked())
            flags |= Qt::WindowStaysOnBottomHint;
        setWindowFlags(flags);
        setVisible(m_visible);
    });

    QAction *aboutAct = new QAction(tr("About"), this);
    aboutAct->setShortcut(QKeySequence("F1"));
    connect(aboutAct, &QAction::triggered, [this] {
        QMessageBox::information(this, QString(), tr("KiiroNotes - simple notes for Linux desktop") + " (" + QCoreApplication::applicationVersion() + ")");
    });

    QAction *closeAct = new QAction(tr("Close"), this);
    closeAct->setShortcut(QKeySequence("Ctrl+Q"));
    connect(closeAct, &QAction::triggered, this, &Notes::close);

    /**/

    m_saveTimer->setSingleShot(true);
    connect(m_saveTimer, &QTimer::timeout, this, &Notes::save);

    /**/

    m_menu->addAction(saveAct);
    m_menu->addSeparator();
    m_menu->addAction(m_visibilityAct);
    m_menu->addAction(stayOnBottomAct);
    m_menu->addSeparator();
    m_menu->addAction(aboutAct);
    m_menu->addSeparator();
    m_menu->addAction(closeAct);

    /**/

    m_textEdit->setFrameShadow(QFrame::Plain);
    m_textEdit->setFrameShape(QFrame::NoFrame);

    QFile file(m_notesFileName);
    if (file.open(QFile::ReadOnly))
    {
        m_textEdit->setPlainText(file.readAll());
        m_textEdit->moveCursor(QTextCursor::End);
        m_textEdit->document()->setModified(false);
    }

    connect(m_textEdit, &QPlainTextEdit::textChanged, [this] {
        m_saveTimer->start(10000);
    });

    /**/

    QPalette palette;
    palette.setBrush(QPalette::Window, QColor(0xF7DC9D));
    palette.setBrush(QPalette::Base, QColor(0xF7EC9D));

    setPalette(palette);

    addAction(saveAct);
    addAction(m_visibilityAct);
    addAction(stayOnBottomAct);
    addAction(closeAct);

    QGridLayout *gridLayout = new QGridLayout(this);
    gridLayout->addWidget(m_textEdit, 0, 0, 1, 2);
    gridLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum), 1, 0, 1, 1);
    gridLayout->addWidget(new QSizeGrip(this), 1, 1, 1, 1);
    gridLayout->setMargin(0);

    /**/

    setContextMenuPolicy(Qt::CustomContextMenu);
    connect(this, &Notes::customContextMenuRequested, [this](const QPoint &p) {
        m_menu->popup(mapToGlobal(p));
    });

    Qt::WindowFlags flags = getNotesWindowFlags();
    if (m_settings.value("StayOnBottom", false).toBool())
    {
        flags |= Qt::WindowStaysOnBottomHint;
        stayOnBottomAct->setChecked(true);
    }
    setWindowFlags(flags);

    if (!restoreGeometry(m_settings.value("Geometry").toByteArray()))
        resize(300, 400);

    if (m_settings.value("Visible", true).toBool())
        toggleVisibility();
    else
        m_visible = false;
}
コード例 #22
0
int main(int argc, char *argv[])
{
    QApplication app(argc, argv);

    {
//! [0]
    QWidget *window = new QWidget;
//! [0] //! [1]
    QPushButton *button1 = new QPushButton("One");
//! [1] //! [2]
    QPushButton *button2 = new QPushButton("Two");
    QPushButton *button3 = new QPushButton("Three");
    QPushButton *button4 = new QPushButton("Four");
    QPushButton *button5 = new QPushButton("Five");
//! [2]

//! [3]
    QHBoxLayout *layout = new QHBoxLayout;
//! [3] //! [4]
    layout->addWidget(button1);
    layout->addWidget(button2);
    layout->addWidget(button3);
    layout->addWidget(button4);
    layout->addWidget(button5);

    window->setLayout(layout);
//! [4] //! [5]
    window->show();
//! [5]
    }
    
    {
//! [6]
    QWidget *window = new QWidget;
//! [6] //! [7]
    QPushButton *button1 = new QPushButton("One");
//! [7] //! [8]
    QPushButton *button2 = new QPushButton("Two");
    QPushButton *button3 = new QPushButton("Three");
    QPushButton *button4 = new QPushButton("Four");
    QPushButton *button5 = new QPushButton("Five");
//! [8]

//! [9]
    QVBoxLayout *layout = new QVBoxLayout;
//! [9] //! [10]
    layout->addWidget(button1);
    layout->addWidget(button2);
    layout->addWidget(button3);
    layout->addWidget(button4);
    layout->addWidget(button5);

    window->setLayout(layout);
//! [10] //! [11]
    window->show();
//! [11]
    }
    
    {
//! [12]
    QWidget *window = new QWidget;
//! [12] //! [13]
    QPushButton *button1 = new QPushButton("One");
//! [13] //! [14]
    QPushButton *button2 = new QPushButton("Two");
    QPushButton *button3 = new QPushButton("Three");
    QPushButton *button4 = new QPushButton("Four");
    QPushButton *button5 = new QPushButton("Five");
//! [14]

//! [15]
    QGridLayout *layout = new QGridLayout;
//! [15] //! [16]
    layout->addWidget(button1, 0, 0);
    layout->addWidget(button2, 0, 1);
    layout->addWidget(button3, 1, 0, 1, 2);
    layout->addWidget(button4, 2, 0);
    layout->addWidget(button5, 2, 1);

    window->setLayout(layout);
//! [16] //! [17]
    window->show();
//! [17]
    }

    return app.exec();
}
コード例 #23
0
ファイル: info_panels.cpp プロジェクト: Flameeyes/vlc
/**
 * Fourth Panel - Stats
 * Displays the Statistics for reading/streaming/encoding/displaying in a tree
 */
InputStatsPanel::InputStatsPanel( QWidget *parent,
                                  intf_thread_t *_p_intf )
                                  : QWidget( parent ), p_intf( _p_intf )
{
     QGridLayout *layout = new QGridLayout(this);

     QLabel *topLabel = new QLabel( qtr( "Current"
                 " media / stream " "statistics") );
     topLabel->setWordWrap( true );
     layout->addWidget( topLabel, 0, 0 );

     StatsTree = new QTreeWidget(this);
     StatsTree->setColumnCount( 3 );
     StatsTree->setHeaderHidden( true );

#define CREATE_TREE_ITEM( itemName, itemText, itemValue, unit ) {              \
    itemName =                                                                 \
      new QTreeWidgetItem((QStringList () << itemText << itemValue << unit )); \
    itemName->setTextAlignment( 1 , Qt::AlignRight ) ; }

#define CREATE_CATEGORY( catName, itemText ) {                           \
    CREATE_TREE_ITEM( catName, itemText , "", "" );                      \
    catName->setExpanded( true );                                        \
    StatsTree->addTopLevelItem( catName );    }

#define CREATE_AND_ADD_TO_CAT( itemName, itemText, itemValue, catName, unit ){ \
    CREATE_TREE_ITEM( itemName, itemText, itemValue, unit );                   \
    catName->addChild( itemName ); }

    /* Create the main categories */
    CREATE_CATEGORY( audio, qtr("Audio") );
    CREATE_CATEGORY( video, qtr("Video") );
    CREATE_CATEGORY( input, qtr("Input/Read") );
    CREATE_CATEGORY( streaming, qtr("Output/Written/Sent") );

    CREATE_AND_ADD_TO_CAT( read_media_stat, qtr("Media data size"),
                           "0", input , "KiB" );
    CREATE_AND_ADD_TO_CAT( input_bitrate_stat, qtr("Input bitrate"),
                           "0", input, "kb/s" );
    CREATE_AND_ADD_TO_CAT( demuxed_stat, qtr("Demuxed data size"), "0", input, "KiB") ;
    CREATE_AND_ADD_TO_CAT( stream_bitrate_stat, qtr("Content bitrate"),
                           "0", input, "kb/s" );
    CREATE_AND_ADD_TO_CAT( corrupted_stat, qtr("Discarded (corrupted)"),
                           "0", input, "" );
    CREATE_AND_ADD_TO_CAT( discontinuity_stat, qtr("Dropped (discontinued)"),
                           "0", input, "" );

    CREATE_AND_ADD_TO_CAT( vdecoded_stat, qtr("Decoded"),
                           "0", video, qtr("blocks") );
    CREATE_AND_ADD_TO_CAT( vdisplayed_stat, qtr("Displayed"),
                           "0", video, qtr("frames") );
    CREATE_AND_ADD_TO_CAT( vlost_frames_stat, qtr("Lost"),
                           "0", video, qtr("frames") );

    CREATE_AND_ADD_TO_CAT( send_stat, qtr("Sent"), "0", streaming, qtr("packets") );
    CREATE_AND_ADD_TO_CAT( send_bytes_stat, qtr("Sent"),
                           "0", streaming, "KiB" );
    CREATE_AND_ADD_TO_CAT( send_bitrate_stat, qtr("Upstream rate"),
                           "0", streaming, "kb/s" );

    CREATE_AND_ADD_TO_CAT( adecoded_stat, qtr("Decoded"),
                           "0", audio, qtr("blocks") );
    CREATE_AND_ADD_TO_CAT( aplayed_stat, qtr("Played"),
                           "0", audio, qtr("buffers") );
    CREATE_AND_ADD_TO_CAT( alost_stat, qtr("Lost"), "0", audio, qtr("buffers") );

#undef CREATE_AND_ADD_TO_CAT
#undef CREATE_CATEGORY
#undef CREATE_TREE_ITEM

    input->setExpanded( true );
    video->setExpanded( true );
    streaming->setExpanded( true );
    audio->setExpanded( true );

    StatsTree->resizeColumnToContents( 0 );
    StatsTree->setColumnWidth( 1 , 200 );

    layout->addWidget(StatsTree, 1, 0 );
}
コード例 #24
0
ファイル: calculator.cpp プロジェクト: SLestad/Calculadora
Calculator::Calculator(QWidget *parent): QDialog(parent)
{
    sumInMemory = 0.0;
    sumSoFar = 0.0;
    factorSoFar=0.0;
    waitingForOperand=true;

    display = new QLineEdit("0");
    display->setReadOnly(true);
    display->setAlignment(Qt::AlignRight);
    display->setMaxLength(15);

    QFont font = display ->font();
    font.setPointSize(font.pointSize()+8);
    display->setFont(font);

    for (int i=0; i<NumDigitButtons;++i){
        digitButtons[i]= createButton(QString::number(i),SLOT(digitClicked()));
    }
    Button *pointButton = createButton(tr("."),SLOT(pointClicked()));
    Button *changeSignButton = createButton(tr("\302\261"),SLOT(changeSignClicked()));
    Button *backspaceButton = createButton(tr("Borrar"),SLOT(backspaceClicked()));
    Button *clearButton = createButton(tr("Limpiar"),SLOT(clear()));
    Button *clearAllButton = createButton(tr("Limpiar Todo"),SLOT(clearAll()));
    Button *clearMemoryButton = createButton(tr("MC"),SLOT(clearMemory()));
    Button *readMemoryButton = createButton(tr("MR"),SLOT(readMemory()));
    Button *setMemoryButton = createButton(tr("MS"),SLOT(setMemory()));
    Button *addToMemoryButton = createButton(tr("M+"),SLOT(addToMemory()));
    Button *divisionButton = createButton(tr("\303\267"),SLOT(multiplicativeOperatorClicked()));
    Button *timesButton = createButton(tr("\303\227"),SLOT(multiplicativeOperatorClicked()));
    Button *minusButton = createButton(tr("-"),SLOT(additiveOperatorClicked()));
    Button *plusButton = createButton(tr("+"),SLOT(additiveOperatorClicked()));
    Button *squareRootButton = createButton(tr("Raiz"),SLOT(unaryOperatorClicked()));
    Button *powerButton = createButton(tr("x\302\262"),SLOT(unaryOperatorClicked()));
    Button *reciprocalButton = createButton(tr("1/x"),SLOT(unaryOperatorClicked()));
    Button *equalButton = createButton(tr("="),SLOT(equalClicked()));

    QGridLayout *mainLayout = new QGridLayout;
    mainLayout->setSizeConstraint(QLayout::SetFixedSize);

    mainLayout->addWidget(display,0,0,1,6);
    mainLayout->addWidget(backspaceButton,1,0,1,2);
    mainLayout->addWidget(clearButton,1,2,1,2);
    mainLayout->addWidget(clearAllButton,1,4,1,2);

    mainLayout->addWidget(clearMemoryButton,2,0);
    mainLayout->addWidget(readMemoryButton,3,0);
    mainLayout->addWidget(setMemoryButton,4,0);
    mainLayout->addWidget(addToMemoryButton,5,0);

    for (int i=1;i<NumDigitButtons;++i){
        int row = ((9-i)/3)+2;
        int column = ((i - 1)%3)+1;
        mainLayout->addWidget(digitButtons[i],row,column);
    }
    mainLayout->addWidget(digitButtons[0],5,1);
    mainLayout->addWidget(pointButton,5,2);
    mainLayout->addWidget(changeSignButton,5,3);

    mainLayout->addWidget(divisionButton,2,4);
    mainLayout->addWidget(timesButton,3,4);
    mainLayout->addWidget(minusButton,4,4);
    mainLayout->addWidget(plusButton,5,4);

    mainLayout->addWidget(squareRootButton,2,5);
    mainLayout->addWidget(powerButton,3,5);
    mainLayout->addWidget(reciprocalButton,4,5);
    mainLayout->addWidget(equalButton,5,5);
    setLayout(mainLayout);
    setWindowTitle(tr("Calculadora 2011640366 Guerra Zarate Sergio Uriel"));
}
コード例 #25
0
void QgsAttributeDialog::init()
{
  if ( !mFeature || !mLayer->dataProvider() )
    return;

  const QgsFields &theFields = mLayer->pendingFields();
  if ( theFields.isEmpty() )
    return;

  QDialogButtonBox *buttonBox = NULL;

  if ( mLayer->editorLayout() == QgsVectorLayer::UiFileLayout && !mLayer->editForm().isEmpty() )
  {
    // UI-File defined layout
    QFile file( mLayer->editForm() );

    if ( file.open( QFile::ReadOnly ) )
    {
      QUiLoader loader;

      QFileInfo fi( mLayer->editForm() );
      loader.setWorkingDirectory( fi.dir() );
      QWidget *myWidget = loader.load( &file, qobject_cast<QWidget*>( parent() ) );
      file.close();

      mDialog = qobject_cast<QDialog*>( myWidget );
      buttonBox = myWidget->findChild<QDialogButtonBox*>();
    }
  }
  else if ( mLayer->editorLayout() == QgsVectorLayer::TabLayout )
  {
    // Tab display
    mDialog = new QDialog( qobject_cast<QWidget*>( parent() ) );

    QGridLayout *gridLayout;
    QTabWidget *tabWidget;

    mDialog->resize( 447, 343 );
    gridLayout = new QGridLayout( mDialog );
    gridLayout->setObjectName( QString::fromUtf8( "gridLayout" ) );

    tabWidget = new QTabWidget( mDialog );
    gridLayout->addWidget( tabWidget );

    foreach ( const QgsAttributeEditorElement *widgDef, mLayer->attributeEditorElements() )
    {
      QWidget* tabPage = new QWidget( tabWidget );

      tabWidget->addTab( tabPage, widgDef->name() );
      QGridLayout *tabPageLayout = new QGridLayout( tabPage );

      if ( widgDef->type() == QgsAttributeEditorElement::AeTypeContainer )
      {
        QString dummy1;
        bool dummy2;
        tabPageLayout->addWidget( QgsAttributeEditor::createWidgetFromDef( widgDef, tabPage, mLayer, *mFeature, mContext, dummy1, dummy2 ) );
      }
      else
      {
        QgsDebugMsg( "No support for fields in attribute editor on top level" );
      }
    }

    buttonBox = new QDialogButtonBox( mDialog );
    buttonBox->setObjectName( QString::fromUtf8( "buttonBox" ) );
    gridLayout->addWidget( buttonBox );
  }
コード例 #26
0
void ExamineResultDialog::createCurrentExamineBox()
{
	this->current_examine_box = new QGroupBox(tr("current examine data:"), this);

	QLabel *gatekeeper_hint_label = new QLabel(tr("gatekeeper:"));
	QLabel *gatekeeper_label = new QLabel(Sanguosha->translate(this->examine_state->gatekeeper));

	QLabel *gatekeeper_level_hint_label = new QLabel(tr("level:"));
	QLabel *gatekeeper_level_label = new QLabel(Sanguosha->translate(this->examine_state->level));

	QHBoxLayout *pGatekeeperLayout = new QHBoxLayout;
	pGatekeeperLayout->addWidget(gatekeeper_hint_label);
	pGatekeeperLayout->addWidget(gatekeeper_label);
	pGatekeeperLayout->addStretch();
	pGatekeeperLayout->addWidget(gatekeeper_level_hint_label);
	pGatekeeperLayout->addWidget(gatekeeper_level_label);
	pGatekeeperLayout->addStretch();

	QLabel *total_hint_label = new QLabel(tr("total:"));
	QLabel *total_label = new QLabel(tr("%1 [finished] / %2 [appointed]").arg(this->examine_state->total_finished).arg(this->examine_state->total));

	QLabel *warm_hint_label = new QLabel(tr("offensive start:"));
	QLabel *warm_label = new QLabel(tr("%1 [finished] / %2 [appointed]").arg(this->examine_state->warm_finished).arg(this->examine_state->warm));

	QLabel *cold_hint_label = new QLabel(tr("defensive start:"));
	QLabel *cold_label = new QLabel(tr("%1 [finished] / %2 [appointed]").arg(this->examine_state->cold_finished).arg(this->examine_state->cold));

	QLabel *win_hint_label = new QLabel(tr("win times:"));
	QLabel *win_label = new QLabel(QString::number(this->examine_state->win));

	QLabel *draw_hint_label = new QLabel(tr("draw times:"));
	QLabel *draw_label = new QLabel(QString::number(this->examine_state->draw));

	QLabel *lose_hint_label = new QLabel(tr("lose times:"));
	QLabel *lose_label = new QLabel(QString::number(this->examine_state->lose));

	QGridLayout *pDataLayout = new QGridLayout;
	pDataLayout->addWidget(total_hint_label, 0, 0);
	pDataLayout->addWidget(total_label, 0, 1);
	pDataLayout->addWidget(warm_hint_label, 1, 0);
	pDataLayout->addWidget(warm_label, 1, 1);
	pDataLayout->addWidget(cold_hint_label, 2, 0);
	pDataLayout->addWidget(cold_label, 2, 1);
	pDataLayout->addWidget(win_hint_label, 3, 0);
	pDataLayout->addWidget(win_label, 3, 1);
	pDataLayout->addWidget(draw_hint_label, 4, 0);
	pDataLayout->addWidget(draw_label, 4, 1);
	pDataLayout->addWidget(lose_hint_label, 5, 0);
	pDataLayout->addWidget(lose_label, 5, 1);

	QHBoxLayout *pDataXLayout = new QHBoxLayout;
	pDataXLayout->addLayout(pDataLayout);
	pDataXLayout->addStretch();

	QVBoxLayout *pMainLayout = new QVBoxLayout;
	pMainLayout->addLayout(pGatekeeperLayout);
	pMainLayout->addLayout(pDataXLayout);

	this->current_examine_box->setLayout(pMainLayout);
}
コード例 #27
0
Client::Client(QWidget *parent) : QMainWindow(parent), networkSession(0) {
    sysInfo = new QSystemDeviceInfo(this);
    QGeoPositionInfo::QGeoPositionInfo(info);

    QGeoPositionInfoSource *source = QGeoPositionInfoSource::createDefaultSource(this);
    if(source){
         connect(source, SIGNAL(positionUpdated(QGeoPositionInfo)), this, SLOT(positonUpdated(QGeoPositionInfo)));
         source->requestUpdate();
     }

    hostLabel = new QLabel(tr("&Server name:"));
    QString ipAddress;
    QList<QHostAddress> ipAddressesList = QNetworkInterface::allAddresses();
    for (int i = 0; i < ipAddressesList.size(); ++i) {
        if (ipAddressesList.at(i) != QHostAddress::LocalHost &&
            ipAddressesList.at(i).toIPv4Address()) {
            ipAddress = ipAddressesList.at(i).toString();
            //#############KOSTIL'##################
            ipAddress = "91.221.60.166";
            break;
        }
    }
    if (ipAddress.isEmpty())
        ipAddress = QHostAddress(QHostAddress::LocalHost).toString();

    hostLineEdit = new QLineEdit(ipAddress);
    hostLabel->setBuddy(hostLineEdit);

    statusLabel = new QLabel(tr(""));

    alarmTypeUnus = new QPushButton(tr("Fire"));
    alarmTypeDuo = new QPushButton(tr("Pain"));
    alarmTypeTres = new QPushButton(tr("Breakin"));

    quitButton = new QPushButton(tr("Quit"));
    sendButton = new QPushButton(tr("Send datastring"));

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

    tcpSocket = new QTcpSocket(this);

    connect(quitButton, SIGNAL(clicked()), this, SLOT(close()));
    connect(alarmTypeUnus, SIGNAL(clicked()), this, SLOT(pressedUnus()));
    connect(alarmTypeDuo, SIGNAL(clicked()), this, SLOT(pressedDuo()));
    connect(alarmTypeTres, SIGNAL(clicked()), this, SLOT(pressedTres()));
    connect(tcpSocket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(displayError(QAbstractSocket::SocketError)));

    QGridLayout *mainLayout = new QGridLayout;
    mainLayout->addWidget(hostLabel, 0, 0);
    mainLayout->addWidget(hostLineEdit, 0, 1);
    mainLayout->addWidget(alarmTypeUnus, 3, 0);
    mainLayout->addWidget(alarmTypeDuo, 3, 1);
    mainLayout->addWidget(alarmTypeTres, 3, 2);
    mainLayout->addWidget(buttonBox, 4, 0);
    setLayout(mainLayout);

    setWindowTitle(tr("Alarm Client"));
    QNetworkConfigurationManager manager;
    if (manager.capabilities() & QNetworkConfigurationManager::NetworkSessionRequired) {
        QSettings settings(QSettings::UserScope, QLatin1String("Trolltech"));
        settings.beginGroup(QLatin1String("QtNetwork"));
        const QString id = settings.value(QLatin1String("DefaultNetworkConfiguration")).toString();
        settings.endGroup();

        QNetworkConfiguration config = manager.configurationFromIdentifier(id);
        if ((config.state() & QNetworkConfiguration::Discovered) !=
            QNetworkConfiguration::Discovered) {
            config = manager.defaultConfiguration();
        }

        networkSession = new QNetworkSession(config, this);
        connect(networkSession, SIGNAL(opened()), this, SLOT(sessionOpened()));

        statusLabel->setText(tr("Opening network session."));
        networkSession->open();

    }
}
コード例 #28
0
ファイル: mainwindow.cpp プロジェクト: wasimk1995/CacheSync
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    //MainWindow w;
    //QWidget *widget = new QWidget();
    QWidget *widget = new QWidget();
    this->setCentralWidget(widget);
    //w.show();
    QGridLayout *layout = new QGridLayout();
    widget->setLayout(layout);

    //Title of the Main Window
    QLabel *title = new QLabel();
    title->setText("PageCacheSync");
    layout->addWidget(title,0,0,1,0,Qt::AlignCenter);
    QFont f( "Arial", 25, QFont::Bold);
    title->setFont(f);

    searchFile = new QLineEdit(this);
    layout->addWidget(searchFile,1,1);
    QLabel *Filetext = new QLabel(this);
    Filetext->setText("Directory");
    layout->addWidget(Filetext,1,0);
    load = new QPushButton(this);
    load->setText("Load");
    layout->addWidget(load,1,2);
    connect(load,SIGNAL(clicked()),this,SLOT(clickedLoad()));

    //IP Enter location
    ipEnter = new QLineEdit();
    layout->addWidget(ipEnter,2,1);
    QLabel *ipText = new QLabel();
    ipText->setText("Enter IP Address");
    layout->addWidget(ipText,2,0);


    //Search Button
    Enter = new QPushButton(this);
    Enter->setText("Enter");
    layout->addWidget(Enter,3,2);
    connect(Enter,SIGNAL(clicked()),this, SLOT(clickedSearch()));

    //New Search Input Location
    searchEnter = new QLineEdit(this);
    layout->addWidget(searchEnter,3,1);
    QLabel *searchText = new QLabel(this);
    searchText->setText("Search for");
    layout->addWidget(searchText,3,0);
    connect(searchEnter,SIGNAL(textEdited(QString)),this,SLOT(lineEdited(QString)));

    //Sync Button
    syncButton = new QPushButton();
    syncButton->setText("Sync");
    layout->addWidget(syncButton,2,2);
    connect(syncButton,SIGNAL(clicked()),this,SLOT(clickedSync()));

    //Text Box where autocomplete results show
    text = new QTextEdit(this);
    layout->addWidget(text,4,1);

    //Add initial data to hash table
    string file = "/Users/wasimkhan/PageCache/DC1-sampleQueries.txt";
    hash = new HashTable(file);

    //Networking Part
    mySender = new Sender();
    myReceiver = new Receiver();

    filterArray_send = hash->filterArray;
}
コード例 #29
0
ManualRideDialog::ManualRideDialog(MainWindow *mainWindow,
                                   const QDir &home, bool useMetric) :
    mainWindow(mainWindow), home(home)
{
    useMetricUnits = useMetric;
    int row;

    mainWindow->getBSFactors(timeBS,distanceBS,timeDP,distanceDP);

    setAttribute(Qt::WA_DeleteOnClose);
    setWindowTitle(tr("Manually Enter Ride Data"));

    // ride date
    QLabel *manualDateLabel = new QLabel(tr("Ride date: "), this);
    dateTimeEdit = new QDateTimeEdit( QDateTime::currentDateTime(), this );
    // Wed 6/24/09 6:55 AM
    dateTimeEdit->setDisplayFormat(tr("ddd MMM d, yyyy  h:mm AP"));
    dateTimeEdit->setCalendarPopup(true);

    // ride length
    QLabel *manualLengthLabel = new QLabel(tr("Ride length: "), this);
    QHBoxLayout *manualLengthLayout = new QHBoxLayout;
    hrslbl = new QLabel(tr("hours"),this);
    hrslbl->setFrameStyle(QFrame::Panel | QFrame::Sunken);
    hrsentry = new QLineEdit(this);
    QIntValidator * hoursValidator = new QIntValidator(0,99,this);
    //hrsentry->setInputMask("09");
    hrsentry->setValidator(hoursValidator);
    manualLengthLayout->addWidget(hrslbl);
    manualLengthLayout->addWidget(hrsentry);

    minslbl = new QLabel(tr("mins"),this);
    minslbl->setFrameStyle(QFrame::Panel | QFrame::Sunken);
    minsentry = new QLineEdit(this);
    QIntValidator * secsValidator = new QIntValidator(0,60,this);
    //minsentry->setInputMask("00");
    minsentry->setValidator(secsValidator);
    manualLengthLayout->addWidget(minslbl);
    manualLengthLayout->addWidget(minsentry);

    secslbl = new QLabel(tr("secs"),this);
    secslbl->setFrameStyle(QFrame::Panel | QFrame::Sunken);
    secsentry = new QLineEdit(this);
    //secsentry->setInputMask("00");
    secsentry->setValidator(secsValidator);
    manualLengthLayout->addWidget(secslbl);
    manualLengthLayout->addWidget(secsentry);

    QLabel *manualLengthHint = new QLabel(tr("(1 sec to 99:59:59) "), this);
    manualLengthLayout->addWidget(manualLengthHint);

    // ride distance
    QString *DistanceString = new QString(tr("Distance "));
    if (useMetricUnits)
        DistanceString->append("(" + tr("km") + "):");
    else
        DistanceString->append("(" + tr("miles") + "):");

    QLabel *DistanceLabel = new QLabel(*DistanceString, this);
    QDoubleValidator * distanceValidator = new QDoubleValidator(0,9999,2,this);
    distanceentry = new QLineEdit(this);
    //distanceentry->setInputMask("009.00");
    distanceentry->setValidator(distanceValidator);
	distanceentry->setMaxLength(6);

    QLabel *manualDistanceHint = new QLabel(tr("(0-9999) "), this);
    QHBoxLayout *distanceLayout = new QHBoxLayout;
	distanceLayout->addWidget(distanceentry);
	distanceLayout->addWidget(manualDistanceHint);



    // AvgHR
    QLabel *HRLabel = new QLabel(tr("Average HR: "), this);
    HRentry = new QLineEdit(this);
    QIntValidator *hrValidator =  new QIntValidator(30,200,this);
    //HRentry->setInputMask("099");
    HRentry->setValidator(hrValidator);

    QLabel *manualHRHint = new QLabel(tr("(30-199) "), this);
    QHBoxLayout *hrLayout = new QHBoxLayout;
	hrLayout->addWidget(HRentry);
	hrLayout->addWidget(manualHRHint);

    // how to estimate BikeScore:
    QLabel *BSEstLabel = NULL;
    boost::shared_ptr<QSettings> settings = GetApplicationSettings();

    QVariant BSmode = settings->value(GC_BIKESCOREMODE);

    estBSbyTimeButton = NULL;
    estBSbyDistButton = NULL;
    if (timeBS || distanceBS)  {
        BSEstLabel = new QLabel(tr("Estimate BikeScore by: "));
        if (timeBS) {
            estBSbyTimeButton = new QRadioButton(tr("Time"));
            // default to time based unless no timeBS factor
            if (BSmode.toString() != "distance")
                estBSbyTimeButton->setDown(true);
        }
        if (distanceBS) {
            estBSbyDistButton = new QRadioButton(tr("Distance"));
            if (BSmode.toString() == "distance" || ! timeBS)
                estBSbyDistButton->setDown(true);
        }
    }

    // BikeScore
    QLabel *ManualBSLabel = new QLabel(tr("BikeScore: "), this);
    QDoubleValidator * bsValidator = new QDoubleValidator(0,9999,2,this);
    BSentry = new QLineEdit(this);
    BSentry->setValidator(bsValidator);
	BSentry->setMaxLength(6);
    BSentry->clear();

    QLabel *manualBSHint = new QLabel(tr("(0-9999) "), this);
    QHBoxLayout *bsLayout = new QHBoxLayout;
	bsLayout->addWidget(BSentry);
	bsLayout->addWidget(manualBSHint);

    // DanielsPoints
    QLabel *ManualDPLabel = new QLabel(tr("Daniels Points: "), this);
    QDoubleValidator * dpValidator = new QDoubleValidator(0,9999,2,this);
    DPentry = new QLineEdit(this);
    DPentry->setValidator(dpValidator);
	DPentry->setMaxLength(6);
    DPentry->clear();
    QLabel *manualDPHint = new QLabel(tr("(0-9999) "), this);
    QHBoxLayout *dpLayout = new QHBoxLayout;
	dpLayout->addWidget(DPentry);
	dpLayout->addWidget(manualDPHint);

    // buttons
    enterButton = new QPushButton(tr("&OK"), this);
    cancelButton = new QPushButton(tr("&Cancel"), this);
    // don't let Enter write a new (and possibly incomplete) manual file:
    enterButton->setDefault(false);
    cancelButton->setDefault(true);

    // Set up the layout:
    QGridLayout *glayout = new QGridLayout(this);
    row = 0;
    glayout->addWidget(manualDateLabel, row, 0);
    glayout->addWidget(dateTimeEdit, row, 1, 1, -1);
    row++;

    glayout->addWidget(manualLengthLabel, row, 0);
    glayout->addLayout(manualLengthLayout,row,1,1,-1);
    row++;

    glayout->addWidget(DistanceLabel,row,0);
    glayout->addLayout(distanceLayout,row,1,1,-1);
    row++;

    glayout->addWidget(HRLabel,row,0);
    glayout->addLayout(hrLayout,row,1,1,-1);
    row++;

    if (timeBS || distanceBS) {
        glayout->addWidget(BSEstLabel,row,0);
        if (estBSbyTimeButton)
            glayout->addWidget(estBSbyTimeButton,row,1,1,-1);
        if (estBSbyDistButton)
            glayout->addWidget(estBSbyDistButton,row,2,1,-1);
        row++;
    }

    glayout->addWidget(ManualBSLabel,row,0);
    glayout->addLayout(bsLayout,row,1,1,-1);
    row++;

    glayout->addWidget(ManualDPLabel,row,0);
    glayout->addLayout(dpLayout,row,1,1,-1);
    row++;

    glayout->addWidget(enterButton,row,1);
    glayout->addWidget(cancelButton,row,2);

    this->resize(QSize(400,275));

    connect(enterButton, SIGNAL(clicked()), this, SLOT(enterClicked()));
    connect(cancelButton, SIGNAL(clicked()), this, SLOT(cancelClicked()));
    connect(hrsentry, SIGNAL(editingFinished()), this, SLOT(setBsEst()));
    //connect(secsentry, SIGNAL(editingFinished()), this, SLOT(setBsEst()));
    connect(minsentry, SIGNAL(editingFinished()), this, SLOT(setBsEst()));
    connect(distanceentry, SIGNAL(editingFinished()), this, SLOT(setBsEst()));
    if (estBSbyTimeButton)
        connect(estBSbyTimeButton,SIGNAL(clicked()),this, SLOT(bsEstChanged()));
    if (estBSbyDistButton)
        connect(estBSbyDistButton,SIGNAL(clicked()),this, SLOT(bsEstChanged()));
}
コード例 #30
0
ファイル: KoPAView.cpp プロジェクト: KDE/calligra-history
void KoPAView::initGUI()
{
    QGridLayout * gridLayout = new QGridLayout( this );
    gridLayout->setMargin( 0 );
    gridLayout->setSpacing( 0 );
    setLayout( gridLayout );

    d->canvas = new KoPACanvas( this, d->doc, this );
    KoCanvasControllerWidget *canvasController = new KoCanvasControllerWidget( this );
    d->canvasController = canvasController;
    d->canvasController->setCanvas( d->canvas );
    KoToolManager::instance()->addController( d->canvasController );
    KoToolManager::instance()->registerTools( actionCollection(), d->canvasController );

    d->zoomController = new KoZoomController( d->canvasController, zoomHandler(), actionCollection());
    connect( d->zoomController, SIGNAL( zoomChanged( KoZoomMode::Mode, qreal ) ),
             this, SLOT( slotZoomChanged( KoZoomMode::Mode, qreal ) ) );

    d->zoomAction = d->zoomController->zoomAction();

    // set up status bar message
    d->status = new QLabel( QString() );
    d->status->setAlignment( Qt::AlignLeft | Qt::AlignVCenter );
    d->status->setMinimumWidth( 300 );
    addStatusBarItem( d->status, 1 );
    connect( KoToolManager::instance(), SIGNAL( changedStatusText( const QString & ) ),
             d->status, SLOT( setText( const QString & ) ) );
    d->zoomActionWidget = d->zoomAction->createWidget(  statusBar() );
    addStatusBarItem( d->zoomActionWidget, 0 );

    d->zoomController->setZoomMode( KoZoomMode::ZOOM_PAGE );

    d->viewModeNormal = new KoPAViewModeNormal( this, d->canvas );
    setViewMode(d->viewModeNormal);

    // The rulers
    d->horizontalRuler = new KoRuler(this, Qt::Horizontal, viewConverter( d->canvas ));
    d->horizontalRuler->setShowMousePosition(true);
    d->horizontalRuler->setUnit(d->doc->unit());
    d->verticalRuler = new KoRuler(this, Qt::Vertical, viewConverter( d->canvas ));
    d->verticalRuler->setUnit(d->doc->unit());
    d->verticalRuler->setShowMousePosition(true);

    new KoRulerController(d->horizontalRuler, d->canvas->resourceManager());

    connect(d->doc, SIGNAL(unitChanged(const KoUnit&)),
            d->horizontalRuler, SLOT(setUnit(const KoUnit&)));
    connect(d->doc, SIGNAL(unitChanged(const KoUnit&)),
            d->verticalRuler, SLOT(setUnit(const KoUnit&)));

    gridLayout->addWidget(d->horizontalRuler, 0, 1);
    gridLayout->addWidget(d->verticalRuler, 1, 0);
    gridLayout->addWidget(canvasController, 1, 1 );

    connect(d->canvasController->proxyObject, SIGNAL(canvasOffsetXChanged(int)),
            this, SLOT(pageOffsetChanged()));
    connect(d->canvasController->proxyObject, SIGNAL(canvasOffsetYChanged(int)),
            this, SLOT(pageOffsetChanged()));
    connect(d->canvasController->proxyObject, SIGNAL(sizeChanged(const QSize&)),
            this, SLOT(pageOffsetChanged()));
    connect(d->canvasController->proxyObject, SIGNAL(canvasMousePositionChanged(const QPoint&)),
            this, SLOT(updateMousePosition(const QPoint&)));
    d->verticalRuler->createGuideToolConnection(d->canvas);
    d->horizontalRuler->createGuideToolConnection(d->canvas);

    KoToolBoxFactory toolBoxFactory(d->canvasController, i18n("Tools") );
    if (shell())
    {
        shell()->createDockWidget( &toolBoxFactory );
        connect( canvasController, SIGNAL( toolOptionWidgetsChanged(const QMap<QString, QWidget *> &, QWidget*) ),
             shell()->dockerManager(), SLOT( newOptionWidgets(const  QMap<QString, QWidget *> &, QWidget*) ) );
    }

    connect(shapeManager(), SIGNAL(selectionChanged()), this, SLOT(selectionChanged()));
    connect(d->canvas, SIGNAL(documentSize(const QSize&)), d->canvasController->proxyObject, SLOT(updateDocumentSize(const QSize&)));
    connect(d->canvasController->proxyObject, SIGNAL(moveDocumentOffset(const QPoint&)), d->canvas, SLOT(slotSetDocumentOffset(const QPoint&)));

    if (shell()) {
        KoPADocumentStructureDockerFactory structureDockerFactory( KoDocumentSectionView::ThumbnailMode, d->doc->pageType() );
        d->documentStructureDocker = qobject_cast<KoPADocumentStructureDocker*>( shell()->createDockWidget( &structureDockerFactory ) );
        connect( shell()->partManager(), SIGNAL( activePartChanged( KParts::Part * ) ),
                d->documentStructureDocker, SLOT( setPart( KParts::Part * ) ) );
        connect(d->documentStructureDocker, SIGNAL(pageChanged(KoPAPageBase*)), proxyObject, SLOT(updateActivePage(KoPAPageBase*)));
        connect(d->documentStructureDocker, SIGNAL(dockerReset()), this, SLOT(reinitDocumentDocker()));

        KoToolManager::instance()->requestToolActivation( d->canvasController );
    }
}