void XyzWindow::CreateXYZView() { QFrame *XyFrame; QFrame *XzFrame; QFrame *ZyFrame; QWidget *centralWidget; centralWidget = new QWidget(this); QPalette palette; palette.setColor(QPalette::Background , QColor(/*200,200,200*/167, 210, 200)); centralWidget->setAutoFillBackground(true); centralWidget->setPalette(palette); XzFrame = new QFrame(centralWidget); XzFrame->setGeometry(QRect(mXorigin1,mYorigin1 , mx+2*FRAM_BORDER , mz+2*FRAM_BORDER)); XzFrame->setFrameShape(QFrame::StyledPanel); XzFrame->setFrameShadow(QFrame::Raised); ZyFrame = new QFrame(centralWidget); ZyFrame->setGeometry(QRect(mXorigin2 , mYorigin2 , mz+2*FRAM_BORDER ,my+2*FRAM_BORDER)); ZyFrame->setFrameShape(QFrame::StyledPanel); ZyFrame->setFrameShadow(QFrame::Raised); XyFrame = new QFrame(centralWidget); XyFrame->setGeometry(QRect(mXorigin1 , mYorigin2 , mx+2*FRAM_BORDER ,my+2*FRAM_BORDER)); XyFrame->setFrameShape(QFrame::StyledPanel); XyFrame->setFrameShadow(QFrame::Raised); palette.setColor(QPalette::Background , QColor(255,0,0)); XzFrame->setAutoFillBackground(true); XzFrame->setPalette(palette); ZyFrame->setAutoFillBackground(true); ZyFrame->setPalette(palette); XyFrame->setAutoFillBackground(true); XyFrame->setPalette(palette); setCentralWidget(centralWidget); QGLFormat glFormat; glFormat.setRgba(true); glFormat.setDoubleBuffer(true); glFormat.setDepth(true); mXY_GLw = new XyzGL(glFormat , XY_VIEW , XyFrame , this); mXY_GLw->setGeometry(FRAM_BORDER , FRAM_BORDER,mx,my); mXY_GLw->setAttribute(Qt::WA_DeleteOnClose); mXZ_GLw = new XyzGL(glFormat , XZ_VIEW , XzFrame , this); mXZ_GLw->setGeometry(FRAM_BORDER , FRAM_BORDER , mx ,mz); mXZ_GLw->setAttribute(Qt::WA_DeleteOnClose); mYZ_GLw = new XyzGL(glFormat , ZY_VIEW , ZyFrame , this); mYZ_GLw->setGeometry(FRAM_BORDER , FRAM_BORDER ,mz ,my); mYZ_GLw->setAttribute(Qt::WA_DeleteOnClose); }
/* * Constructs a SQDFrame as a child of 'parent', with the * name 'name' and widget flags set to 'f'. */ SQDFrame::SQDFrame( QWidget* parent, const char* name, WFlags fl ) : QWidget( parent, name, fl ), HFSolver(NULL) { if ( !name ) setName( "SQDFrame" ); potLabel = new QLabel( this, "poteLabel" ); potLabel->setGeometry( QRect( 240, 20, 260, 24 ) ); potFrame = new NxyCurvePlot(this,"potPlot"); potFrame->setGeometry( QRect( 20, 60, 540, 200 ) ); potFrame->setFrameShape( QFrame::StyledPanel ); potFrame->setFrameShadow( QFrame::Raised ); wfsLabel = new QLabel( this, "wfsLabel" ); wfsLabel->setGeometry( QRect( 160, 280, 400, 24 ) ); wfsFrame = new NxyCurvePlot(this,"wfsPlot"); wfsFrame->setGeometry( QRect( 20, 320, 540, 270 ) ); d_log = new QTextEdit(this); d_log->setGeometry( QRect( 40, 600, 510, 200 )); d_log->setTextFormat(Qt::LogText); QFrame *hb = new QFrame(this,"buttonbox"); hb->setGeometry(QRect(40,805,540,60)); QHBoxLayout *layout = new QHBoxLayout(hb); quitButton = new QPushButton(hb, "quitButton" ); layout->addItem(new QSpacerItem( 50, 20, QSizePolicy::Expanding, QSizePolicy::Minimum )); layout->addWidget(quitButton); layout->addItem(new QSpacerItem( 50, 20, QSizePolicy::Fixed, QSizePolicy::Minimum )); saveButton = new QPushButton( hb, "saveButton" ); layout->addWidget(saveButton); layout->addItem(new QSpacerItem( 50, 20, QSizePolicy::Expanding, QSizePolicy::Minimum )); connect( quitButton, SIGNAL(clicked()), qApp, SLOT(quit()) ); connect( saveButton, SIGNAL(clicked()), this, SLOT(slotSave()) ); resize( QSize(600, 860).expandedTo(minimumSizeHint()) ); languageChange(); clearWState( WState_Polished ); }
BtConfigDialog::BtConfigDialog(QWidget* parent) : QDialog(parent), m_maxItemWidth(0), m_previousPageIndex(-2) { setWindowFlags(Qt::Window); m_contentsList = new QListWidget(this); m_contentsList->setViewMode(QListView::IconMode); m_contentsList->setMovement(QListView::Static); m_contentsList->setSpacing(m_contentsList->spacing() + 10); //looks better m_pageWidget = new QStackedWidget(this); m_pageWidget->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding); QHBoxLayout *mainLayout = new QHBoxLayout; setLayout(mainLayout); mainLayout->addWidget(m_contentsList); m_pageLayout = new QVBoxLayout; mainLayout->addLayout(m_pageLayout); m_pageLayout->addWidget(m_pageWidget); // Horizontal line QFrame* line = new QFrame(); line->setGeometry(QRect(1, 1, 1, 3)); line->setFrameShape(QFrame::HLine); line->setFrameShadow(QFrame::Sunken); line->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); m_pageLayout->addWidget(line); connect(m_contentsList, SIGNAL(currentRowChanged(int)), this, SLOT(slotChangePage(int)) ); }
ZoomScrollTrack2::ZoomScrollTrack2(QWidget *parent) : QDialog(parent) { // // Set up the GUI // setFixedSize(782, 376); setWindowTitle("Zooming and Scrolling with Track Line (2)"); // The frame on the left side QFrame *frame = new QFrame(this); frame->setGeometry(4, 4, 120, 370); frame->setFrameShape(QFrame::StyledPanel); // Pointer push button QPushButton *pointerPB = new QPushButton(QIcon(":/pointer.png"), "Pointer", frame); pointerPB->setGeometry(4, 8, 112, 28); pointerPB->setStyleSheet("QPushButton { text-align:left; padding:5px}"); pointerPB->setCheckable(true); // Zoom In push button QPushButton *zoomInPB = new QPushButton(QIcon(":/zoomin.png"), "Zoom In", frame); zoomInPB->setGeometry(4, 36, 112, 28); zoomInPB->setStyleSheet("QPushButton { text-align:left; padding:5px}"); zoomInPB->setCheckable(true); // Zoom Out push button QPushButton *zoomOutPB = new QPushButton(QIcon(":/zoomout.png"), "Zoom Out", frame); zoomOutPB->setStyleSheet("QPushButton { text-align:left; padding:5px}"); zoomOutPB->setGeometry(4, 64, 112, 28); zoomOutPB->setCheckable(true); // The Pointer/Zoom In/Zoom Out buttons form a button group QButtonGroup *mouseUsage = new QButtonGroup(frame); mouseUsage->addButton(pointerPB, Chart::MouseUsageScroll); mouseUsage->addButton(zoomInPB, Chart::MouseUsageZoomIn); mouseUsage->addButton(zoomOutPB, Chart::MouseUsageZoomOut); connect(mouseUsage, SIGNAL(buttonPressed(int)), SLOT(onMouseUsageChanged(int))); // Start Date control (new QLabel("Start Date", frame))->setGeometry(6, 230, 112, 18); m_StartDate = new QDateEdit(frame); m_StartDate->setGeometry(4, 248, 113, 22); connect(m_StartDate, SIGNAL(dateTimeChanged(QDateTime)), SLOT(onStartDateChanged(QDateTime))); // Duration control (new QLabel("End Date", frame))->setGeometry(6, 284, 112, 18); m_EndDate = new QDateEdit(frame); m_EndDate->setGeometry(4, 302, 113, 22); connect(m_EndDate, SIGNAL(dateTimeChanged(QDateTime)), SLOT(onEndDateChanged(QDateTime))); // Chart Viewer m_ChartViewer = new QChartViewer(this); m_ChartViewer->setGeometry(128, 4, 650, 350); connect(m_ChartViewer, SIGNAL(viewPortChanged()), SLOT(onViewPortChanged())); connect(m_ChartViewer, SIGNAL(mouseMovePlotArea(QMouseEvent*)), SLOT(onMouseMovePlotArea(QMouseEvent*))); connect(m_ChartViewer, SIGNAL(mouseWheel(QWheelEvent*)), SLOT(onMouseWheelChart(QWheelEvent*))); // Horizontal scroll bar m_HScrollBar = new QScrollBar(Qt::Horizontal, this); m_HScrollBar->setGeometry(128, 356, 650, 17); connect(m_HScrollBar, SIGNAL(valueChanged(int)), SLOT(onHScrollBarChanged(int))); // // Initialize the chart // // Load the data loadData(); // Initialize the QChartViewer initChartViewer(m_ChartViewer); // Initially set the mouse to drag to scroll mode pointerPB->click(); // Trigger the ViewPortChanged event to draw the chart m_ChartViewer->updateViewPort(true, true); }
CDDialogData::CDDialogData ( QWidget* parent, const char* name ) : Inherited( parent, name ) { titleedit = new QLineEdit( this, "titleedit" ); titleedit->setGeometry( 20, 35, 320, 28 ); titleedit->setText( "" ); titleedit->setMaxLength( 70 ); titleedit->setEchoMode( QLineEdit::Normal ); titleedit->setFrame( TRUE ); listbox = new QListBox( this, "listbox" ); listbox->setGeometry( 20, 110, 320, 170 ); connect( listbox, SIGNAL(highlighted(int)), SLOT(titleselected(int)) ); listbox->setFrameStyle( 51 ); listbox->setLineWidth( 2 ); QFrame* tmpQFrame; tmpQFrame = new QFrame( this, "Frame_1" ); tmpQFrame->setGeometry( 15, 65, 430, 15 ); tmpQFrame->setFrameStyle( 52 ); trackedit = new QLineEdit( this, "trackedit" ); trackedit->setGeometry( 20, 315, 320, 30 ); trackedit->setText( "" ); trackedit->setMaxLength( 70 ); trackedit->setEchoMode( QLineEdit::Normal ); trackedit->setFrame( TRUE ); progseq_edit = new QLineEdit( this, "programsequence_edit" ); progseq_edit->setGeometry( 20, 375, 320, 30 ); progseq_edit->setText( "" ); progseq_edit->setMaxLength( 70 ); progseq_edit->setEchoMode( QLineEdit::Normal ); progseq_edit->setFrame( TRUE ); tmpQFrame = new QFrame( this, "hline2" ); tmpQFrame->setGeometry( 15, 410, 430, 10 ); tmpQFrame->setFrameStyle( 52 ); save_button = new QPushButton( this, "save_button" ); save_button->setGeometry( 15, 425, 85, 25 ); save_button->setText( klocale->translate("Save") ); save_button->setAutoRepeat( FALSE ); save_button->setAutoResize( FALSE ); load_button = new QPushButton( this, "PushButton_3" ); load_button->setGeometry( 185, 425, 85, 25 ); load_button->setText( klocale->translate("Load") ); load_button->setAutoRepeat( FALSE ); load_button->setAutoResize( FALSE ); ok_button = new QPushButton( this, "PushButton_4" ); ok_button->setGeometry( 355, 425, 85, 25 ); ok_button->setText( klocale->translate("Close") ); ok_button->setAutoRepeat( FALSE ); ok_button->setAutoResize( FALSE ); QLabel* tmpQLabel; tmpQLabel = new QLabel( this, "Label_2" ); tmpQLabel->setGeometry( 105, 355, 185, 20 ); tmpQLabel->setText( klocale->translate("Play List Editor") ); tmpQLabel->setAlignment( 292 ); tmpQLabel->setMargin( -1 ); tmpQLabel = new QLabel( this, "Label_3" ); tmpQLabel->setGeometry( 100, 295, 185, 20 ); tmpQLabel->setText( klocale->translate("Edit Track Title") ); tmpQLabel->setAlignment( 292 ); tmpQLabel->setMargin( -1 ); tmpQLabel = new QLabel( this, "Label_4" ); tmpQLabel->setGeometry( 100, 15, 185, 20 ); tmpQLabel->setText( klocale->translate("Disc Artist / Title") ); tmpQLabel->setAlignment( 292 ); tmpQLabel->setMargin( -1 ); tmpQLabel = new QLabel( this, "Label_5" ); tmpQLabel->setGeometry( 100, 90, 185, 20 ); tmpQLabel->setText( klocale->translate("Track / Time / Title") ); tmpQLabel->setAlignment( 292 ); tmpQLabel->setMargin( -1 ); ext_info_title_button = new QPushButton( this, "PushButton_5" ); ext_info_title_button->setGeometry( 360, 35, 85, 25 ); ext_info_title_button->setText( klocale->translate("Ext Info") ); ext_info_title_button->setAutoRepeat( FALSE ); ext_info_title_button->setAutoResize( FALSE ); ext_info_button = new QPushButton( this, "extinfo_button" ); ext_info_button->setGeometry( 360, 110, 85, 25 ); ext_info_button->setText( klocale->translate("Ext Info") ); ext_info_button->setAutoRepeat( FALSE ); ext_info_button->setAutoResize( FALSE ); tmpQFrame = new QFrame( this, "Frame_3" ); tmpQFrame->setGeometry( 360, 180, 85, 55 ); tmpQFrame->setFrameStyle( 49 ); disc_id_label = new QLabel( this, "diskid_label" ); disc_id_label->setGeometry( 365, 185, 75, 45 ); disc_id_label->setText( "" ); disc_id_label->setAlignment( 292 ); disc_id_label->setMargin( -1 ); tmpQLabel = new QLabel( this, "Label_7" ); tmpQLabel->setGeometry( 355, 155, 90, 20 ); tmpQLabel->setText( klocale->translate("Disc ID") ); tmpQLabel->setAlignment( 292 ); tmpQLabel->setMargin( -1 ); total_time_label = new QLabel( this, "totaltimelabel" ); total_time_label->setGeometry( 360, 315, 85, 40 ); total_time_label->setText( "" ); total_time_label->setAlignment( 292 ); total_time_label->setMargin( -1 ); upload_button = new QPushButton( this, "PushButton_8" ); upload_button->setGeometry( 360, 255, 85, 25 ); upload_button->setText( klocale->translate("Upload") ); upload_button->setAutoRepeat( FALSE ); upload_button->setAutoResize( FALSE ); resize( 465, 460 ); }
void pTreeComboBox::calculPopupGeometry() { if ( !mView ) { return; } QStyle * const style = this->style(); // set current item and select it view()->selectionModel()->setCurrentIndex( mCurrentIndex, QItemSelectionModel::ClearAndSelect | QItemSelectionModel::Rows ); QFrame* container = mFrame; QStyleOptionComboBox opt; initStyleOption( &opt ); QRect listRect( style->subControlRect( QStyle::CC_ComboBox, &opt, QStyle::SC_ComboBoxListBoxPopup, this ) ); QRect screen = popupGeometry( QApplication::desktop()->screenNumber( this ) ); QPoint below = mapToGlobal( listRect.bottomLeft() ); int belowHeight = screen.bottom() -below.y(); QPoint above = mapToGlobal( listRect.topLeft() ); int aboveHeight = above.y() -screen.y(); bool boundToScreen = !window()->testAttribute( Qt::WA_DontShowOnScreen ); listRect.moveTopLeft( mapToGlobal( rect().bottomLeft() ) ); listRect.setSize( QSize( qMax( qMax( view()->viewport()->width(), mFrame->width() ), width() ) , qMax( view()->viewport()->height(), mFrame->height() ) ) ); const bool usePopup = style->styleHint( QStyle::SH_ComboBox_Popup, &opt, this ); { int listHeight = 0; int count = 0; QStack<QModelIndex> toCheck; toCheck.push( view()->rootIndex() ); #ifndef QT_NO_TREEVIEW QTreeView* treeView = qobject_cast<QTreeView*>( view() ); if ( treeView && treeView->header() && !treeView->header()->isHidden() ) listHeight += treeView->header()->height(); #endif while ( !toCheck.isEmpty() ) { QModelIndex parent = toCheck.pop(); for ( int i = 0; i < model()->rowCount( parent ); ++i ) { QModelIndex idx = model()->index( i, mModelColumn, parent ); if ( !idx.isValid() ) continue; listHeight += view()->visualRect( idx ).height(); #ifndef QT_NO_TREEVIEW if ( model()->hasChildren( idx ) && treeView && treeView->isExpanded( idx ) ) toCheck.push( idx ); #endif ++count; if ( !usePopup && count > mMaxVisibleItems ) { toCheck.clear(); break; } } } listRect.setHeight( listHeight ); } { // add the spacing for the grid on the top and the bottom; int heightMargin = 0; // add the frame of the container int marginTop, marginBottom; container->getContentsMargins( 0, &marginTop, 0, &marginBottom ); heightMargin += marginTop +marginBottom; //add the frame of the view view()->getContentsMargins( 0, &marginTop, 0, &marginBottom ); marginTop += 0/*static_cast<QAbstractScrollAreaPrivate *>(QObjectPrivate::get(view()))->top*/; marginBottom += 0/*static_cast<QAbstractScrollAreaPrivate *>(QObjectPrivate::get(view()))->bottom*/; heightMargin += marginTop +marginBottom; listRect.setHeight( listRect.height() +heightMargin ); } // Add space for margin at top and bottom if the style wants it. if ( usePopup ) listRect.setHeight( listRect.height() +style->pixelMetric( QStyle::PM_MenuVMargin, &opt, this ) *2 ); // Make sure the popup is wide enough to display its contents. if ( usePopup ) { const int diff = sizeHint().width() /*d->computeWidthHint()*/ -width(); if ( diff > 0 ) listRect.setWidth( listRect.width() +diff ); } //we need to activate the layout to make sure the min/maximum size are set when the widget was not yet show container->layout()->activate(); //takes account of the minimum/maximum size of the container listRect.setSize( listRect.size().expandedTo(container->minimumSize()) .boundedTo(container->maximumSize())); // make sure the widget fits on screen if (boundToScreen) { if (listRect.width() > screen.width() ) listRect.setWidth(screen.width()); if (/*mapToGlobal(*/listRect/*.bottomRight())*/.x() > screen.right()) { below.setX(screen.x() + screen.width() - listRect.width()); above.setX(screen.x() + screen.width() - listRect.width()); } if (/*mapToGlobal(*/listRect/*.topLeft())*/.x() < screen.x() ) { below.setX(screen.x()); above.setX(screen.x()); } } if ( usePopup ) { // Position horizontally. listRect.moveLeft( above.x() ); // Position vertically so the curently selected item lines up // with the combo box. /*const QRect currentItemRect = view()->visualRect( view()->currentIndex() ); const int offset = listRect.top() -currentItemRect.top(); listRect.moveTop( above.y() +offset -listRect.top() );*/ // Clamp the listRect height and vertical position so we don't expand outside the // available screen geometry.This may override the vertical position, but it is more // important to show as much as possible of the popup. const int height = !boundToScreen ? listRect.height() : qMin(listRect.height(), screen.height()); listRect.setHeight(height); if (boundToScreen) { if (listRect.top() < screen.top()) listRect.moveTop(screen.top()); if (listRect.bottom() > screen.bottom()) listRect.moveBottom(screen.bottom()); } } else if (!boundToScreen || listRect.height() <= belowHeight) { listRect.moveTopLeft(below); } else if (listRect.height() <= aboveHeight) { listRect.moveBottomLeft(above); } else if (belowHeight >= aboveHeight) { listRect.setHeight(belowHeight); listRect.moveTopLeft(below); } else { listRect.setHeight(aboveHeight); listRect.moveBottomLeft(above); } #if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) #ifndef QT_NO_IM if ( QInputContext *qic = inputContext() ) qic->reset(); #endif #endif QScrollBar* sb = view()->horizontalScrollBar(); Qt::ScrollBarPolicy policy = view()->horizontalScrollBarPolicy(); bool needHorizontalScrollBar = ( policy == Qt::ScrollBarAsNeeded || policy == Qt::ScrollBarAlwaysOn ) && sb->minimum() < sb->maximum(); if ( needHorizontalScrollBar ) { listRect.adjust( 0, 0, 0, sb->height() ); } container->setGeometry( listRect ); #ifndef Q_WS_MAC const bool updatesEnabled = container->updatesEnabled(); #endif #if defined( Q_WS_WIN ) && !defined( QT_NO_EFFECTS ) // FIXME Fix me ASAP /*bool scrollDown = ( listRect.topLeft() == below ); if ( QApplication::isEffectEnabled( Qt::UI_AnimateCombo ) && !style->styleHint( QStyle::SH_ComboBox_Popup, &opt, this ) && !window()->testAttribute( Qt::WA_DontShowOnScreen ) ) qScrollEffect( container, scrollDown ? QEffects::DownScroll : QEffects::UpScroll, 150 );*/ #endif // Don't disable updates on Mac OS X. Windows are displayed immediately on this platform, // which means that the window will be visible before the call to container->show() returns. // If updates are disabled at this point we'll miss our chance at painting the popup // menu before it's shown, causing flicker since the window then displays the standard gray // background. #ifndef Q_WS_MAC container->setUpdatesEnabled( false ); #endif container->raise(); container->show(); //container->updateScrollers(); view()->setFocus(); view()->scrollTo( view()->currentIndex(), style->styleHint( QStyle::SH_ComboBox_Popup, &opt, this ) ? QAbstractItemView::PositionAtCenter : QAbstractItemView::EnsureVisible ); #ifndef Q_WS_MAC container->setUpdatesEnabled( updatesEnabled ); #endif container->update(); #ifdef QT_KEYPAD_NAVIGATION if ( QApplication::keypadNavigationEnabled() ) view()->setEditFocus( true ); #endif }
SaveStreamDialog::SaveStreamDialog(StreamTableModel *model, const QHash<QString, QVariant> &settings, const QString &streamTitle, QWidget *parent): QDialog(parent) { this->settings = settings; QVBoxLayout *mainLayout = new QVBoxLayout(this); QHBoxLayout *buttonLayout = new QHBoxLayout(); QFormLayout *formLayout = new QFormLayout(); QDataWidgetMapper *dataMapper = new QDataWidgetMapper(this); editFileName = new FilePathEdit(this); QLabel *suffixHint = new QLabel(this); checkSubtitles = new QCheckBox("Ladda ner undertexter till:", this); checkSubtitles->hide(); editSubFileName = new FilePathEdit(this); editSubFileName->setEnabled(false); editSubFileName->hide(); comboQuality = new QComboBox(this); editStreamUrl = new QLineEdit(this); editStreamUrl->hide(); editSubUrl = new QLineEdit(this); editSubUrl->hide(); editSubUrl->setEnabled(false); QFrame *line = new QFrame(this); line->setFrameShape(QFrame::HLine); line->setGeometry(QRect(320, 150, 118, 3)); line->setFrameShadow(QFrame::Sunken); QCheckBox *checkEdit = new QCheckBox(QString::fromUtf8("Redigera addresser"), this); QPushButton *buttonPlay = new QPushButton("Spela upp", this); buttonSubmit = new QPushButton("Ladda ner", this); buttonSubmit->setDefault(true); QPushButton *buttonCancel = new QPushButton("Avbryt", this); connect(checkEdit, SIGNAL(clicked(bool)), editStreamUrl, SLOT(setVisible(bool))); connect(checkEdit, SIGNAL(clicked(bool)), editSubUrl, SLOT(setVisible(bool))); connect(buttonSubmit, SIGNAL(clicked()), this, SLOT(checkOverWrite())); connect(buttonCancel, SIGNAL(clicked()), this, SLOT(reject())); connect(comboQuality, SIGNAL(currentIndexChanged(int)), dataMapper, SLOT(setCurrentIndex(int))); connect(comboQuality, SIGNAL(currentIndexChanged(int)), this, SLOT(comboActivated(int))); connect(checkSubtitles, SIGNAL(clicked(bool)), editSubFileName, SLOT(setEnabled(bool))); connect(checkSubtitles, SIGNAL(clicked(bool)), editSubUrl, SLOT(setEnabled(bool))); connect(checkSubtitles, SIGNAL(clicked(bool)), this, SLOT(enableSubmit())); connect(editFileName, SIGNAL(pathValid(bool)), this, SLOT(enableSubmit())); connect(editFileName, SIGNAL(dirChanged(QString)), editSubFileName, SLOT(setDir(QString))); connect(editSubFileName, SIGNAL(pathValid(bool)), this, SLOT(enableSubmit())); connect(buttonPlay, SIGNAL(clicked()), this, SLOT(play())); QString filenameTemplate = settings.value("filename_template").toString(); const QStringList templateVars = QStringList() << "title" << "name" << "time" << "season" << "description"; for (int i=0; i<templateVars.count(); i++) filenameTemplate.replace("%" % templateVars.at(i) % "%", "%" % QString::number(i)); QString fileName = filenameTemplate; QVariantMap metaData = model->metaData(); for (int i=0; i<templateVars.count(); i++) fileName = fileName.arg(metaData.value(templateVars.at(i), "").toString()); QString nullFileName = filenameTemplate; for (int i=0; i<templateVars.count(); i++) nullFileName = nullFileName.arg(""); if (fileName != nullFileName) { QString suffix = model->data(model->index(0, StreamTableModel::SuffixHintColumn), Qt::UserRole).toString(); suffix = !suffix.isEmpty() ? '.' % suffix : suffix; bool addSlash = !settings["start_dir"].toString().endsWith(QDir::separator()); editFileName->setFilePath(settings["start_dir"].toString() % (addSlash ? (QString)QDir::separator() : "") % fileName % suffix); editSubFileName->setFilePath(settings["start_dir"].toString() % (addSlash ? (QString)QDir::separator() : "") % fileName); } else { editFileName->setFilePath(settings["start_dir"].toString()); editSubFileName->setFilePath(settings["start_dir"].toString()); } dataMapper->setModel(model); dataMapper->setCurrentIndex(comboQuality->currentIndex()); dataMapper->addMapping(editStreamUrl, StreamTableModel::UrlColumn); dataMapper->addMapping(editSubUrl, StreamTableModel::SubtitlesColumn); dataMapper->addMapping(suffixHint, StreamTableModel::SuffixHintColumn, "text"); comboQuality->setModel(model); formLayout->addRow("Ladda ner till:", editFileName); formLayout->addRow("", suffixHint); formLayout->addRow("Kvalitet:", comboQuality); formLayout->addRow("", editStreamUrl); formLayout->addRow(checkSubtitles, editSubFileName); formLayout->addRow("", editSubUrl); buttonLayout->addWidget(checkEdit); buttonLayout->addStretch(1); buttonLayout->addWidget(buttonPlay); buttonLayout->addWidget(buttonSubmit); buttonLayout->addWidget(buttonCancel); mainLayout->addLayout(formLayout); mainLayout->addWidget(line); mainLayout->addLayout(buttonLayout); setLayout(mainLayout); setWindowTitle(QString::fromUtf8("Spara ström - ") + streamTitle); setMinimumWidth(500); }
void CameraSettingsWidget::init (Tribots::IIDC* cam1, bool memChan, bool head) { lockedCamera=true; lockedDisplay=false; camera = cam1; if (!camera) return; features = new TribotsTools::CameraSettingsWidget::FeatureInfo [11]; // z.Z. werden maximal 11 verwendet // das Widget aufbauen unsigned int y0=0; // die aktuelle y0-Position des naechsten Frames const unsigned int pwidth= 350; // die Breite der Frames QFrame* frame = new QFrame; frame->setFrameShape (QFrame::NoFrame); frame->setFrameShadow (QFrame::Plain); // das Feld mit Kamerabezeichnung und Modus QFrame* iframe = new QFrame (frame); iframe->setFrameShape (QFrame::NoFrame); iframe->setFrameShadow (QFrame::Plain); if (head) { iframe->setGeometry (0, y0, pwidth, 60); y0+=60; QLineEdit* edit = new QLineEdit (iframe); edit->setGeometry (5,5,200,20); edit->setReadOnly (true); edit->setText (camera->getCameraType().c_str()); edit = new QLineEdit (iframe); edit->setGeometry (215,5,130,20); edit->setReadOnly (true); edit->setText (camera->getCameraUID().c_str()); edit = new QLineEdit (iframe); edit->setGeometry (5,35,340,20); edit->setReadOnly (true); edit->setText (camera->getCameraMode().c_str()); } // die Featurefelder IIDC::CameraFeature feats [] = { IIDC::whiteBalance, IIDC::shutter, IIDC::gain, IIDC::brightness, IIDC::exposure, IIDC::gamma, IIDC::sharpness, IIDC::hue, IIDC::saturation, IIDC::filter }; QString featstring [] = { "WhiteBalance", "Shutter", "Gain", "Brightness", "Exposure", "Gamma", "Sharpness", "Hue", "Saturation", "Filter" }; num_features=0; for (unsigned int fn = 0; fn<10; fn++) { unsigned int fn_available = camera->availableFeatureModes (feats[fn]); if (fn_available & IIDC::featureUnavailable) { continue; } iframe = new QFrame (frame); iframe->setFrameShape (QFrame::NoFrame); iframe->setFrameShadow (QFrame::Plain); QLabel* label = new QLabel (iframe); label->setText (featstring[fn]); label->setGeometry (5, 5, 80, 20); IDComboBox* comboBox = new IDComboBox (iframe, num_features); comboBox->setGeometry (90,5,60,20); if (fn_available & IIDC::featureOff) comboBox->addItem ("Off"); if (fn_available & IIDC::featureMan) comboBox->addItem ("Man"); if (fn_available & IIDC::featureAuto) comboBox->addItem ("Auto"); IDSlider* slider = new IDSlider (iframe, num_features); slider->setGeometry (160, 5, 120, 20); unsigned int minv, maxv; camera->getFeatureMinMaxValue (minv, maxv, feats[fn]); slider->setMinimum (minv); slider->setMaximum (maxv); IDSpinBox* spinBox = new IDSpinBox (iframe, num_features); spinBox->setGeometry (290, 5, 57, 22); spinBox->setMinimum (minv); spinBox->setMaximum (maxv); if (feats[fn]==IIDC::whiteBalance) { iframe->setGeometry (0, y0, pwidth, 60); y0+=60; IDSlider* slider2 = new IDSlider (iframe, num_features+1); slider2->setGeometry (160, 35, 120, 20); slider2->setMinimum (minv); slider2->setMaximum (maxv); IDSpinBox* spinBox2 = new IDSpinBox (iframe, num_features+1); spinBox2->setGeometry (290, 35, 57, 22); spinBox2->setMinimum (minv); spinBox2->setMaximum (maxv); features[num_features].feature = feats[fn]; features[num_features].spinBox = spinBox; features[num_features].slider = slider; features[num_features].comboBox = comboBox; features[num_features].uv = true; features[num_features+1].feature = feats[fn]; features[num_features+1].spinBox = spinBox2; features[num_features+1].slider = slider2; features[num_features+1].comboBox = comboBox; features[num_features+1].uv = false; num_features+=2; connect (comboBox,SIGNAL(comboBoxChanged (unsigned int, const QString&)), this, SLOT(comboBoxChanged (unsigned int, const QString&))); connect (spinBox,SIGNAL(spinBoxChanged (unsigned int, unsigned int)), this, SLOT(spinBoxChanged (unsigned int, unsigned int))); connect (slider,SIGNAL(sliderChanged (unsigned int, unsigned int)), this, SLOT(sliderChanged (unsigned int, unsigned int))); connect (spinBox2,SIGNAL(spinBoxChanged (unsigned int, unsigned int)), this, SLOT(spinBoxChanged (unsigned int, unsigned int))); connect (slider2,SIGNAL(sliderChanged (unsigned int, unsigned int)), this, SLOT(sliderChanged (unsigned int, unsigned int))); updateFeatureMode (num_features-2); updateFeatureValue (num_features-2); updateFeatureValue (num_features-1); } else {
CSystemDSN::CSystemDSN( QWidget* parent, const char* name ) : QWidget( parent, name ) { QVBoxLayout *playoutTop = new QVBoxLayout( this, 5 ); QHBoxLayout *playoutMain = new QHBoxLayout( playoutTop ); pDSNList = new CDSNList( this, "pDSNList" ); pDSNList->setGeometry( 10, 10, 270, 190 ); pDSNList->setMinimumSize( 50, 50 ); pDSNList->setMaximumSize( 32767, 32767 ); playoutMain->addWidget( pDSNList, 10 ); QVBoxLayout *playoutButtons = new QVBoxLayout( playoutMain, 5 ); pbAdd = new QPushButton( this, "pbAdd" ); pbAdd->setGeometry( 290, 10, 100, 30 ); pbAdd->setMinimumSize( 0, 0 ); pbAdd->setMaximumSize( 32767, 32767 ); #ifdef QT_V4LAYOUT pbAdd->setFocusPolicy( Qt::TabFocus ); pbAdd->setBackgroundMode( Qt::PaletteBackground ); #else pbAdd->setFocusPolicy( QWidget::TabFocus ); pbAdd->setBackgroundMode( QWidget::PaletteBackground ); #endif pbAdd->setText( "A&dd..." ); pbAdd->setAutoRepeat( FALSE ); #ifndef QT_V4LAYOUT pbAdd->setAutoResize( FALSE ); #endif playoutButtons->addWidget( pbAdd ); pbRemove = new QPushButton( this, "pbRemove" ); pbRemove->setGeometry( 290, 50, 100, 30 ); pbRemove->setMinimumSize( 0, 0 ); pbRemove->setMaximumSize( 32767, 32767 ); #ifdef QT_V4LAYOUT pbRemove->setFocusPolicy( Qt::TabFocus ); pbRemove->setBackgroundMode( Qt::PaletteBackground ); #else pbRemove->setFocusPolicy( QWidget::TabFocus ); pbRemove->setBackgroundMode( QWidget::PaletteBackground ); #endif pbRemove->setText( "&Remove" ); pbRemove->setAutoRepeat( FALSE ); #ifndef QT_V4LAYOUT pbRemove->setAutoResize( FALSE ); #endif playoutButtons->addWidget( pbRemove ); pbConfigure = new QPushButton( this, "pbConfigure" ); pbConfigure->setGeometry( 290, 90, 100, 30 ); pbConfigure->setMinimumSize( 0, 0 ); pbConfigure->setMaximumSize( 32767, 32767 ); #ifdef QT_V4LAYOUT pbConfigure->setFocusPolicy( Qt::TabFocus ); pbConfigure->setBackgroundMode( Qt::PaletteBackground ); #else pbConfigure->setFocusPolicy( QWidget::TabFocus ); pbConfigure->setBackgroundMode( QWidget::PaletteBackground ); #endif pbConfigure->setText( "&Configure..." ); pbConfigure->setAutoRepeat( FALSE ); #ifndef QT_V4LAYOUT pbConfigure->setAutoResize( FALSE ); #endif playoutButtons->addWidget( pbConfigure ); playoutButtons->addStretch( 10 ); QFrame *pframe; pframe = new QFrame( this, "Frame_2" ); pframe->setGeometry( 10, 210, 380, 80 ); pframe->setMinimumSize( 0, 0 ); pframe->setMaximumSize( 32767, 32767 ); pframe->setFrameStyle( QFrame::Box | QFrame::Raised ); playoutTop->addWidget( pframe ); QGridLayout *playoutHelp = new QGridLayout( pframe, 1, 2, 5 ); QLabel* plabel1; plabel1 = new QLabel( pframe, "Label_1" ); plabel1->setMinimumSize( 32, 32 ); // plabel1->setMaximumSize( 32, 32 ); plabel1->setPixmap( xpmDSN_System ); QLabel* plabel2; plabel2 = new QLabel( pframe, "Label_2" ); plabel2->setMinimumSize( 0, 0 ); plabel2->setMaximumSize( 32767, 32767 ); plabel2->setText( "System data sources are shared among all users of this machine. These data sources may also be used by system services. Only the administrator can configure system data sources." ); #ifdef QT_V4LAYOUT plabel2->setAlignment( Qt::AlignLeft | Qt::WordBreak ); plabel2->setWordWrap( true ); #else plabel2->setAlignment( AlignLeft | WordBreak ); #endif playoutHelp->addWidget( plabel1, 0, 0 ); playoutHelp->addWidget( plabel2, 0, 1 ); playoutHelp->setColStretch( 1, 10 ); pDSNList->Load( ODBC_SYSTEM_DSN ); connect( pbAdd, SIGNAL(clicked()), pDSNList, SLOT(Add()) ); connect( pbRemove, SIGNAL(clicked()), pDSNList, SLOT(Delete()) ); connect( pbConfigure, SIGNAL(clicked()), pDSNList, SLOT(Edit()) ); #ifdef QT_V4LAYOUT connect( pDSNList, SIGNAL(doubleClicked( Q3ListViewItem * )), pDSNList, SLOT(DoubleClick( Q3ListViewItem * ))); #else connect( pDSNList, SIGNAL(doubleClicked( QListViewItem * )), pDSNList, SLOT(DoubleClick( QListViewItem * ))); #endif }
KDMShutdown::KDMShutdown( int mode, QWidget* _parent, const char* _name, const char* _shutdown, const char* _restart) : FDialog( _parent, _name, true) { shutdown = _shutdown; restart = _restart; int h = 10, w = 0; QFrame* winFrame = new QFrame( this); winFrame->setFrameStyle( QFrame::WinPanel | QFrame::Raised); QBoxLayout* box = new QBoxLayout( winFrame, QBoxLayout::TopToBottom, 10, 10); QString shutdownmsg = klocale->translate( "Shutdown or restart?"); if( mode == KDMConfig::RootOnly) { shutdownmsg += '\n'; shutdownmsg += klocale->translate( "(Enter Root Password)"); } label = new QLabel( shutdownmsg, winFrame); set_fixed( label); h += label->height() + 10; w = label->width(); box->addWidget( label, 0, AlignCenter); QFrame* sepFrame = new QFrame( this); sepFrame->setFrameStyle( QFrame::HLine| QFrame::Sunken); h += sepFrame->height(); box->addWidget( sepFrame); btGroup = new QButtonGroup( /* this */); QRadioButton *rb; rb = new QRadioButton( winFrame /*btGroup*/); rb->setText( klocale->translate("Shutdown")); set_min( rb); rb->setFocusPolicy( StrongFocus); // Default action rb->setChecked( true); rb->setFocus(); cur_action = shutdown; h += rb->height() + 10; w = QMAX( rb->width(), w); box->addWidget( rb); btGroup->insert( rb); rb = new QRadioButton( winFrame /*btGroup*/); rb->setText( klocale->translate("Shutdown and restart")); set_min( rb); rb->setFocusPolicy( StrongFocus); h += rb->height() + 10; w = QMAX( rb->width(), w); box->addWidget( rb); btGroup->insert( rb); rb = new QRadioButton( winFrame /*btGroup*/); rb->setText( klocale->translate("Restart X Server"));//better description set_min( rb); rb->setFocusPolicy( StrongFocus); h += rb->height() + 10; w = QMAX( rb->width(), w); box->addWidget( rb); btGroup->insert( rb); // Passwd line edit if( mode == KDMConfig::RootOnly) { pswdEdit = new QLineEdit( winFrame); //set_min( pswdEdit); pswdEdit->setMinimumHeight( pswdEdit->sizeHint().height()); pswdEdit->setEchoMode( QLineEdit::NoEcho); /*QColorGroup passwdColGroup( QApplication::palette()->normal().foreground(), QApplication::palette()->normal().background(), QApplication::palette()->normal().light(), QApplication::palette()->normal().dark(), QApplication::palette()->normal().mid(), QApplication::palette()->normal().base(), QApplication::palette()->normal().base()); QPalette passwdPalette( passwdColGroup, passwdColGroup, passwdColGroup); pswdEdit->setPalette( passwdPalette); */ pswdEdit->setFocusPolicy( StrongFocus); pswdEdit->setFocus(); h+= pswdEdit->height() + 10; box->addWidget( pswdEdit); } QBoxLayout* box3 = new QBoxLayout( QBoxLayout::LeftToRight, 10); box->addLayout( box3); okButton = new QPushButton( klocale->translate("OK"), winFrame); set_min( okButton); okButton->setFocusPolicy( StrongFocus); cancelButton = new QPushButton( klocale->translate("Cancel"), winFrame); set_min( cancelButton); //cancelButton->setDefault( true); cancelButton->setFocusPolicy( StrongFocus); h += cancelButton->height() + 10; w = QMAX( (okButton->width() + 10 + cancelButton->width()), w); box3->addWidget( okButton); box3->addWidget( cancelButton); // Connections connect( okButton, SIGNAL(clicked()), SLOT(bye_bye())); connect( cancelButton, SIGNAL(clicked()), SLOT(reject())); connect( btGroup, SIGNAL(clicked(int)), SLOT(rb_clicked(int))); if( mode == KDMConfig::RootOnly) { okButton->setEnabled( false); connect( pswdEdit, SIGNAL( returnPressed()), this, SLOT( pw_entered())); } else cancelButton->setFocus(); resize( 20 + w, h); winFrame->setGeometry( 0, 0, width(), height()); }