void SyncMeasuresDialogCentralWidget::createLayout()
{

  QPushButton * upperPushButton = new QPushButton("Check All");
  connect(upperPushButton, &QPushButton::clicked, this, &SyncMeasuresDialogCentralWidget::upperPushButtonClicked);

  auto upperLayout = new QHBoxLayout();
  upperLayout->addStretch();
  upperLayout->addWidget(upperPushButton);

  m_collapsibleComponentList = new CollapsibleComponentList();

  connect(m_collapsibleComponentList, &CollapsibleComponentList::componentClicked, this, &SyncMeasuresDialogCentralWidget::componentClicked);

  connect(m_collapsibleComponentList, &CollapsibleComponentList::getComponentsByPage, this, &SyncMeasuresDialogCentralWidget::getComponentsByPage);

  connect(m_collapsibleComponentList, &CollapsibleComponentList::getComponentsByPage, this, &SyncMeasuresDialogCentralWidget::on_getComponentsByPage);

  //*******************************************************************

  m_componentList = new ComponentList();

  CollapsibleComponentHeader * collapsibleComponentHeader = nullptr;
  collapsibleComponentHeader = new CollapsibleComponentHeader("Updates",100,5);

  CollapsibleComponent * collapsibleComponent = nullptr;
  collapsibleComponent = new CollapsibleComponent(collapsibleComponentHeader,m_componentList);

  m_collapsibleComponentList->addCollapsibleComponent(collapsibleComponent);

  //*******************************************************************

  progressBar = new QProgressBar(this);
  progressBar->setOrientation(Qt::Horizontal);
  progressBar->setVisible(false);
  progressBar->setTextVisible(false);

  lowerPushButton = new QPushButton("Update");
  connect(lowerPushButton, &QPushButton::clicked, this, &SyncMeasuresDialogCentralWidget::lowerPushButtonClicked);

  auto lowerLayout = new QHBoxLayout();
  lowerLayout->addWidget(progressBar);
  lowerLayout->addStretch();
  lowerLayout->addWidget(lowerPushButton);

  auto mainLayout = new QVBoxLayout();
  mainLayout->addLayout(upperLayout);

  mainLayout->addWidget(m_collapsibleComponentList,0,Qt::AlignTop);
  mainLayout->addLayout(lowerLayout);
  setLayout(mainLayout);
}
ImportWidget::ImportWidget(QWidget *parent) : QFrame(parent), d_ptr(new ImportWidgetPrivate(this))
{
    Q_D(ImportWidget);
    setObjectName("ImportWidget");

    DThemeManager::instance()->registerWidget(this);

    setAcceptDrops(true);

    auto layout = new QVBoxLayout(this);

    auto logo = new QLabel;
    logo->setFixedSize(128, 128);
    logo->setObjectName("ImportViewLogo");

//    auto btFrme = new QFrame;
//    auto btFrmeLayout = new QVBoxLayout(btFrme);
//    btFrme->setFixedSize(150, 50);
    d->importButton = new QPushButton;
    d->importButton->setObjectName("ImportViewImportButton");
    d->importButton->setFixedSize(142, 42);
//    btFrmeLayout->addWidget(d->importButton, 0, Qt::AlignCenter);
    d->importButton->setText(tr("Add folder"));

    d->text = new QLabel;
    d->text->setObjectName("ImportViewText");
    d->text->setFixedHeight(24);
    d->text->setOpenExternalLinks(false);
    QString linkText = QString(linkTemplate).arg(tr("Scan")).arg(tr("Scan"));
    d->text->setText(QString(tr("%1 music directory or drag & drop music file to add music")).arg(linkText));

    layout->addStretch();
    layout->addWidget(logo, 0, Qt::AlignCenter);
    layout->addSpacing(20);
    layout->addWidget(d->importButton, 0, Qt::AlignCenter);
    layout->addSpacing(10);
    layout->addWidget(d->text, 0, Qt::AlignCenter);
    layout->addStretch();

    connect(d->importButton, &QPushButton::clicked,
    this, [ = ] {
        Q_EMIT this->importFiles();
    });

    connect(d->text, &QLabel::linkActivated,
    this, [ = ](const QString & /*link*/) {
        showWaitHint();
        Q_EMIT this->scanMusicDirectory();
    });
}
Exemple #3
0
TracksPanel::TracksPanel(QWidget *parent) :
    SidePanel("Tracks", parent),
    d(new TracksPanelPrivate(this)) {

    d->tracks_bus = new TracksBus;
    d->tracks_list = new QWidget;

    auto layout0 = new QVBoxLayout;
    layout0->setMargin(0);
    layout0->setSpacing(0);
    for(int i = 0; i < 16; ++i) {
        layout0->addWidget(new TracksItem);
    }
    layout0->addStretch();
    d->tracks_list->setLayout(layout0);

    auto scroll_area = new QScrollArea;
    scroll_area->setWidgetResizable(true);
    scroll_area->setWidget(d->tracks_list);
    scroll_area->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);

    auto layout = new QVBoxLayout;
    layout->setMargin(0);
    layout->setSpacing(0);
    layout->addWidget(d->tracks_bus);
    layout->addWidget(scroll_area);

    this->centralWidget()->setLayout(layout);
}
Exemple #4
0
MeasureItemButton::MeasureItemButton(bool t_fixed)
  : QAbstractButton()
{
  setFixedHeight(25);

  setHasEmphasis(false);

  auto mainHLayout = new QHBoxLayout();
  mainHLayout->setContentsMargins(5,5,5,5);
  mainHLayout->setSpacing(5);
  setLayout(mainHLayout);

  nameLabel = new QLabel();
  if (t_fixed)
  {
    nameLabel->setStyleSheet("font:italic");
  }

  mainHLayout->addWidget(nameLabel);

  mainHLayout->addStretch();

  cautionLabel = new QLabel();
  cautionLabel->setPixmap(QPixmap(":/shared_gui_components/images/warning_icon.png"));
  mainHLayout->addWidget(cautionLabel);
  cautionLabel->setVisible(false);
}
VRFView::VRFView()
  : QWidget()
{
  auto mainVLayout = new QVBoxLayout();
  mainVLayout->setSpacing(0);
  mainVLayout->setContentsMargins(0,0,0,0);
  mainVLayout->setAlignment(Qt::AlignTop);
  setLayout(mainVLayout);

  header = new QWidget();
  header->setObjectName("VRFHeader");
  header->setStyleSheet("QWidget#VRFHeader { background: #C3C3C3; }");
  header->setFixedHeight(35);
  mainVLayout->addWidget(header);

  auto headerLayout = new QHBoxLayout();
  headerLayout->setContentsMargins(5,5,5,5);
  headerLayout->setSpacing(0);
  header->setLayout(headerLayout);

  nameLabel = new QLabel();
  headerLayout->addWidget(nameLabel);

  zoomOutButton = new ZoomOutButton();
  headerLayout->addStretch();
  headerLayout->addWidget(zoomOutButton);

  graphicsView = new QGraphicsView();
  graphicsView->setObjectName("GrayWidget");
  mainVLayout->addWidget(graphicsView);
}
OptionsTiffImporter::OptionsTiffImporter(const QString &initialDirectory) : LabeledSectionGroup(NULL)
{
   QWidget* pFileBrowserWidget = new QWidget(this);
   QLabel* pFileBrowserLabel = new QLabel("Select an ISD metadata file or leave blank for no ISD metadata:",
      pFileBrowserWidget);
   mpFilename = new FileBrowser(pFileBrowserWidget);
   mpFilename->setWhatsThis("<p>An ISD metadata file is an XML file shipped with some imagery such as Quickbird. "
                            "It contains image metadata. If you have an ISD metadata file and would like to load "
                            "it with the cube data, select it here. If you do not want to load an ISD metadata file, "
                            "leave this field blank.</p>"
                            "Currently, the following information is loaded from the ISD file:"
                            "<ul><li>RPC00B"
                            "<li>Image header information needed to use the RPC00B"
                            "</ul>");
   mpFilename->setBrowseCaption("ISD Metadata File");
   mpFilename->setBrowseFileFilters("ISD Metadata Files (*.xml)");
   mpFilename->setBrowseExistingFile(true);
   if (!initialDirectory.isEmpty())
   {
      mpFilename->setBrowseDirectory(initialDirectory);
   }
   QGridLayout* pLayout = new QGridLayout(pFileBrowserWidget);
   pLayout->setMargin(0);
   pLayout->setSpacing(5);
   pLayout->addWidget(pFileBrowserLabel, 0, 0);
   pLayout->addWidget(mpFilename, 1, 0, 1, 2);
   pLayout->setColumnStretch(1, 5);

   LabeledSection* pFileBrowserSection = new LabeledSection(pFileBrowserWidget, "ISD Metadata File", this);

   // Initialization
   addSection(pFileBrowserSection);
   addStretch(10);
   setSizeHint(300, 50);
}
void PropertiesDialog::addTab(QTabWidget* tabWidget, QString name, IntListIter begin, IntListIter end)
{
	auto scrollArea = new QScrollArea;
	scrollArea->setFrameStyle(QFrame::NoFrame);
	auto scrollWidget = new QWidget;
	auto scrollLayout = new QVBoxLayout;
	scrollWidget->setLayout(scrollLayout);
	scrollLayout->setContentsMargins(0, 0, 0, 0);
	scrollArea->setWidget(scrollWidget);
	scrollArea->setWidgetResizable(true);

	for(auto it = begin; it != end; ++it)
	{
		auto& prop = m_propertyWidgets[*it];
		auto groupBox = new QGroupBox;
		auto layout = new QVBoxLayout;
		layout->setContentsMargins(5, 5, 5, 5);
		groupBox->setLayout(layout);
		QString title = QString::fromStdString(prop.property->name());
		groupBox->setTitle(title);
		groupBox->setToolTip(QString::fromStdString(prop.property->help()));
		layout->addWidget(prop.widget->createWidgets());
		scrollLayout->addWidget(groupBox);

		prop.groupBox = groupBox;
		prop.title = title;
	}

	scrollLayout->addStretch(1);

	tabWidget->addTab(scrollArea, name);
}
void
CQGnuPlotLoadFileDialog::
createWidgets(QWidget *)
{
  addField("Style", new CQEnumCombo(this, enum_, "plotStyle"));

  dimensionGroup_ = addRadioButtons("Dimension", {"2D", "3D"}, this, SLOT(dimensionSlot()));

  binaryCheck_ = addCheckBox("Binary", this, SLOT(binarySlot()));

  parametricCheck_ = addCheckBox("Parametric", this, SLOT(parametricSlot()));

  file_ = new CQGnuPlotFilename;

  addField("Filename", file_);

  addField("XMin", (xminEdit_ = new CQRealSpin));
  addField("XMax", (xmaxEdit_ = new CQRealSpin));

  addField("Using", (usingEdit_ = new QLineEdit));

  addField("Line Type", (lineTypeEdit_ = new CQIntegerSpin));

  xminEdit_    ->setValue(-10);
  xmaxEdit_    ->setValue(10);
  lineTypeEdit_->setValue(1);

  addStretch();
}
// *****************************************************************************
RenderSettingsDialog::RenderSettingsDialog(QWidget *parent)
    : QDialog(parent, Qt::WindowCloseButtonHint | Qt::WindowTitleHint)
{
    resize(400, 300);

    //TabWidget
    auto tabWidget = new QTabWidget;
    tabWidget->addTab(new GeneralTab(), tr("General"));
    tabWidget->addTab(new RenderTab(), tr("Renderer"));

    //ButtonBox
    auto closeButton = new QPushButton(tr("Close"));
    auto cancelButton = new QPushButton(tr("Cancel")); 
    auto applyButton = new QPushButton(tr("Apply"));
    auto renderButton = new QPushButton(tr("Render"));
    renderButton->setDefault(true);

    //Render button
    auto buttonLayout = new QHBoxLayout();
    buttonLayout->addWidget(renderButton);
    buttonLayout->addSpacing(10);
    buttonLayout->addStretch();
    buttonLayout->addWidget(closeButton);
    buttonLayout->addWidget(cancelButton);
    buttonLayout->addWidget(applyButton);

    //Main layout
    auto *mainLayout = new QVBoxLayout;
    mainLayout->addWidget(tabWidget);
    mainLayout->addItem(buttonLayout);

    setLayout(mainLayout);
}
Exemple #10
0
TsupportNootka::TsupportNootka(QWidget *parent) :
  TtouchArea(parent)
{
  QString makinkBetter = tr("You also can help with making Nootka better.");
  QString littleEnglish = tr("It requires little bit English, so if you can read a text below there will be something you may get involved.");
  QString br = QStringLiteral("<br>");
  auto headLab = new QLabel(QLatin1String("<big><b>") + makinkBetter + QLatin1String("</big></b><br>") + littleEnglish, this);
    headLab->setWordWrap(true);
    headLab->setAlignment(Qt::AlignCenter);
    headLab->setStyleSheet("background: palette(base)");
    headLab->setContentsMargins(5, 5, 5, 5);

//   auto donateLab = new QLabel(this);
//     donateLab->setWordWrap(true);
//     donateLab->setOpenExternalLinks(true);
// //     donateLab->setContentsMargins(5, 5, 5, 5);
//     donateLab->setStyleSheet(QStringLiteral("background: #0F3F0A; color: #FFFFFF;"));
//     donateLab->setText(QLatin1String("<ul>") + coloredLi("#42DA06", tr("Donate Nootka campaign")) + QLatin1String("<big>")
//        + tr("Feature by feature and Nootka became big and complex project.<br>"
//           "To be able developing this application further,<br>"
//           "to finish version for Android (and other mobile systems later on),<br>"
//           "an equipment capable for that is needed.<br>"
//           "Simply, the PC I'm working on is to old for that…<br>"
//           "Donate Nootka, please.")
//        + QLatin1String("<p><a href=\"http://sourceforge.net/donate/index.php?group_id=515420\">")
//        + tr("Through PayPal or a card") + QLatin1String("</a></p>")
//        + QLatin1String("<p align=\"center\"><a href=\"mailto:seelook.gmail.com\">")
//        + tr("or send email for an account number") + QLatin1String("</a></big></p>") + endLi + QLatin1String("</ul><br>"));
  QString supp;
  supp += QLatin1String("<ul>");
//   supp += QLatin1String("<li><big><b style=\"color: #FF8000;\">Make a donation</b></big><br>Nootka is free of charge but it requires some expenses.<br>To make donation use <a href=\"http://nootka.sourceforge.net\">Nootka site</a><br></li>");
  supp += coloredLi("#42DA06", tr("Donate Nootka campaign"))
       + QLatin1String("<a href=\"http://sourceforge.net/donate/index.php?group_id=515420\">")
       + tr("Through PayPal or a card") + QLatin1String("</a>")
       + QLatin1String("<p align=\"center\"><a href=\"mailto:seelook.gmail.com\">")
       + tr("or send email for an account number") + QLatin1String("</a></p>") + endLi;
  supp += coloredLi("#E57300", "Test Android version") + QLatin1String("Using <a href=\"http://sourceforge.net/p/nootka/bugs/\">bug tracker</a> or <a href=\"mailto:seelook.gmail.com\">email</a> send your phone/tablet model to inform that it works (or not)") + br + endLi;
  supp += QLatin1String("<li><big><b style=\"color: #0000C0;\">Translate Nootka</b></big><br>It does not require any programming skills. Just read <a href=\"http://sourceforge.net/p/nootka/hg/ci/default/tree/lang/how-to-translate.txt\">the instructions</a>,<br>translate and send your work.<br></li>");
  supp += QLatin1String("<li><big><b style=\"color: #FF0000;\">Report an issue</b></big><br>If you find any issue or a bug than request it through:<br><a href=\"http://sourceforge.net/p/nootka/bugs/\">bug tracker</a><br></li>");
  supp += QLatin1String("<li><big><b style=\"color: #C000C0;\">Vote on Nootka</b></big><br>There are a lot of services. For example:<br><a href=\"http://kde-apps.org/content/show.php/Nootka?content=143598\">Kde-Apps</a>, <a href=\"http://qt-apps.org/content/show.php/Nootka?content=148705\">Qt-Apps</a>, <a href=\"http://www.softpedia.com/get/Others/Home-Education/Nootka.shtml\">Softpedia</a><br>or add <b>like</b> or/and <b>g+</b> on <a href=\"http://nootka.sourceforge.net\">Nootka site</a><br></li>");
  supp += QLatin1String("<li><big><b>Express your opinion</b></big><br>Simply <a href=\"mailto:seelook.gmail.com\">send an email</a></li>");
  supp += QLatin1String("</ul><p>&nbsp;&nbsp;Thanks in advance<br>&nbsp;&nbsp;Author</p><br>");
  auto textLab = new QLabel(supp, this);
  textLab->setWordWrap(true);
  textLab->setOpenExternalLinks(true);

  auto lay = new QVBoxLayout;
#if !defined (Q_OS_ANDROID)
    lay->setContentsMargins(0, 0, 0, 0);
#endif
//     lay->addWidget(donateLab);
    lay->addWidget(headLab);
    lay->addWidget(textLab);
    lay->addStretch();
  setLayout(lay);

#if !defined (Q_OS_ANDROID)
  setMinimumWidth(fontMetrics().boundingRect("w").width() * 60);
#endif
}
  VariableListItem::VariableListItem(const std::string &t_name, 
      const std::string& t_keyValue,
      const boost::optional<openstudio::model::OutputVariable> &t_variable,
      const openstudio::model::Model &t_model)
    : m_name(t_name),
      m_keyValue(t_keyValue),
      m_variable(t_variable),
      m_model(t_model)
  {
    auto hbox = new QHBoxLayout();
    hbox->setContentsMargins(10,10,10,10);
    hbox->setSpacing(10);

    m_onOffButton = new OSSwitch();
    connect(m_onOffButton, &OSSwitch::clicked, this, &VariableListItem::onOffClicked);
    hbox->addWidget(m_onOffButton);
    m_onOffButton->setChecked(m_variable.is_initialized());

    hbox->addWidget(new QLabel(openstudio::toQString(m_name + ",")));
    hbox->addWidget(new QLabel(openstudio::toQString(m_keyValue)));
    hbox->addStretch();
    m_combobox = new OSComboBox();
    connect(m_combobox, static_cast<void (OSComboBox::*)(const QString &)>(&OSComboBox::currentIndexChanged), this, &VariableListItem::indexChanged);
    if (m_variable)
    {
      m_combobox->bind(*m_variable, "reportingFrequency");
    }

    hbox->addWidget(m_combobox);

    setLayout(hbox);
    onOffClicked(m_variable.is_initialized());

  }
Exemple #12
0
void OSDialog::createLayout()
{
  m_upperLayout = new QVBoxLayout();

  auto lowerLayout = new QHBoxLayout();

  lowerLayout->addStretch();

  m_backButton = new QPushButton("Back",this);
  connect(m_backButton, &QPushButton::clicked, this, &OSDialog::on_backButton);
  connect(m_backButton, &QPushButton::clicked, this, &OSDialog::backButtonClicked);
  lowerLayout->addWidget(m_backButton);
  m_backButton->hide();

  m_okButton = new QPushButton("OK",this);
  m_okButton->setDefault(true);
  connect(m_okButton, &QPushButton::clicked, this, &OSDialog::on_okButton);
  connect(m_okButton, &QPushButton::clicked, this, &OSDialog::okButtonClicked);
  lowerLayout->addWidget(m_okButton);

  m_cancelButton = new QPushButton("Cancel",this);
  connect(m_cancelButton, &QPushButton::clicked, this, &OSDialog::on_cancelButton);
  connect(m_cancelButton, &QPushButton::clicked, this, &OSDialog::cancelButtonClicked);
  lowerLayout->addWidget(m_cancelButton);

  auto mainLayout = new QVBoxLayout();
  mainLayout->setContentsMargins(m_layoutContentsMargins);
  mainLayout->addLayout(m_upperLayout);
  mainLayout->addLayout(lowerLayout);

  setLayout(mainLayout);
}
OSCollapsibleItemHeader::OSCollapsibleItemHeader(const std::string & text,
                                                 const OSItemId& itemId,
                                                 OSItemType type,
                                                 QWidget * parent)
  : QWidget(parent),
    m_mouseDown(false)
{
  setFixedHeight(50);
  setSizePolicy(QSizePolicy::Preferred,QSizePolicy::Fixed);
  setObjectName("OSCollapsibleItemHeader");

  auto mainHLayout = new QHBoxLayout();
  mainHLayout->setContentsMargins(9, 0, 9, 0);
  setLayout(mainHLayout);

  // Label

  QLabel * textLabel = new QLabel(QString::fromStdString(text));
  textLabel->setWordWrap(true);
  textLabel->setObjectName("H2");
  mainHLayout->addWidget(textLabel,10);

  mainHLayout->addStretch();

  // Arrow

  m_arrowLabel = new QLabel();
  mainHLayout->addWidget(m_arrowLabel);

  setSelected(false);

  setExpanded(false);
}
    CommandMappingsPrivate(CommandMappings *parent)
        : q(parent)
    {
        groupBox = new QGroupBox(parent);
        groupBox->setTitle(CommandMappings::tr("Command Mappings"));

        filterEdit = new FancyLineEdit(groupBox);
        filterEdit->setFiltering(true);

        commandList = new QTreeWidget(groupBox);
        commandList->setRootIsDecorated(false);
        commandList->setUniformRowHeights(true);
        commandList->setSortingEnabled(true);
        commandList->setColumnCount(3);

        QTreeWidgetItem *item = commandList->headerItem();
        item->setText(2, CommandMappings::tr("Target"));
        item->setText(1, CommandMappings::tr("Label"));
        item->setText(0, CommandMappings::tr("Command"));

        defaultButton = new QPushButton(CommandMappings::tr("Reset All"), groupBox);
        defaultButton->setToolTip(CommandMappings::tr("Reset all to default."));

        importButton = new QPushButton(CommandMappings::tr("Import..."), groupBox);
        exportButton = new QPushButton(CommandMappings::tr("Export..."), groupBox);

        auto hboxLayout1 = new QHBoxLayout();
        hboxLayout1->addWidget(defaultButton);
        hboxLayout1->addStretch();
        hboxLayout1->addWidget(importButton);
        hboxLayout1->addWidget(exportButton);

        auto hboxLayout = new QHBoxLayout();
        hboxLayout->addWidget(filterEdit);

        auto vboxLayout1 = new QVBoxLayout(groupBox);
        vboxLayout1->addLayout(hboxLayout);
        vboxLayout1->addWidget(commandList);
        vboxLayout1->addLayout(hboxLayout1);

        auto vboxLayout = new QVBoxLayout(parent);
        vboxLayout->addWidget(groupBox);

        q->connect(exportButton, &QPushButton::clicked,
                   q, &CommandMappings::exportAction);
        q->connect(importButton, &QPushButton::clicked,
                   q, &CommandMappings::importAction);
        q->connect(defaultButton, &QPushButton::clicked,
                   q, &CommandMappings::defaultAction);

        commandList->sortByColumn(0, Qt::AscendingOrder);

        q->connect(filterEdit, &FancyLineEdit::textChanged,
                   q, &CommandMappings::filterChanged);
        q->connect(commandList, &QTreeWidget::currentItemChanged,
                   q, &CommandMappings::currentCommandChanged);

        new HeaderViewStretcher(commandList->header(), 1);
    }
ChangeAliasDialog::ChangeAliasDialog(const QString& oldAlias, const QString& filename, QWidget* parent):QDialog(parent)
{
  m_newAlias = "";

  int boxWidth = fontMetrics().width(filename) + 20;
  QPalette p(palette());
  p.setColor(QPalette::Base, Qt::lightGray);    

  QLabel *fileLabel = new QLabel(tr("&EnergyPlus file:"));
  auto fileName = new QLineEdit(filename);
  fileLabel->setBuddy(fileName);
  fileName->setReadOnly(true);
  fileName->setPalette(p);
  fileName->setMinimumWidth(boxWidth);

  QLabel *oldAliasLabel = new QLabel(tr("&Old alias:"));
  auto oldAliasName = new QLineEdit(oldAlias);
  oldAliasLabel->setBuddy(oldAliasName);
  oldAliasName->setReadOnly(true);
  oldAliasName->setPalette(p);
  oldAliasName->setMinimumWidth(boxWidth);

  QLabel *newAliasLabel = new QLabel(tr("&New alias:"));
  m_newAliasName = new QLineEdit;
  newAliasLabel->setBuddy(m_newAliasName);
  m_newAliasName->setMinimumWidth(boxWidth);

  m_updateButton = new QPushButton(tr("Update"));
  m_updateButton->setDefault(true);
  m_updateButton->setEnabled(false);

  QPushButton *cancelButton = new QPushButton(tr("Cancel"));

  connect(m_updateButton, &QPushButton::clicked, this, &ChangeAliasDialog::updateClicked);
  connect(cancelButton, &QPushButton::clicked, this, &ChangeAliasDialog::close);
  connect(m_newAliasName, &QLineEdit::textChanged, this, &ChangeAliasDialog::enableUpdateButton);
// layout
  auto gridLayout = new QGridLayout;
  gridLayout->addWidget(fileLabel, 0, 0);
  gridLayout->addWidget(fileName, 0, 1);
  gridLayout->addWidget(oldAliasLabel, 1, 0);
  gridLayout->addWidget(oldAliasName, 1, 1);
  gridLayout->addWidget(newAliasLabel, 2, 0);
  gridLayout->addWidget(m_newAliasName, 2, 1);

  auto buttonLayout = new QHBoxLayout;
  buttonLayout->addStretch();
  buttonLayout->addWidget(m_updateButton);
  buttonLayout->addWidget(cancelButton);

  auto mainLayout = new QVBoxLayout;
  mainLayout->addLayout(gridLayout);
  mainLayout->addLayout(buttonLayout);

  setLayout(mainLayout);

  setWindowTitle(tr("Change alias"));
  setFixedHeight(sizeHint().height());
}
Exemple #16
0
ViewPropsProgressInfo::ViewPropsProgressInfo(QWidget* parent,
                                             const QUrl& dir,
                                             const ViewProperties& viewProps) :
    QDialog(parent),
    m_dir(dir),
    m_viewProps(0),
    m_label(0),
    m_progressBar(0),
    m_dirSizeJob(0),
    m_applyViewPropsJob(0),
    m_timer(0)
{
    const QSize minSize = minimumSize();
    setMinimumSize(QSize(320, minSize.height()));
    setWindowTitle(i18nc("@title:window", "Applying View Properties"));
    setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Minimum);

    m_viewProps = new ViewProperties(dir);
    m_viewProps->setDirProperties(viewProps);

    // the view properties are stored by the ViewPropsApplierJob, so prevent
    // that the view properties are saved twice:
    m_viewProps->setAutoSaveEnabled(false);

    auto layout = new QVBoxLayout(this);
    setLayout(layout);

    m_label = new QLabel(i18nc("@info:progress", "Counting folders: %1", 0), this);
    layout->addWidget(m_label);

    m_progressBar = new QProgressBar(this);
    m_progressBar->setMinimum(0);
    m_progressBar->setMaximum(0);
    m_progressBar->setValue(0);
    layout->addWidget(m_progressBar);

    layout->addStretch();

    auto buttonBox = new QDialogButtonBox(QDialogButtonBox::Cancel, this);
    connect(buttonBox, &QDialogButtonBox::accepted, this, &ViewPropsProgressInfo::accept);
    connect(buttonBox, &QDialogButtonBox::rejected, this, &ViewPropsProgressInfo::reject);
    layout->addWidget(buttonBox);

    // Use the directory size job to count the number of directories first. This
    // allows to give a progress indication for the user when applying the view
    // properties later.
    m_dirSizeJob = KIO::directorySize(dir);
    connect(m_dirSizeJob, &KIO::DirectorySizeJob::result,
            this, &ViewPropsProgressInfo::applyViewProperties);

    // The directory size job cannot emit any progress signal, as it is not aware
    // about the total number of directories. Therefor a timer is triggered, which
    // periodically updates the current directory count.
    m_timer = new QTimer(this);
    connect(m_timer, &QTimer::timeout,
            this, &ViewPropsProgressInfo::updateProgress);
    m_timer->start(300);
}
	QWidget* createWidgets(BasePropertyWidget* parent)
	{
		m_parent = parent;
		m_property = parent->property();
		m_propertyValue = m_property->value<value_type>();
		if (!m_propertyValue)
			return nullptr;
		m_value = m_propertyValue->value();

		// Get widget creator
		std::string widget;
		auto meta = m_propertyValue->metaContainer().get<meta::Widget>();
		if (meta)
			widget = meta->type();

		auto id = std::type_index(typeid(base_type));
		m_widgetCreator = PropertyWidgetFactory::instance().creator(id, widget);

		auto container = new QWidget(parent);
		auto layout = new QVBoxLayout(container);
		layout->setContentsMargins(0, 0, 0, 0);

		auto topLayout = new QHBoxLayout;
		m_toggleButton = new QPushButton(QPushButton::tr("show"));
		m_toggleButton->setCheckable(true);
		QObject::connect(m_toggleButton, &QPushButton::toggled, [this](bool toggled){ toggleView(toggled); });
		topLayout->addWidget(m_toggleButton);

		if (!list_traits::fixed(m_value))
		{
			m_spinBox = new QSpinBox;
			m_spinBox->setMaximum(INT_MAX);
			m_spinBox->setValue(list_traits::size(m_value));
			topLayout->addWidget(m_spinBox, 1);

			auto resizeButton = new QPushButton(QPushButton::tr("resize"));
			QObject::connect(resizeButton, &QPushButton::clicked, [this]() { 
				for (auto w : m_propertyWidgets) 
					w->updatePropertyValue(); 
				resize(m_spinBox->value()); 
			});
			QObject::connect(resizeButton, &QPushButton::clicked, parent, &BasePropertyWidget::setWidgetDirty);
			topLayout->addWidget(resizeButton);
		}
		else
			topLayout->addStretch();
		
		m_scrollArea = new QScrollArea();

		layout->addLayout(topLayout);
		layout->addWidget(m_scrollArea, 1);

		m_scrollArea->hide();
		m_scrollArea->setWidgetResizable(true);

		return container;
	}
void CollapsibleComponentHeader::createLayout(const std::string& text, int numResults, int numPages)
{
  setFixedHeight(50);
  setSizePolicy(QSizePolicy::Preferred,QSizePolicy::Fixed);
  setObjectName("CollapsibleComponentHeader");
  setCheckable(true);

  auto mainHLayout = new QHBoxLayout();
  setLayout(mainHLayout);

  // Arrow
  m_arrowLabel = new QLabel();
  mainHLayout->addWidget(m_arrowLabel);

  // Name
  m_text = new QLabel(QString::fromStdString(text));
  m_text->setWordWrap(true);
  m_text->setObjectName("H2");
  mainHLayout->addWidget(m_text);

  // Stretch
  mainHLayout->addStretch();

  // Page Navigator
  m_pageNavigator = new PageNavigator(numPages,NUM_PAGES_LISTED,this);
  mainHLayout->addWidget(m_pageNavigator);

  connect(m_pageNavigator, &PageNavigator::getComponentsByPage, this, &CollapsibleComponentHeader::getComponentsByPage);

  connect(m_pageNavigator, &PageNavigator::getComponentsByPage, this, &CollapsibleComponentHeader::on_getComponentsByPage);

  // Stretch
  mainHLayout->addStretch();

  // Num results returned
  QString num;
  m_numLabel = new QLabel(num.setNum(numResults));
  m_numLabel->setWordWrap(true);
  m_numLabel->setObjectName("H2");
  mainHLayout->addWidget(m_numLabel);

  setChecked(false);

}
EnvironmentAspectWidget::EnvironmentAspectWidget(EnvironmentAspect *aspect, QWidget *additionalWidget) :
    m_aspect(aspect),
    m_additionalWidget(additionalWidget)
{
    QTC_CHECK(m_aspect);

    setContentsMargins(0, 0, 0, 0);
    auto topLayout = new QVBoxLayout(this);
    topLayout->setMargin(0);

    auto baseEnvironmentWidget = new QWidget;
    auto baseLayout = new QHBoxLayout(baseEnvironmentWidget);
    baseLayout->setMargin(0);
    auto label = new QLabel(tr("Base environment for this run configuration:"), this);
    baseLayout->addWidget(label);
    m_baseEnvironmentComboBox = new QComboBox;
    QList<int> bases = m_aspect->possibleBaseEnvironments();
    int currentBase = m_aspect->baseEnvironmentBase();
    QString baseDisplayName;
    foreach (int i, bases) {
        const QString displayName = m_aspect->baseEnvironmentDisplayName(i);
        m_baseEnvironmentComboBox->addItem(displayName, i);
        if (i == currentBase) {
            m_baseEnvironmentComboBox->setCurrentIndex(m_baseEnvironmentComboBox->count() - 1);
            baseDisplayName = displayName;
        }
    }
    if (m_baseEnvironmentComboBox->count() == 1)
        m_baseEnvironmentComboBox->setEnabled(false);

    connect(m_baseEnvironmentComboBox, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
            this, &EnvironmentAspectWidget::baseEnvironmentSelected);

    baseLayout->addWidget(m_baseEnvironmentComboBox);
    baseLayout->addStretch(10);
    if (additionalWidget)
        baseLayout->addWidget(additionalWidget);

    m_environmentWidget = new EnvironmentWidget(this, baseEnvironmentWidget);
    m_environmentWidget->setBaseEnvironment(m_aspect->baseEnvironment());
    m_environmentWidget->setBaseEnvironmentText(baseDisplayName);
    m_environmentWidget->setUserChanges(m_aspect->userEnvironmentChanges());
    m_environmentWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    topLayout->addWidget(m_environmentWidget);

    connect(m_environmentWidget, &EnvironmentWidget::userChangesChanged,
            this, &EnvironmentAspectWidget::userChangesEdited);

    connect(m_aspect, &EnvironmentAspect::baseEnvironmentChanged,
            this, &EnvironmentAspectWidget::changeBaseEnvironment);
    connect(m_aspect, &EnvironmentAspect::userEnvironmentChangesChanged,
            this, &EnvironmentAspectWidget::changeUserChanges);
    connect(m_aspect, &EnvironmentAspect::environmentChanged,
            this, &EnvironmentAspectWidget::environmentChanged);
}
LibraryTabWidget::LibraryTabWidget(QWidget * parent)
  : QWidget(parent)
{
  auto mainLayout = new QVBoxLayout();

  mainLayout->setSpacing(0);

  mainLayout->setContentsMargins(0,0,0,0);

  setLayout(mainLayout);

  m_tabBar = new QWidget(this);

  m_tabBar->setFixedHeight(29);

  m_tabBar->setObjectName("VBlueGradientWidget");

  m_tabBar->setContentsMargins(0,0,5,0);

  m_removeButton = new QPushButton(this);

  QString str;
  str.append("QWidget { ");
  str.append("border: none;");
  str.append(" background-image: url(\":/images/delete.png\")");
  str.append("}");

  m_removeButton->setFlat(true);
  m_removeButton->setStyleSheet(str);
  m_removeButton->setFixedSize(20, 20);
  m_removeButton->setToolTip("Remove object");

  // Default to hide
  m_removeButton->hide();

  auto isConnected = connect(m_removeButton, SIGNAL(clicked(bool)), this, SIGNAL(removeButtonClicked(bool)));
  OS_ASSERT(isConnected);
 
  auto hLayout = new QHBoxLayout();
  hLayout->setContentsMargins(0, 0, 0, 0);
  hLayout->addStretch();
  hLayout->addWidget(m_removeButton, 0, Qt::AlignVCenter);

  m_tabBar->setLayout(hLayout);

  layout()->addWidget(m_tabBar);

  m_pageStack = new QStackedWidget();

  m_pageStack->setStyleSheet("QStackedWidget { border: none;}");

  m_pageStack->setContentsMargins(0,0,0,0);

  layout()->addWidget(m_pageStack);
}
void FacebookAddAccountWidget::createGui(bool showButtons)
{
    auto mainLayout = make_owned<QVBoxLayout>(this);

    auto formWidget = make_owned<QWidget>(this);
    mainLayout->addWidget(formWidget);

    auto layout = make_owned<QFormLayout>(formWidget);

    m_username = make_owned<QLineEdit>(this);
    connect(m_username, SIGNAL(textEdited(QString)), this, SLOT(dataChanged()));
    layout->addRow(tr("Username") + ':', m_username);

    m_password = make_owned<QLineEdit>(this);
    connect(m_password, SIGNAL(textEdited(QString)), this, SLOT(dataChanged()));
    m_password->setEchoMode(QLineEdit::Password);
    layout->addRow(tr("Password") + ':', m_password);

    m_rememberPassword = make_owned<QCheckBox>(tr("Remember Password"), this);
    layout->addRow(0, m_rememberPassword);

    m_identity = m_pluginInjectedFactory->makeInjected<IdentitiesComboBox>(this);
    connect(m_identity, SIGNAL(currentIndexChanged(int)), this, SLOT(dataChanged()));
    layout->addRow(tr("Account Identity") + ':', m_identity);

    auto infoLabel = make_owned<QLabel>(
        tr("<font size='-1'><i>Select or enter the identity that will be associated with this account.</i></font>"),
        this);
    infoLabel->setWordWrap(true);
    infoLabel->setAlignment(Qt::AlignTop | Qt::AlignLeft);
    infoLabel->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum));
    layout->addRow(0, infoLabel);

    mainLayout->addStretch(100);

    auto buttons = make_owned<QDialogButtonBox>(Qt::Horizontal, this);
    mainLayout->addWidget(buttons);

    m_addAccountButton =
        make_owned<QPushButton>(qApp->style()->standardIcon(QStyle::SP_DialogApplyButton), tr("Add Account"), this);
    auto cancelButton =
        make_owned<QPushButton>(qApp->style()->standardIcon(QStyle::SP_DialogCancelButton), tr("Cancel"), this);

    buttons->addButton(m_addAccountButton, QDialogButtonBox::AcceptRole);
    buttons->addButton(cancelButton, QDialogButtonBox::DestructiveRole);

    connect(m_addAccountButton, SIGNAL(clicked(bool)), this, SLOT(apply()));
    connect(cancelButton, SIGNAL(clicked(bool)), this, SLOT(cancel()));

    if (!showButtons)
        buttons->hide();
}
ColorPickerSettingsWidget::ColorPickerSettingsWidget(QWidget *parent) :
    QWidget(parent),
    m_editorSensitiveCheckBox(new QCheckBox(this)),
    m_insertOnChangeCheckBox(new QCheckBox(this))
{
    m_editorSensitiveCheckBox->setText(QLatin1String("Show the available formats according to the current editor."));
    m_insertOnChangeCheckBox->setText(QLatin1String("Insert text when the displayed color changes."));

    auto mainLayout = new QVBoxLayout(this);
    mainLayout->addWidget(m_editorSensitiveCheckBox);
    mainLayout->addWidget(m_insertOnChangeCheckBox);
    mainLayout->addStretch();
}
void SoundChatConfigurationWidget::createGui()
{
	auto layout = new QVBoxLayout(this);

	m_useCustomSoundCheckBox = new QCheckBox(tr("Use custom sound"));
	m_customSoundSelectFile = new SoundSelectFile{m_soundManager, this};

	connect(m_useCustomSoundCheckBox, SIGNAL(stateChanged(int)), this, SLOT(updateState()));
	connect(m_customSoundSelectFile, SIGNAL(fileChanged()), this, SLOT(updateState()));

	layout->addWidget(m_useCustomSoundCheckBox);
	layout->addWidget(m_customSoundSelectFile);
	layout->addStretch(100);
}
Exemple #24
0
ItemSync::ItemSync(const QString &label, const QString &icon, ItemWidget *childItem)
    : QWidget( childItem->widget()->parentWidget() )
    , ItemWidgetWrapper(childItem, this)
    , m_label( new QTextEdit(this) )
    , m_icon( new IconWidget(icon, this) )
{
    auto layout = new QVBoxLayout(this);
    layout->setContentsMargins(0, 0, 0, 0);
    layout->setSpacing(0);
    layout->setSizeConstraint(QLayout::SetMinimumSize);

    auto labelLayout = new QHBoxLayout;
    connect( layout, &QVBoxLayout::destroyed,
             labelLayout, &QHBoxLayout::deleteLater );
    labelLayout->setContentsMargins(0, 0, 0, 0);
    labelLayout->setSpacing(0);

    labelLayout->addWidget(m_icon);
    labelLayout->addWidget(m_label);
    labelLayout->addStretch();

    layout->addLayout(labelLayout);

    QWidget *w = childItem->widget();
    layout->addWidget(w);
    w->setObjectName("item_child");
    w->setParent(this);

    m_label->setObjectName("item_child");

    m_label->document()->setDefaultFont(font());

    QTextOption option = m_label->document()->defaultTextOption();
    option.setWrapMode(QTextOption::WrapAtWordBoundaryOrAnywhere);
    m_label->document()->setDefaultTextOption(option);

    m_label->setReadOnly(true);
    m_label->setUndoRedoEnabled(false);

    m_label->setFocusPolicy(Qt::NoFocus);
    m_label->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    m_label->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    m_label->setFrameStyle(QFrame::NoFrame);
    m_label->setContextMenuPolicy(Qt::NoContextMenu);

    m_label->viewport()->installEventFilter(this);

    m_label->setPlainText(label);
}
Exemple #25
0
ConsoleArea::ConsoleArea(QWidget *parent)
    : QScrollArea(parent), label(new QLabel(this)), widget(new QWidget())
{
    setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    label->setFont(QFont("Courier New"));
    auto lay = new QVBoxLayout();
    widget->setLayout(lay);
    lay->addStretch();
    lay->addWidget(label);
    lay->setMargin(0);
    lay->setSpacing(0);
    label->setWordWrap(true);
    widget->setMinimumSize(size());
    setWidget(widget);
}
Exemple #26
0
YoudaoDictWidget::YoudaoDictWidget(QWidget *parent)
    : ContentFrame(parent),
      youdao_api_(new YoudaoAPI),
      word_label_(new QLabel),
      explains_label_(new QLabel),
      us_voice_btn_(new ImageButton(":/images/audio-normal.svg",
                                    ":/images/audio-hover.svg",
                                    ":/images/audio-press.svg")),
      uk_voice_btn_(new ImageButton(":/images/audio-normal.svg",
                                    ":/images/audio-hover.svg",
                                    ":/images/audio-press.svg")),
      voice_player_(new QMediaPlayer),
      us_voice_label_(new QLabel),
      uk_voice_label_(new QLabel)
{
    QHBoxLayout *voice_layout = new QHBoxLayout;
    voice_layout->addWidget(uk_voice_btn_);
    voice_layout->addSpacing(5);
    voice_layout->addWidget(uk_voice_label_);
    voice_layout->addSpacing(50);
    voice_layout->addWidget(us_voice_btn_);
    voice_layout->addSpacing(5);
    voice_layout->addWidget(us_voice_label_);
    voice_layout->addStretch();

    uk_voice_btn_->hide();
    us_voice_btn_->hide();
    us_voice_label_->hide();
    uk_voice_label_->hide();

    word_label_->setWordWrap(true);
    explains_label_->setWordWrap(true);

    word_label_->setStyleSheet("QLabel { font-size: 20px; }");
    word_label_->setTextInteractionFlags(Qt::TextSelectableByMouse);
    explains_label_->setTextInteractionFlags(Qt::TextSelectableByMouse);

    addWidget(word_label_);
    addSpacing(5);
    addLayout(voice_layout);
    addSpacing(10);
    addWidget(explains_label_);
    addStretch();

    connect(youdao_api_, &YoudaoAPI::searchFinished, this, &YoudaoDictWidget::queryWordFinished);
    connect(us_voice_btn_, &ImageButton::clicked, this, &YoudaoDictWidget::playUSVoice);
    connect(uk_voice_btn_, &ImageButton::clicked, this, &YoudaoDictWidget::playUKVoice);
}
OptionsTiffImporter::OptionsTiffImporter(QWidget* pParent) :
   LabeledSectionGroup(pParent),
   mpDescriptor(NULL)
{
   QWidget* pFileBrowserWidget = new QWidget(this);
   QLabel* pFileBrowserLabel = new QLabel("Select an ISD metadata file or leave blank for no ISD metadata:",
      pFileBrowserWidget);
   mpFilename = new FileBrowser(pFileBrowserWidget);
   mpFilename->setWhatsThis("<p>An ISD metadata file is an XML file shipped with some imagery such as Quickbird. "
      "It contains image metadata. If you have an ISD metadata file and would like to load it with the cube data, "
      "select it here. If you do not want to load an ISD metadata file, leave this field blank.</p>"
      "Currently, the following information is loaded from the ISD file:"
      "<ul><li>RPC00B"
      "<li>Image header information needed to use the RPC00B"
      "</ul>");
   mpFilename->setBrowseCaption("Select ISD Metadata File");
   mpFilename->setBrowseFileFilters("ISD Metadata Files (*.xml)");
   mpFilename->setBrowseExistingFile(true);

   QGridLayout* pLayout = new QGridLayout(pFileBrowserWidget);
   pLayout->setMargin(0);
   pLayout->setSpacing(5);
   pLayout->addWidget(pFileBrowserLabel, 0, 0);
   pLayout->addWidget(mpFilename, 1, 0, 1, 2);
   pLayout->setColumnStretch(1, 5);

   LabeledSection* pFileBrowserSection = new LabeledSection(pFileBrowserWidget, "ISD Metadata File", this);

   // Layout
   QWidget* pWidget = widget();
   if (pWidget != NULL)
   {
      QLayout* pLayout = pWidget->layout();
      if (pLayout != NULL)
      {
         pLayout->setMargin(10);
      }
   }

   // Initialization
   addSection(pFileBrowserSection);
   addStretch(10);
   setSizeHint(300, 50);

   // Connections
   VERIFYNR(connect(mpFilename, SIGNAL(filenameChanged(const QString&)), this, SLOT(loadIsdMetadata(const QString&))));
}
OptionsPngExporter::OptionsPngExporter() :
   LabeledSectionGroup(NULL)
{
   // Resolution section
   mpResolutionWidget = new ResolutionWidget(this);
   LabeledSection* pResolutionSection = new LabeledSection(mpResolutionWidget, "Image Size", this);
   mpResolutionWidget->setAspectRatioLock(OptionsPngExporter::getSettingAspectRatioLock());
   mpResolutionWidget->setResolution(OptionsPngExporter::getSettingOutputWidth(),
      OptionsPngExporter::getSettingOutputHeight());
   mpResolutionWidget->setUseViewResolution(OptionsPngExporter::getSettingUseViewResolution());

   // Initialization
   addSection(pResolutionSection);
   addStretch(10);
   setSizeHint(350, 150);

}
Exemple #29
0
QWidget *ZoomSettings::createUiWidget(QWidget *parent)
{
	QWidget *widget = new QWidget(parent);
	auto layout = new QVBoxLayout(widget);

	auto *resetButton = new QPushButton(tr("Normal Size"), widget);
	auto *fitButton = new QPushButton(tr("Fit To Window"), widget);

	connect(resetButton, &QPushButton::clicked, this, &ZoomSettings::resetZoom);
	connect(fitButton, &QPushButton::clicked, this, &ZoomSettings::fitToWindow);

	layout->addWidget(resetButton);
	layout->addWidget(fitButton);
	layout->addStretch(1);

	return widget;
}
  void SpacesSubtabGridView::showLoadTypeFilter()
  {
    auto layout = new QVBoxLayout();

    auto label = new QLabel();
    label->setText(LOADTYPE);
    label->setObjectName("H3");
    layout->addWidget(label, Qt::AlignTop | Qt::AlignLeft);

    m_loadTypeFilter = new QComboBox();
    initializeLoadTypeFilter();
    m_loadTypeFilter->setFixedWidth(1.5*OSItem::ITEM_WIDTH);
    connect(m_loadTypeFilter, &QComboBox::currentTextChanged, this, &openstudio::SpacesSubtabGridView::loadTypeFilterChanged);

    layout->addWidget(m_loadTypeFilter, Qt::AlignTop | Qt::AlignLeft);
    layout->addStretch();
    m_filterGridLayout->addLayout(layout, m_filterGridLayout->rowCount() - 1, m_filterGridLayout->columnCount());
  }