AddIntervalDialog::AddIntervalDialog(MainWindow *mainWindow) : mainWindow(mainWindow) { setAttribute(Qt::WA_DeleteOnClose); setWindowTitle("Add Intervals"); QVBoxLayout *mainLayout = new QVBoxLayout(this); intervalMethodWidget = new QWidget(); QHBoxLayout *intervalMethodLayout = new QHBoxLayout; QLabel *intervalMethodLabel = new QLabel(tr("Method: "), this); intervalMethodLayout->addWidget(intervalMethodLabel); QButtonGroup *methodButtonGroup = new QButtonGroup(this); methodFirst = new QRadioButton(tr("First")); methodFirst->setChecked(true); methodButtonGroup->addButton(methodFirst); intervalMethodLayout->addWidget(methodFirst); methodBestPower = new QRadioButton(tr("Peak Power")); methodButtonGroup->addButton(methodBestPower); intervalMethodLayout->addWidget(methodBestPower); //mainLayout->addLayout(intervalMethodLayout); intervalMethodWidget->setLayout(intervalMethodLayout); mainLayout->addWidget(intervalMethodWidget); intervalPeakPowerWidget = new QWidget(); intervalPeakPowerTypeLayout = new QHBoxLayout; QLabel *intervalPeakPowerTypeLabel = new QLabel(tr("Type: "), this); intervalPeakPowerTypeLayout->addWidget(intervalPeakPowerTypeLabel); QButtonGroup *peakPowerTypeButtonGroup = new QButtonGroup(this); peakPowerStandard = new QRadioButton(tr("Standard")); peakPowerStandard->setChecked(true); peakPowerTypeButtonGroup->addButton(peakPowerStandard); intervalPeakPowerTypeLayout->addWidget(peakPowerStandard); peakPowerCustom = new QRadioButton(tr("Custom")); peakPowerTypeButtonGroup->addButton(peakPowerCustom); intervalPeakPowerTypeLayout->addWidget(peakPowerCustom); //mainLayout->addLayout(intervalPeakPowerTypeLayout); intervalPeakPowerWidget->setLayout(intervalPeakPowerTypeLayout); intervalPeakPowerWidget->hide(); mainLayout->addWidget(intervalPeakPowerWidget); intervalTypeWidget = new QWidget(); QHBoxLayout *intervalTypeLayout = new QHBoxLayout; QLabel *intervalTypeLabel = new QLabel(tr("Interval length: "), this); intervalTypeLayout->addWidget(intervalTypeLabel); QButtonGroup *typeButtonGroup = new QButtonGroup(this); typeTime = new QRadioButton(tr("By time")); typeTime->setChecked(true); typeButtonGroup->addButton(typeTime); intervalTypeLayout->addWidget(typeTime); typeDistance = new QRadioButton(tr("By distance")); typeButtonGroup->addButton(typeDistance); intervalTypeLayout->addWidget(typeDistance); //mainLayout->addLayout(intervalTypeLayout); intervalTypeWidget->setLayout(intervalTypeLayout); mainLayout->addWidget(intervalTypeWidget); intervalTimeWidget = new QWidget(); QHBoxLayout *intervalTimeLayout = new QHBoxLayout; QLabel *intervalTimeLabel = new QLabel(tr("Time: "), this); intervalTimeLayout->addWidget(intervalTimeLabel); hrsSpinBox = new QDoubleSpinBox(this); hrsSpinBox->setDecimals(0); hrsSpinBox->setMinimum(0.0); hrsSpinBox->setSuffix(" hrs"); hrsSpinBox->setSingleStep(1.0); hrsSpinBox->setAlignment(Qt::AlignRight); intervalTimeLayout->addWidget(hrsSpinBox); minsSpinBox = new QDoubleSpinBox(this); minsSpinBox->setDecimals(0); minsSpinBox->setRange(0.0, 59.0); minsSpinBox->setSuffix(" mins"); minsSpinBox->setSingleStep(1.0); minsSpinBox->setWrapping(true); minsSpinBox->setAlignment(Qt::AlignRight); minsSpinBox->setValue(1.0); intervalTimeLayout->addWidget(minsSpinBox); secsSpinBox = new QDoubleSpinBox(this); secsSpinBox->setDecimals(0); secsSpinBox->setRange(0.0, 59.0); secsSpinBox->setSuffix(" secs"); secsSpinBox->setSingleStep(1.0); secsSpinBox->setWrapping(true); secsSpinBox->setAlignment(Qt::AlignRight); intervalTimeLayout->addWidget(secsSpinBox); //mainLayout->addLayout(intervalLengthLayout); intervalTimeWidget->setLayout(intervalTimeLayout); mainLayout->addWidget(intervalTimeWidget); intervalDistanceWidget = new QWidget(); QHBoxLayout *intervalDistanceLayout = new QHBoxLayout; QLabel *intervalDistanceLabel = new QLabel(tr("Distance: "), this); intervalDistanceLayout->addWidget(intervalDistanceLabel); kmsSpinBox = new QDoubleSpinBox(this); kmsSpinBox->setDecimals(0); kmsSpinBox->setRange(0.0, 999); kmsSpinBox->setValue(5.0); kmsSpinBox->setSuffix(" km"); kmsSpinBox->setSingleStep(1.0); kmsSpinBox->setAlignment(Qt::AlignRight); intervalDistanceLayout->addWidget(kmsSpinBox); msSpinBox = new QDoubleSpinBox(this); msSpinBox->setDecimals(0); msSpinBox->setRange(0.0, 999); msSpinBox->setSuffix(" m"); msSpinBox->setSingleStep(1.0); msSpinBox->setAlignment(Qt::AlignRight); intervalDistanceLayout->addWidget(msSpinBox); //mainLayout->addLayout(intervalDistanceLayout); intervalDistanceWidget->setLayout(intervalDistanceLayout); intervalDistanceWidget->hide(); mainLayout->addWidget(intervalDistanceWidget); intervalCountWidget = new QWidget(); QHBoxLayout *intervalCountLayout = new QHBoxLayout; QLabel *intervalCountLabel = new QLabel(tr("How many to find: "), this); intervalCountLayout->addWidget(intervalCountLabel); countSpinBox = new QDoubleSpinBox(this); countSpinBox->setDecimals(0); countSpinBox->setMinimum(1.0); countSpinBox->setValue(5.0); // lets default to the top 5 powers countSpinBox->setSingleStep(1.0); countSpinBox->setAlignment(Qt::AlignRight); intervalCountLayout->addWidget(countSpinBox); //mainLayout->addLayout(intervalCountLayout); intervalCountWidget->setLayout(intervalCountLayout); mainLayout->addWidget(intervalCountWidget); QLabel *resultsLabel = new QLabel(tr("Results:"), this); mainLayout->addWidget(resultsLabel); // user can select from the results to add // to the ride intervals resultsTable = new QTableWidget; mainLayout->addWidget(resultsTable); resultsTable->setColumnCount(5); resultsTable->setColumnHidden(3, true); // has start time in secs resultsTable->setColumnHidden(4, true); // has stop time in secs resultsTable->horizontalHeader()->hide(); // resultsTable->verticalHeader()->hide(); resultsTable->setShowGrid(false); QHBoxLayout *buttonLayout = new QHBoxLayout; createButton = new QPushButton(tr("&Create Intervals"), this); buttonLayout->addWidget(createButton); doneButton = new QPushButton(tr("&Done"), this); buttonLayout->addWidget(doneButton); addButton = new QPushButton(tr("&Add to Intervals")); buttonLayout->addWidget(addButton); mainLayout->addLayout(buttonLayout); connect(methodFirst, SIGNAL(clicked()), this, SLOT(methodFirstClicked())); connect(methodBestPower, SIGNAL(clicked()), this, SLOT(methodBestPowerClicked())); connect(peakPowerStandard, SIGNAL(clicked()), this, SLOT(peakPowerStandardClicked())); connect(peakPowerCustom, SIGNAL(clicked()), this, SLOT(peakPowerCustomClicked())); connect(typeTime, SIGNAL(clicked()), this, SLOT(typeTimeClicked())); connect(typeDistance, SIGNAL(clicked()), this, SLOT(typeDistanceClicked())); connect(createButton, SIGNAL(clicked()), this, SLOT(createClicked())); connect(doneButton, SIGNAL(clicked()), this, SLOT(doneClicked())); connect(addButton, SIGNAL(clicked()), this, SLOT(addClicked())); }
void HTMLElement::setDraggable(bool value) { setAttribute(draggableAttr, value ? "true" : "false"); }
void HTMLElement::setTranslate(bool enable) { setAttribute(translateAttr, enable ? "yes" : "no"); }
HelpWidget::HelpWidget(QWidget * par, bool bIsStandalone) : QWidget(par) { setObjectName("help_widget"); setMinimumWidth(80); if(bIsStandalone) g_pHelpWidgetList->append(this); m_bIsStandalone = bIsStandalone; new QShortcut(QKeySequence::Copy, this, SLOT(slotCopy()), nullptr, Qt::WidgetWithChildrenShortcut); new QShortcut(QKeySequence::Find, this, SLOT(slotShowHideFind()), nullptr, bIsStandalone ? Qt::WidgetWithChildrenShortcut : Qt::WindowShortcut); // layout m_pLayout = new QVBoxLayout(this); m_pLayout->setMargin(0); m_pLayout->setSpacing(0); setLayout(m_pLayout); // upper toolbar m_pToolBar = new QToolBar(this); m_pLayout->addWidget(m_pToolBar); // webview m_pTextBrowser = new QWebView(this); m_pTextBrowser->setObjectName("text_browser"); m_pTextBrowser->setStyleSheet("QTextBrowser { background-color:white; color:black; }"); m_pLayout->addWidget(m_pTextBrowser); connect(m_pTextBrowser, SIGNAL(loadFinished(bool)), this, SLOT(slotLoadFinished(bool))); // lower toolbar m_pToolBarHighlight = new QToolBar(this); m_pLayout->addWidget(m_pToolBarHighlight); m_pToolBarHighlight->hide(); QLabel * pHighlightLabel = new QLabel(); pHighlightLabel->setText(__tr2qs("Highlight: ")); m_pToolBarHighlight->addWidget(pHighlightLabel); m_pFindText = new QLineEdit(); m_pToolBarHighlight->addWidget(m_pFindText); connect(m_pFindText, SIGNAL(textChanged(const QString)), this, SLOT(slotTextChanged(const QString))); m_pToolBarHighlight->addAction(*g_pIconManager->getSmallIcon(KviIconManager::Discard), __tr2qs("Reset"), this, SLOT(slotResetFind())); m_pToolBarHighlight->addAction(*g_pIconManager->getBigIcon(KVI_BIGICON_HELPBACK), __tr2qs("Find previous"), this, SLOT(slotFindPrev())); m_pToolBarHighlight->addAction(*g_pIconManager->getBigIcon(KVI_BIGICON_HELPFORWARD), __tr2qs("Find next"), this, SLOT(slotFindNext())); // upper toolbar contents (depends on webview) QLabel * pBrowsingLabel = new QLabel(); pBrowsingLabel->setText(__tr2qs("Browsing: ")); m_pToolBar->addWidget(pBrowsingLabel); m_pToolBar->addAction(*g_pIconManager->getBigIcon(KVI_BIGICON_HELPINDEX), __tr2qs("Show index"), this, SLOT(showIndex())); QAction * pAction; pAction = m_pTextBrowser->pageAction(QWebPage::Back); pAction->setIcon(*g_pIconManager->getBigIcon(KVI_BIGICON_HELPBACK)); m_pToolBar->addAction(pAction); pAction = m_pTextBrowser->pageAction(QWebPage::Forward); pAction->setIcon(*g_pIconManager->getBigIcon(KVI_BIGICON_HELPFORWARD)); m_pToolBar->addAction(pAction); m_pToolBar->addAction(*(g_pIconManager->getSmallIcon(KviIconManager::Plus)), __tr2qs("Zoom in"), this, SLOT(slotZoomIn())); m_pToolBar->addAction(*(g_pIconManager->getSmallIcon(KviIconManager::Minus)), __tr2qs("Zoom out"), this, SLOT(slotZoomOut())); if(bIsStandalone) { setAttribute(Qt::WA_DeleteOnClose); m_pToolBar->addAction(*g_pIconManager->getBigIcon(KVI_BIGICON_HELPCLOSE), __tr2qs("Close"), this, SLOT(close())); } }
ExportObjectDialog::ExportObjectDialog(QWidget &parent, CaptureFile &cf, ObjectType object_type) : WiresharkDialog(parent, cf), eo_ui_(new Ui::ExportObjectDialog), save_bt_(NULL), save_all_bt_(NULL), tap_name_(NULL), name_(NULL), tap_packet_(NULL), eo_protocoldata_resetfn_(NULL) { QPushButton *close_bt; eo_ui_->setupUi(this); setAttribute(Qt::WA_DeleteOnClose, true); #if defined(Q_OS_MAC) eo_ui_->progressLabel->setAttribute(Qt::WA_MacSmallSize, true); eo_ui_->progressBar->setAttribute(Qt::WA_MacSmallSize, true); #endif export_object_list_.eod = this; switch (object_type) { case Dicom: tap_name_ = "dicom_eo"; name_ = "DICOM"; tap_packet_ = eo_dicom_packet; break; case Http: tap_name_ = "http_eo"; name_ = "HTTP"; tap_packet_ = eo_http_packet; break; case Smb: tap_name_ = "smb_eo"; name_ = "SMB"; tap_packet_ = eo_smb_packet; eo_protocoldata_resetfn_ = eo_smb_cleanup; break; case Tftp: tap_name_ = "tftp_eo"; name_ = "TFTP"; tap_packet_ = eo_tftp_packet; break; } save_bt_ = eo_ui_->buttonBox->button(QDialogButtonBox::Save); save_all_bt_ = eo_ui_->buttonBox->button(QDialogButtonBox::SaveAll); close_bt = eo_ui_->buttonBox->button(QDialogButtonBox::Close); setWindowTitle(wsApp->windowTitleString(QStringList() << tr("Export") << tr("%1 object list").arg(name_))); if (save_bt_) save_bt_->setEnabled(false); if (save_all_bt_) save_all_bt_->setEnabled(false); if (close_bt) close_bt->setDefault(true); connect(&cap_file_, SIGNAL(captureFileClosing()), this, SLOT(captureFileClosing())); show(); raise(); activateWindow(); }
OSDPretty::OSDPretty(Mode mode, QWidget* parent) : QWidget(parent), ui_(new Ui_OSDPretty), mode_(mode), background_color_(kPresetBlue), background_opacity_(0.85), popup_display_(0), font_(QFont()), disable_duration_(false), timeout_(new QTimer(this)), fading_enabled_(false), fader_(new QTimeLine(300, this)), toggle_mode_(false) { Qt::WindowFlags flags = Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint | Qt::X11BypassWindowManagerHint; setWindowFlags(flags); setAttribute(Qt::WA_TranslucentBackground, true); setAttribute(Qt::WA_X11NetWmWindowTypeNotification, true); setAttribute(Qt::WA_ShowWithoutActivating, true); ui_->setupUi(this); #ifdef Q_OS_WIN32 // Don't show the window in the taskbar. Qt::ToolTip does this too, but it // adds an extra ugly shadow. int ex_style = GetWindowLong(winId(), GWL_EXSTYLE); ex_style |= WS_EX_NOACTIVATE; SetWindowLong(winId(), GWL_EXSTYLE, ex_style); #endif // Mode settings switch (mode_) { case Mode_Popup: setCursor(QCursor(Qt::ArrowCursor)); break; case Mode_Draggable: setCursor(QCursor(Qt::OpenHandCursor)); break; } // Timeout timeout_->setSingleShot(true); timeout_->setInterval(5000); connect(timeout_, SIGNAL(timeout()), SLOT(hide())); ui_->icon->setMaximumSize(kMaxIconSize, kMaxIconSize); // Fader connect(fader_, SIGNAL(valueChanged(qreal)), SLOT(FaderValueChanged(qreal))); connect(fader_, SIGNAL(finished()), SLOT(FaderFinished())); #ifdef Q_OS_WIN32 set_fading_enabled(true); #endif // Load the show edges and corners QImage shadow_edge(":osd_shadow_edge.png"); QImage shadow_corner(":osd_shadow_corner.png"); for (int i = 0; i < 4; ++i) { QTransform rotation = QTransform().rotate(90 * i); shadow_edge_[i] = QPixmap::fromImage(shadow_edge.transformed(rotation)); shadow_corner_[i] = QPixmap::fromImage(shadow_corner.transformed(rotation)); } background_ = QPixmap(":osd_background.png"); // Set the margins to allow for the drop shadow QBoxLayout* l = static_cast<QBoxLayout*>(layout()); int margin = l->margin() + kDropShadowSize; l->setMargin(margin); // Get current screen resolution QRect screenResolution = QApplication::desktop()->screenGeometry(); // Leave 200 px for icon ui_->summary->setMaximumWidth(screenResolution.width() - 200); ui_->message->setMaximumWidth(screenResolution.width() - 200); // Set maximum size for the OSD, a little margin here too setMaximumSize(screenResolution.width() - 100, screenResolution.height() - 100); // Don't load settings here, they will be reloaded anyway on creation }
OAuthDialog::OAuthDialog(Context *context, OAuthSite site, QString baseURL) : context(context), site(site), baseURL(baseURL) { setAttribute(Qt::WA_DeleteOnClose); setWindowTitle(tr("OAuth")); // check if SSL is available - if not - message and end if (!QSslSocket::supportsSsl()) { QString text = QString(tr("SSL Security Libraries required for 'Authorise' are missing in this installation.")); QMessageBox sslMissing(QMessageBox::Critical, tr("Authorization Error"), text); sslMissing.exec(); noSSLlib = true; return; } // SSL is available - so authorisation can take place noSSLlib = false; layout = new QVBoxLayout(); layout->setSpacing(0); layout->setContentsMargins(2,0,2,2); setLayout(layout); #if defined(NOWEBKIT) || (QT_VERSION > 0x050000 && defined(Q_OS_MAC)) view = new QWebEngineView(); #else view = new QWebView(); #endif view->setContentsMargins(0,0,0,0); view->page()->view()->setContentsMargins(0,0,0,0); view->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); view->setAcceptDrops(false); layout->addWidget(view); QString urlstr = ""; if (site == STRAVA) { urlstr = QString("https://www.strava.com/oauth/authorize?"); urlstr.append("client_id=").append(GC_STRAVA_CLIENT_ID).append("&"); urlstr.append("scope=view_private,write&"); urlstr.append("redirect_uri=http://www.goldencheetah.org/&"); urlstr.append("response_type=code&"); urlstr.append("approval_prompt=force"); } else if (site == DROPBOX) { urlstr = QString("https://www.dropbox.com/1/oauth2/authorize?"); #ifdef GC_DROPBOX_CLIENT_ID urlstr.append("client_id=").append(GC_DROPBOX_CLIENT_ID).append("&"); #endif urlstr.append("redirect_uri=https://goldencheetah.github.io/blank.html&"); urlstr.append("response_type=code&"); urlstr.append("force_reapprove=true"); } else if (site == TWITTER) { #ifdef GC_HAVE_KQOAUTH oauthRequest = new KQOAuthRequest; oauthManager = new KQOAuthManager(this); connect(oauthManager, SIGNAL(temporaryTokenReceived(QString,QString)), this, SLOT(onTemporaryTokenReceived(QString, QString))); connect(oauthManager, SIGNAL(authorizationReceived(QString,QString)), this, SLOT( onAuthorizationReceived(QString, QString))); connect(oauthManager, SIGNAL(accessTokenReceived(QString,QString)), this, SLOT(onAccessTokenReceived(QString,QString))); connect(oauthManager, SIGNAL(requestReady(QByteArray)), this, SLOT(onRequestReady(QByteArray))); connect(oauthManager, SIGNAL(authorizationPageRequested(QUrl)), this, SLOT(onAuthorizationPageRequested(QUrl))); oauthRequest->initRequest(KQOAuthRequest::TemporaryCredentials, QUrl("https://api.twitter.com/oauth/request_token")); oauthRequest->setConsumerKey(GC_TWITTER_CONSUMER_KEY); oauthRequest->setConsumerSecretKey(GC_TWITTER_CONSUMER_SECRET); oauthManager->setHandleUserAuthorization(true); oauthManager->setHandleAuthorizationPageOpening(false); oauthManager->executeRequest(oauthRequest); #endif } else if (site == CYCLING_ANALYTICS) { urlstr = QString("https://www.cyclinganalytics.com/api/auth?"); urlstr.append("client_id=").append(GC_CYCLINGANALYTICS_CLIENT_ID).append("&"); urlstr.append("scope=modify_rides&"); urlstr.append("redirect_uri=http://www.goldencheetah.org/&"); urlstr.append("response_type=code&"); urlstr.append("approval_prompt=force"); } else if (site == GOOGLE_CALENDAR) { // OAUTH 2.0 - Google flow for installed applications urlstr = QString("https://accounts.google.com/o/oauth2/auth?"); urlstr.append("scope=https://www.googleapis.com/auth/calendar&"); urlstr.append("redirect_uri=urn:ietf:wg:oauth:2.0:oob&"); urlstr.append("response_type=code&"); urlstr.append("client_id=").append(GC_GOOGLE_CALENDAR_CLIENT_ID); #if QT_VERSION >= 0x050000 } else if (site == GOOGLE_DRIVE) { const QString scope = GoogleDrive::GetScope(context); // OAUTH 2.0 - Google flow for installed applications urlstr = QString("https://accounts.google.com/o/oauth2/auth?"); // We only request access to the application data folder, not all files. urlstr.append("scope=https://www.googleapis.com/auth/" + scope + "&"); urlstr.append("redirect_uri=urn:ietf:wg:oauth:2.0:oob&"); urlstr.append("response_type=code&"); urlstr.append("client_id=").append(GC_GOOGLE_DRIVE_CLIENT_ID); #endif } else if (site == TODAYSPLAN) { //urlstr = QString("https://whats.todaysplan.com.au/en/authorize/"); if (baseURL=="") baseURL="https://whats.todaysplan.com.au"; urlstr = QString("%1/authorize/").arg(baseURL); #ifdef GC_TODAYSPLAN_CLIENT_ID urlstr.append(GC_TODAYSPLAN_CLIENT_ID); #endif } // different process to get the token for STRAVA, CYCLINGANALYTICS vs. // TWITTER if (site == DROPBOX || site == STRAVA || site == CYCLING_ANALYTICS || site == GOOGLE_CALENDAR || site == GOOGLE_DRIVE || site == TODAYSPLAN) { url = QUrl(urlstr); view->setUrl(url); // connects connect(view, SIGNAL(urlChanged(const QUrl&)), this, SLOT(urlChanged(const QUrl&))); connect(view, SIGNAL(loadFinished(bool)), this, SLOT(loadFinished(bool))); }
void HTMLButtonElement::setValue(const String &value) { setAttribute(valueAttr, value); }
RenderArea::RenderArea(QWidget *parent) : QWidget(parent) { setAttribute(Qt::WA_StaticContents); scribbling = false; rrt = new RRT; }
FinderHomeWidget::FinderHomeWidget(QWidget *parent) : QWidget(parent) { setWindowTitle(tr("Home")); // speedup painting since we'll paint the whole background // by ourselves anyway in paintEvent() setAttribute(Qt::WA_OpaquePaintEvent); // colors QPalette p = palette(); p.setBrush(QPalette::Base, Qt::black); p.setColor(QPalette::Text, QColor(Qt::white)); p.setBrush(QPalette::Window, Qt::black); p.setColor(QPalette::WindowText, QColor(Qt::white)); this->setPalette(p); QBoxLayout *layout = new QVBoxLayout(this); layout->setMargin(0); layout->setSpacing(0); layout->setAlignment(Qt::AlignLeft | Qt::AlignTop); QLabel *welcomeLabel = new QLabel("<h3>" + tr("Welcome to <a href='%1'>%2</a>,") .replace("<a ", "<a style='color:white'") .arg(Constants::WEBSITE, Constants::APP_NAME) + "</h3>" + tr("Use the icons below to explore your music collection."), this); welcomeLabel->setOpenExternalLinks(true); welcomeLabel->setMargin(15); layout->addWidget(welcomeLabel); // welcomeLabel->setStyleSheet("background: qlineargradient(x1:0, y1:0, x2:1, y2:1,stop:0 #1a1a1a, stop:1 #343434)"); QListWidget *items = new QListWidget(this); connect(items, SIGNAL(itemActivated(QListWidgetItem*)), SLOT(itemActivated(QListWidgetItem*))); items->setAutoFillBackground(false); items->setAttribute(Qt::WA_NoSystemBackground); items->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel); items->setFrameShape(QFrame::NoFrame); items->setAttribute(Qt::WA_MacShowFocusRect, false); items->setSelectionMode(QAbstractItemView::NoSelection); items->addItem(tr("Artists")); items->addItem(tr("Albums")); items->addItem(tr("Tracks")); items->addItem(tr("Years")); items->addItem(tr("Languages")); layout->addWidget(items); /* Artists Albums Tracks Time machine By language Files --- Tagcloud */ }
void HTMLButtonElement::setAccessKey(const String &value) { setAttribute(accesskeyAttr, value); }
Graph::Graph(QWidget * parent) : QWidget(parent), m_ymin(-1), m_ymax(1), m_xrange(1), m_scroll_error(0), m_render_hints(0) { setAttribute(Qt::WA_OpaquePaintEvent); }
void HTMLBaseElement::setHref(const AtomicString& value) { setAttribute(hrefAttr, value); }
TreeViewTouch::TreeViewTouch(QWidget *parent) : QTreeView(parent) { setAttribute(Qt::WA_AcceptTouchEvents); }
void SVGStyleElement::setTitle(const AtomicString& title, ExceptionCode&) { setAttribute(SVGNames::titleAttr, title); }
Attr_ReadValue Item::readAttr(AttrTypes_t attr, PropStream& propStream) { switch(attr) { case ATTR_COUNT: { uint8_t _count; if(!propStream.getByte(_count)) return ATTR_READ_ERROR; setSubType((uint16_t)_count); break; } case ATTR_ACTION_ID: { uint16_t aid; if(!propStream.getShort(aid)) return ATTR_READ_ERROR; setAttribute("aid", aid); break; } case ATTR_UNIQUE_ID: { uint16_t uid; if(!propStream.getShort(uid)) return ATTR_READ_ERROR; setUniqueId(uid); break; } case ATTR_NAME: { std::string name; if(!propStream.getString(name)) return ATTR_READ_ERROR; setAttribute("name", name); break; } case ATTR_PLURALNAME: { std::string name; if(!propStream.getString(name)) return ATTR_READ_ERROR; setAttribute("pluralname", name); break; } case ATTR_ARTICLE: { std::string article; if(!propStream.getString(article)) return ATTR_READ_ERROR; setAttribute("article", article); break; } case ATTR_ATTACK: { int32_t attack; if(!propStream.getLong((uint32_t&)attack)) return ATTR_READ_ERROR; setAttribute("attack", attack); break; } case ATTR_EXTRAATTACK: { int32_t attack; if(!propStream.getLong((uint32_t&)attack)) return ATTR_READ_ERROR; setAttribute("extraattack", attack); break; } case ATTR_DEFENSE: { int32_t defense; if(!propStream.getLong((uint32_t&)defense)) return ATTR_READ_ERROR; setAttribute("defense", defense); break; } case ATTR_EXTRADEFENSE: { int32_t defense; if(!propStream.getLong((uint32_t&)defense)) return ATTR_READ_ERROR; setAttribute("extradefense", defense); break; } case ATTR_ARMOR: { int32_t armor; if(!propStream.getLong((uint32_t&)armor)) return ATTR_READ_ERROR; setAttribute("armor", armor); break; } case ATTR_ATTACKSPEED: { int32_t attackSpeed; if(!propStream.getLong((uint32_t&)attackSpeed)) return ATTR_READ_ERROR; setAttribute("attackspeed", attackSpeed); break; } case ATTR_HITCHANCE: { int32_t hitChance; if(!propStream.getLong((uint32_t&)hitChance)) return ATTR_READ_ERROR; setAttribute("hitchance", hitChance); break; } case ATTR_SCRIPTPROTECTED: { uint8_t protection; if(!propStream.getByte(protection)) return ATTR_READ_ERROR; setAttribute("scriptprotected", protection != 0); break; } case ATTR_DUALWIELD: { uint8_t wield; if(!propStream.getByte(wield)) return ATTR_READ_ERROR; setAttribute("dualwield", wield != 0); break; } case ATTR_TEXT: { std::string text; if(!propStream.getString(text)) return ATTR_READ_ERROR; setAttribute("text", text); break; } case ATTR_WRITTENDATE: { int32_t date; if(!propStream.getLong((uint32_t&)date)) return ATTR_READ_ERROR; setAttribute("date", date); break; } case ATTR_WRITTENBY: { std::string writer; if(!propStream.getString(writer)) return ATTR_READ_ERROR; setAttribute("writer", writer); break; } case ATTR_DESC: { std::string text; if(!propStream.getString(text)) return ATTR_READ_ERROR; setAttribute("description", text); break; } case ATTR_RUNE_CHARGES: { uint8_t charges; if(!propStream.getByte(charges)) return ATTR_READ_ERROR; setSubType((uint16_t)charges); break; } case ATTR_CHARGES: { uint16_t charges; if(!propStream.getShort(charges)) return ATTR_READ_ERROR; setSubType(charges); break; } case ATTR_DURATION: { int32_t duration; if(!propStream.getLong((uint32_t&)duration)) return ATTR_READ_ERROR; setAttribute("duration", duration); break; } case ATTR_DECAYING_STATE: { uint8_t state; if(!propStream.getByte(state)) return ATTR_READ_ERROR; if((ItemDecayState_t)state != DECAYING_FALSE) setAttribute("decaying", (int32_t)DECAYING_PENDING); break; } //these should be handled through derived classes //if these are called then something has changed in the items.otb since the map was saved //just read the values //Depot class case ATTR_DEPOT_ID: { uint16_t depot; if(!propStream.getShort(depot)) return ATTR_READ_ERROR; break; } //Door class case ATTR_HOUSEDOORID: { uint8_t door; if(!propStream.getByte(door)) return ATTR_READ_ERROR; break; } //Teleport class case ATTR_TELE_DEST: { TeleportDest* dest; if(!propStream.getStruct(dest)) return ATTR_READ_ERROR; break; } //Bed class case ATTR_SLEEPERGUID: { uint32_t sleeper; if(!propStream.getLong(sleeper)) return ATTR_READ_ERROR; break; } case ATTR_SLEEPSTART: { uint32_t sleepStart; if(!propStream.getLong(sleepStart)) return ATTR_READ_ERROR; break; } //Container class case ATTR_CONTAINER_ITEMS: { uint32_t _count; propStream.getLong(_count); return ATTR_READ_ERROR; } //ItemAttributes class case ATTR_ATTRIBUTE_MAP: { bool unique = hasIntegerAttribute("uid"), ret = unserializeMap(propStream); if(!unique && hasIntegerAttribute("uid")) // unfortunately we have to do this ScriptEnviroment::addUniqueThing(this); // this attribute has a custom behavior as well if(getDecaying() != DECAYING_FALSE) setDecaying(DECAYING_PENDING); if(ret) break; } default: return ATTR_READ_ERROR; } return ATTR_READ_CONTINUE; }
void KVNetworkReply::copyAttribute(QNetworkRequest::Attribute attr) { QVariant attribute = d->copied->attribute(attr); if(attribute.isValid()) setAttribute(attr, attribute); }
MDISceneForm::MDISceneForm(QWidget *parent) : QMdiSubWindow(parent) { ui.setupUi(this); setAttribute(Qt::WA_DeleteOnClose); }
CustomPaintWidget::CustomPaintWidget(QWidget *parent) : QWidget(parent) { m_Output = NULL; setAttribute(Qt::WA_PaintOnScreen); }
XSettingsWindow::XSettingsWindow(const qutim_sdk_0_3::SettingsItemList& settings, QObject* controller, QWidget *parent) : QMainWindow(parent), p(new XSettingsWindowPrivate) { setAttribute(Qt::WA_DeleteOnClose); p->controller = controller; setWindowModality(controller ? Qt::WindowModal : Qt::NonModal); //setup ui QWidget *widget = new QWidget(this); QVBoxLayout *l = new QVBoxLayout(widget); Config cfg; cfg.beginGroup("xsettings/window"); QByteArray data; p->parent = qobject_cast<XSettingsWindow*>(qApp->activeWindow()); if(p->parent) { QRect geom = p->parent->geometry(); int width = geom.width()/15; int height = geom.height()/15; geom.adjust(width,height,-width,-height); setGeometry(geom); } else { data = cfg.value("geometry", QByteArray()); if (data.isEmpty() || !restoreGeometry(data)) { QSize desktopSize = QApplication::desktop()->availableGeometry(QCursor::pos()).size(); resize(desktopSize.width() / 2, desktopSize.height() * 2 / 3); centerizeWidget(this); } } //init widgets p->splitter = new QSplitter(Qt::Horizontal,widget); p->listWidget = new QListWidget(widget); p->stackedWidget = new QStackedWidget(widget); //default widget QWidget *empty = new QWidget(this); p->stackedWidget->addWidget(empty); p->splitter->addWidget(p->listWidget); p->splitter->addWidget(p->stackedWidget); data = cfg.value("splitterState", QByteArray()); if (data.isEmpty() || !p->splitter->restoreState(data)) p->splitter->setSizes(QList<int>() << 80 << 250); l->addWidget(p->splitter); QDialogButtonBox::StandardButtons buttons; if (controller) buttons = QDialogButtonBox::Ok; else buttons = QDialogButtonBox::Save | QDialogButtonBox::Cancel; p->buttonBox = new QDialogButtonBox(buttons, Qt::Horizontal, widget); l->addWidget(p->buttonBox); p->buttonBox->setVisible(controller); //init actiontoolbar setCentralWidget(widget); setUnifiedTitleAndToolBarOnMac(true); p->toolBar = new ActionToolBar(widget); addToolBar(Qt::TopToolBarArea,p->toolBar); int width = style()->pixelMetric(QStyle::PM_IconViewIconSize); QSize size = QSize(width, width); p->toolBar->setIconSize(size); p->toolBar->setToolButtonStyle(Qt::ToolButtonTextUnderIcon); p->toolBar->setObjectName(QLatin1String("SettingsBar")); p->toolBar->setMovable(false); #if defined (Q_OS_WIN32) || defined(Q_OS_MAC) width = 22; #else width = style()->pixelMetric(QStyle::PM_ToolBarIconSize); #endif size = QSize(width, width); p->listWidget->setIconSize(size); p->group = new QActionGroup(widget); p->group->setExclusive(true); //connections connect(p->group,SIGNAL(triggered(QAction*)), SLOT(onGroupActionTriggered(QAction*))); connect(p->listWidget, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)), SLOT(onCurrentItemChanged(QListWidgetItem*)) ); connect(p->buttonBox,SIGNAL(accepted()), SLOT(save())); connect(p->buttonBox,SIGNAL(rejected()), SLOT(cancel())); loadSettings(settings); if (p->group->actions().count()) p->group->actions().first()->trigger(); }
void QwtSlider::initSlider( Qt::Orientation orientation, ScalePos scalePos, BackgroundStyles bgStyle ) { if ( orientation == Qt::Vertical ) setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Expanding ); else setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ); setAttribute( Qt::WA_WState_OwnSizePolicy, false ); d_data = new QwtSlider::PrivateData; d_data->borderWidth = 2; d_data->spacing = 4; d_data->scalePos = scalePos; d_data->bgStyle = bgStyle; const int handleThickness = 16; d_data->handleSize.setWidth( 2 * handleThickness ); d_data->handleSize.setHeight( handleThickness ); if ( !( bgStyle & QwtSlider::Trough ) ) d_data->handleSize.transpose(); if ( orientation == Qt::Vertical ) d_data->handleSize.transpose(); d_data->sliderRect.setRect( 0, 0, 8, 8 ); QwtScaleDraw::Alignment align; if ( orientation == Qt::Vertical ) { // enforce a valid combination of scale position and orientation if ( ( d_data->scalePos == QwtSlider::BottomScale ) || ( d_data->scalePos == QwtSlider::TopScale ) ) { d_data->scalePos = NoScale; } // adopt the policy of layoutSlider (NoScale lays out like Left) if ( d_data->scalePos == QwtSlider::RightScale ) align = QwtScaleDraw::RightScale; else align = QwtScaleDraw::LeftScale; } else { // enforce a valid combination of scale position and orientation if ( ( d_data->scalePos == QwtSlider::LeftScale ) || ( d_data->scalePos == QwtSlider::RightScale ) ) { d_data->scalePos = QwtSlider::NoScale; } // adopt the policy of layoutSlider (NoScale lays out like Bottom) if ( d_data->scalePos == QwtSlider::TopScale ) align = QwtScaleDraw::TopScale; else align = QwtScaleDraw::BottomScale; } scaleDraw()->setAlignment( align ); scaleDraw()->setLength( 100 ); setRange( 0.0, 100.0, 1.0 ); setValue( 0.0 ); }
ConfigDialog::ConfigDialog(QDir _home, Zones *_zones, Context *context) : home(_home), zones(_zones), context(context) { setAttribute(Qt::WA_DeleteOnClose); #ifdef Q_OS_MAC QToolBar *head = addToolBar(tr("Preferences")); setMinimumSize(600,540); setUnifiedTitleAndToolBarOnMac(true); head->setFloatable(false); head->setMovable(false); #else QToolBar *head = addToolBar(tr("Options")); head->setMovable(false); // oops! QFont defaultFont; setMinimumSize(60 * defaultFont.pointSize(),580); //Change for 53 to 60 - To be decided if also Size for Q_OS_MAC need change #endif // center QWidget *spacer = new QWidget(this); spacer->setAutoFillBackground(false); spacer->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding)); head->addWidget(spacer); // icons static QIcon generalIcon(QPixmap(":images/toolbar/GeneralPreferences.png")); static QIcon athleteIcon(QPixmap(":/images/toolbar/user.png")); static QIcon passwordIcon(QPixmap(":/images/toolbar/passwords.png")); static QIcon appearanceIcon(QPixmap(":/images/toolbar/color.png")); static QIcon dataIcon(QPixmap(":/images/toolbar/data.png")); static QIcon metricsIcon(QPixmap(":/images/toolbar/abacus.png")); static QIcon devicesIcon(QPixmap(":/images/devices/kickr.png")); // Setup the signal mapping so the right config // widget is displayed when the icon is clicked QSignalMapper *iconMapper = new QSignalMapper(this); // maps each option connect(iconMapper, SIGNAL(mapped(int)), this, SLOT(changePage(int))); head->setToolButtonStyle(Qt::ToolButtonTextUnderIcon); QAction *added; // General settings added = head->addAction(generalIcon, tr("General")); connect(added, SIGNAL(triggered()), iconMapper, SLOT(map())); iconMapper->setMapping(added, 0); added =head->addAction(athleteIcon, tr("Athlete")); connect(added, SIGNAL(triggered()), iconMapper, SLOT(map())); iconMapper->setMapping(added, 1); added =head->addAction(passwordIcon, tr("Passwords")); connect(added, SIGNAL(triggered()), iconMapper, SLOT(map())); iconMapper->setMapping(added, 2); added =head->addAction(appearanceIcon, tr("Appearance")); connect(added, SIGNAL(triggered()), iconMapper, SLOT(map())); iconMapper->setMapping(added, 3); added =head->addAction(dataIcon, tr("Data Fields")); connect(added, SIGNAL(triggered()), iconMapper, SLOT(map())); iconMapper->setMapping(added, 4); added =head->addAction(metricsIcon, tr("Metrics")); connect(added, SIGNAL(triggered()), iconMapper, SLOT(map())); iconMapper->setMapping(added, 5); added =head->addAction(devicesIcon, tr("Train Devices")); connect(added, SIGNAL(triggered()), iconMapper, SLOT(map())); iconMapper->setMapping(added, 6); // more space spacer = new QWidget(this); spacer->setAutoFillBackground(false); spacer->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding)); head->addWidget(spacer); pagesWidget = new QStackedWidget(this); // create those config pages general = new GeneralConfig(_home, _zones, context); pagesWidget->addWidget(general); athlete = new AthleteConfig(_home, _zones, context); pagesWidget->addWidget(athlete); password = new PasswordConfig(_home, _zones, context); pagesWidget->addWidget(password); appearance = new AppearanceConfig(_home, _zones, context); pagesWidget->addWidget(appearance); data = new DataConfig(_home, _zones, context); pagesWidget->addWidget(data); metric = new MetricConfig(_home, _zones, context); pagesWidget->addWidget(metric); device = new DeviceConfig(_home, _zones, context); pagesWidget->addWidget(device); closeButton = new QPushButton(tr("Close")); saveButton = new QPushButton(tr("Save")); QHBoxLayout *horizontalLayout = new QHBoxLayout; horizontalLayout->addWidget(pagesWidget, 1); QHBoxLayout *buttonsLayout = new QHBoxLayout; buttonsLayout->addStretch(); buttonsLayout->setSpacing(5); buttonsLayout->addWidget(closeButton); buttonsLayout->addWidget(saveButton); QWidget *contents = new QWidget(this); setCentralWidget(contents); contents->setContentsMargins(0,0,0,0); QVBoxLayout *mainLayout = new QVBoxLayout; mainLayout->addLayout(horizontalLayout); mainLayout->addStretch(); mainLayout->addLayout(buttonsLayout); mainLayout->setSpacing(0); contents->setLayout(mainLayout); // We go fixed width to ensure a consistent layout for // tabs, sub-tabs and internal widgets and lists #ifdef Q_OS_MACX setWindowTitle(tr("Preferences")); #else setWindowTitle(tr("Options")); #endif connect(closeButton, SIGNAL(clicked()), this, SLOT(closeClicked())); connect(saveButton, SIGNAL(clicked()), this, SLOT(saveClicked())); }
/** * Constructor. */ QG_GraphicView::QG_GraphicView(QWidget* parent, const char* name, Qt::WFlags f) : QWidget(parent, f), RS_GraphicView() { setObjectName(name); setBackground(background); redrawMethod=RS2::RedrawAll; PixmapLayer1=PixmapLayer2=PixmapLayer3=NULL; layout = new QGridLayout(this); layout->setMargin(0); layout->setSpacing(0); layout->setColumnStretch(0, 1); layout->setColumnStretch(1, 0); layout->setColumnStretch(2, 0); layout->setRowStretch(0, 1); layout->setRowStretch(1, 0); hScrollBar = new QG_ScrollBar(Qt::Horizontal, this); hScrollBar->setSingleStep(50); hScrollBar->setCursor(Qt::ArrowCursor); layout->addWidget(hScrollBar, 1, 0); layout->addItem(new QSpacerItem(0, hScrollBar->sizeHint().height()), 1, 0); connect(hScrollBar, SIGNAL(valueChanged(int)), this, SLOT(slotHScrolled(int))); vScrollBar = new QG_ScrollBar(Qt::Vertical, this); vScrollBar->setSingleStep(50); vScrollBar->setCursor(Qt::ArrowCursor); layout->addWidget(vScrollBar, 0, 2); layout->addItem(new QSpacerItem(vScrollBar->sizeHint().width(), 0), 0, 2); connect(vScrollBar, SIGNAL(valueChanged(int)), this, SLOT(slotVScrolled(int))); // Mouse Cursors: QPixmap cur1(":ui/cur_cad_bmp.png"); QPixmap cur2(":ui/cur_glass_bmp.png"); QPixmap cur3(":ui/cur_del_bmp.png"); QPixmap cur4(":ui/cur_select_bmp.png"); QPixmap cur5(":ui/cur_hand_bmp.png"); #ifdef Q_OS_WIN32 curCad = new QCursor(cur1, 16, 16); curMagnifier = new QCursor(cur2, 12, 12); curDel = new QCursor(cur3, 16, 16); curSelect = new QCursor(cur4, 16, 16); curHand = new QCursor(cur5, 15, 15); #else curCad = new QCursor(cur1, 15, 15); curMagnifier = new QCursor(cur2, 12, 12); curDel = new QCursor(cur3, 15, 15); curSelect = new QCursor(cur4, 15, 15); curHand = new QCursor(cur5, 15, 15); #endif // Dummy widgets for scrollbar corners: //layout->addWidget(new QWidget(this), 1, 1); //QWidget* w = new QWidget(this); //w->setEraseColor(QColor(255,0,0)); gridStatus = new QLabel("-", this); gridStatus->setAlignment(Qt::AlignRight); layout->addWidget(gridStatus, 1, 1, 1, 2); layout->addItem(new QSpacerItem(50, 0), 0, 1); setMouseTracking(true); // flickering under win: //setFocusPolicy(WheelFocus); setFocusPolicy(Qt::NoFocus); // See https://sourceforge.net/tracker/?func=detail&aid=3289298&group_id=342582&atid=1433844 (Left-mouse drag shrinks window) setAttribute(Qt::WA_NoMousePropagation); }
WbDlg::WbDlg(SxeSession* session, PsiAccount* pa) { if ( PsiOptions::instance()->getOption("options.ui.mac.use-brushed-metal-windows").toBool() ) setAttribute(Qt::WA_MacMetalStyle); groupChat_ = session->groupChat(); pending_ = 0; keepOpen_ = false; allowEdits_ = true; selfDestruct_ = 0; QVBoxLayout *vb1 = new QVBoxLayout(this); // first row le_jid_ = new QLineEdit(this); le_jid_->setReadOnly(true); le_jid_->setFocusPolicy(Qt::NoFocus); le_jid_->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum)); lb_ident_ = new AccountLabel(this); lb_ident_->setAccount(pa); lb_ident_->setShowJid(false); lb_ident_->setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum)); QHBoxLayout *hb1 = new QHBoxLayout(); hb1->addWidget(le_jid_); hb1->addWidget(lb_ident_); vb1->addLayout(hb1); // mid area wbWidget_ = new WbWidget(session, this); wbWidget_->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding)); vb1->addWidget(wbWidget_); // Bottom (tool) area act_save_ = new IconAction(tr("Save session"), "psi/save", tr("Save the contents of the whiteboard"), 0, this ); act_geometry_ = new IconAction(tr("Change the geometry"), "psi/whiteboard", tr("Change the geometry"), 0, this ); act_clear_ = new IconAction(tr("End session"), "psi/clearChat", tr("Clear the whiteboard"), 0, this ); act_end_ = new IconAction(tr("End session"), "psi/closetab", tr("End session"), 0, this ); // Black is the default color QPixmap pixmap(16, 16); pixmap.fill(QColor(Qt::black)); act_color_ = new QAction(QIcon(pixmap), tr("Stroke color"), this); pixmap.fill(QColor(Qt::lightGray)); act_fill_ = new QAction(QIcon(pixmap), tr("Fill color"), this); act_widths_ = new IconAction(tr("Stroke width" ), "psi/drawPaths", tr("Stroke width"), 0, this ); act_modes_ = new IconAction(tr("Edit mode" ), "psi/select", tr("Edit mode"), 0, this ); group_widths_ = new QActionGroup(this); group_modes_ = new QActionGroup(this); connect(act_color_, SIGNAL(triggered()), SLOT(setStrokeColor())); connect(act_fill_, SIGNAL(triggered()), SLOT(setFillColor())); connect(group_widths_, SIGNAL(triggered(QAction *)), SLOT(setStrokeWidth(QAction *))); connect(group_modes_, SIGNAL(triggered(QAction *)), SLOT(setMode(QAction *))); connect(act_save_, SIGNAL(activated()), SLOT(save())); connect(act_geometry_, SIGNAL(activated()), SLOT(setGeometry())); connect(act_clear_, SIGNAL(activated()), wbWidget_, SLOT(clear())); connect(act_end_, SIGNAL(activated()), SLOT(endSession())); pixmap = QPixmap(2, 2); pixmap.fill(QColor(Qt::black)); QAction* widthaction = new QAction(QIcon(pixmap), tr("Thin stroke"), group_widths_); widthaction->setData(QVariant(1)); widthaction->setCheckable(true); widthaction->trigger(); pixmap = QPixmap(6, 6); pixmap.fill(QColor(Qt::black)); widthaction = new QAction(QIcon(pixmap), tr("Medium stroke"), group_widths_); widthaction->setData(QVariant(3)); widthaction->setCheckable(true); pixmap = QPixmap(12, 12); pixmap.fill(QColor(Qt::black)); widthaction = new QAction(QIcon(pixmap), tr("Thick stroke"), group_widths_); widthaction->setData(QVariant(6)); widthaction->setCheckable(true); IconAction* action; action = new IconAction(tr("Select"), "psi/select", tr("Select"), 0, group_modes_ ); action->setData(QVariant(WbWidget::Select)); action->setCheckable(true); action = new IconAction(tr( "Translate"), "psi/translate", tr("Translate"), 0, group_modes_ ); action->setData(QVariant(WbWidget::Translate)); action->setCheckable(true); action = new IconAction(tr( "Rotate"), "psi/rotate", tr("Rotate"), 0, group_modes_ ); action->setData(QVariant(WbWidget::Rotate)); action->setCheckable(true); action = new IconAction(tr( "Scale"), "psi/scale", tr("Scale"), 0, group_modes_ ); action->setData(QVariant(WbWidget::Scale)); action->setCheckable(true); action = new IconAction(tr( "Erase"), "psi/erase", tr("Erase"), 0, group_modes_ ); action->setData(QVariant(WbWidget::Erase)); action->setCheckable(true); QAction *separator = new QAction(group_modes_); separator->setSeparator(true); action = new IconAction(tr( "Scroll view"), "psi/scroll", tr("Scroll"), 0, group_modes_ ); action->setData(QVariant(WbWidget::Scroll)); action->setCheckable(true); separator = new QAction(group_modes_); separator->setSeparator(true); action = new IconAction(tr( "Draw paths"), "psi/drawPaths", tr("Draw paths"), 0, group_modes_ ); action->setData(QVariant(WbWidget::DrawPath)); action->setCheckable(true); action->trigger(); // action = new IconAction(tr( "Draw lines"), "psi/drawLines", tr("Draw lines"), 0, group_modes_ ); // action->setData(QVariant(WbWidget::DrawLine)); // action->setCheckable(true); // action = new IconAction(tr( "Draw ellipses"), "psi/drawEllipses", tr("Draw ellipses"), 0, group_modes_ ); // action->setData(QVariant(WbWidget::DrawEllipse)); // action->setCheckable(true); // action = new IconAction(tr( "Draw circles"), "psi/drawCircles", tr("Draw circles"), 0, group_modes_ ); // action->setData(QVariant(WbWidget::DrawCircle)); // action->setCheckable(true); // action = new IconAction(tr( "Draw rectangles"), "psi/drawRectangles", tr("Draw rectangles"), 0, group_modes_ ); // action->setData(QVariant(WbWidget::DrawRectangle)); // action->setCheckable(true); // action = new IconAction(tr( "Add text"), "psi/addText", tr("Add text"), 0, group_modes_ ); // action->setData(QVariant(WbWidget::DrawText)); // action->setCheckable(true); action = new IconAction(tr( "Add images"), "psi/addImage", tr("Add images"), 0, group_modes_ ); action->setData(QVariant(WbWidget::DrawImage)); action->setCheckable(true); menu_widths_ = new QMenu(this); menu_widths_->addActions(group_widths_->actions()); act_widths_->setMenu(menu_widths_); menu_modes_ = new QMenu(this); menu_modes_->addActions(group_modes_->actions()); act_modes_->setMenu(menu_modes_); toolbar_ = new QToolBar(tr("Whiteboard toolbar"), this); toolbar_->setIconSize(QSize(16,16)); toolbar_->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum)); toolbar_->addAction(act_end_); toolbar_->addAction(act_clear_); toolbar_->addAction(act_save_); toolbar_->addAction(act_geometry_); toolbar_->addWidget(new StretchWidget(this)); toolbar_->addAction(act_fill_); toolbar_->addAction(act_color_); toolbar_->addAction(act_widths_); toolbar_->addAction(act_modes_); vb1->addWidget(toolbar_); // Context menu pm_settings_ = new QMenu(this); connect(pm_settings_, SIGNAL(aboutToShow()), SLOT(buildMenu())); X11WM_CLASS("whiteboard"); // set the Jid -> le_jid. le_jid_->setText(QString("%1 (session: %2)").arg(session->target().full()).arg(session->session())); le_jid_->setCursorPosition(0); le_jid_->setToolTip(session->target().full()); // update the widget icon #ifndef Q_WS_MAC setWindowIcon(IconsetFactory::icon("psi/whiteboard").icon()); #endif setWindowOpacity(double(qMax(MINIMUM_OPACITY, PsiOptions::instance()->getOption("options.ui.chat.opacity").toInt())) / 100); resize(PsiOptions::instance()->getOption("options.ui.chat.size").toSize()); }
SQLConfigWindow::SQLConfigWindow() { setAttribute(Qt::WA_DeleteOnClose, true); QVBoxLayout *v = new QVBoxLayout(this); QLabel *desc = new QLabel(tr("<b><span style='color:red'>Don't touch anything if you've no clue what SQL is!</span></b><br /><br />For any change to have effect, you need to restart the server." "<br />If you change the settings without knowledge of what you are doing, you'll probably end up without any users stored anymore.<br/><br/>SQLite is the " "only system fully supported by default. PostGreSQL needs an external installation, and you then just have to put the .dlls in that are located in PostGreSQL's bin folder in the server folder. " "MySQL needs the user to get the right DLLs, the MySQL driver and to install a MySQL database too (it is advised to be on linux to do this as this is far less complicated).")); desc->setWordWrap(true); v->addWidget(desc); QLabel *desc2 = new QLabel(tr("If you have a player database from before BW 2, you may want to export it, delete the database file, and rerun the server. That way it's converted and players " "from that time will have their last login properly stored, which enables the functionnality to delete old alts to work fine.")); desc2->setWordWrap(true); v->addWidget(desc2); QSettings s("config", QSettings::IniFormat); b = new QComboBox(); b->addItem("SQLite"); b->addItem("PostGreSQL"); b->addItem("MySQL"); v->addLayout(new QSideBySide(new QLabel(tr("SQL Database type: ")), b)); if (s.value("SQL/Driver").toInt() == SQLCreator::PostGreSQL) { b->setCurrentIndex(1); } else if (s.value("SQL/Driver").toInt() == SQLCreator::MySQL) { b->setCurrentIndex(2); } name = new QLineEdit(); name->setText(s.value("SQL/Database").toString()); v->addLayout(new QSideBySide(new QLabel(tr("Database name: ")), name)); schema = new QLineEdit(); schema->setText(s.value("SQL/DatabaseSchema", "").toString()); v->addLayout(new QSideBySide(new QLabel(tr("Schema: ")), schema)); user = new QLineEdit(); user->setText(s.value("SQL/User").toString()); v->addLayout(new QSideBySide(new QLabel(tr("User: "******"SQL/Pass").toString()); v->addLayout(new QSideBySide(new QLabel(tr("Password: "******"SQL/Host").toString()); v->addLayout(new QSideBySide(new QLabel(tr("Host: ")), host)); port = new QSpinBox(); port->setRange(0, 65535); port->setValue(s.value("SQL/Port").toInt()); v->addLayout(new QSideBySide(new QLabel(tr("Port: ")), port)); doVacuum = new QCheckBox("Do VACUUM on start if possible (recommended)."); doVacuum->setChecked(s.value("SQL/VacuumOnStartup", true).toBool()); v->addWidget(doVacuum); QPushButton *exporting = new QPushButton(tr("&Export")); connect(exporting, SIGNAL(clicked()), SLOT(exportDatabase())); QPushButton *apply = new QPushButton(tr("&Apply")); connect(apply, SIGNAL(clicked()), this, SLOT(apply())); v->addLayout(new QSideBySide(exporting, apply)); connect(b, SIGNAL(activated(int)), SLOT(changeEnabled())); changeEnabled(); }
void SVGStyleElement::setType(const AtomicString& type, ExceptionCode&) { setAttribute(SVGNames::typeAttr, type); }
void HTMLElement::setSpellcheck(bool enable) { setAttribute(spellcheckAttr, enable ? "true" : "false"); }
void SVGStyleElement::setMedia(const AtomicString& media, ExceptionCode&) { setAttribute(SVGNames::mediaAttr, media); }
void HTMLElement::setDir(const AtomicString& value) { setAttribute(dirAttr, value); }
QtUnit::QtUnit( GenericInput *GridNode, QGroupBox *objHtm, QGridLayout *htmGrid, QGridLayout *sensoryGrid, QGridLayout *motorGrid, QGridLayout *locGrid, QGridLayout *proxInputGrid, int c, int w, int h) { /* don't resize on repaint. */ setAttribute(Qt::WA_StaticContents); /* implement hover-over detection */ setMouseTracking(true); setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); brushColor = INACTIVE_COLOR; toggled = false; isClickable = false; CreateActions(); sizeW = w; sizeH = h; node = GridNode; objDetail = objHtm; this->htmGrid = htmGrid; this->sensoryGrid = sensoryGrid; this->motorGrid = motorGrid; this->locGrid = locGrid; this->proxInputGrid = proxInputGrid; cells = c; if (cells) { std::vector<Cell *> HtmCells = ((Column *)node)->GetCells(); for (int i=0; i<sqrt(cells); i++) { for (int j=0; j<sqrt(cells); j++) { Cell *cell = HtmCells[(int)(j+(i*sqrt(cells)))]; QtCell *qtcell = new QtCell( this, cell, htmGrid, sensoryGrid, motorGrid, locGrid ); //CellGrid->addWidget(qtcell, i, j); qtcell->setGeometry( (j>0?DEF_CELL_W*1.25:DEF_CELL_W)/2*(j+1), (i>0?DEF_CELL_H*1.25:DEF_CELL_H)/2*(i+1), DEF_CELL_W, DEF_CELL_H ); if (cell->IsActive()) qtcell->setBrushColor(ACTIVE_COLOR); else if (cell->IsPredicted()) qtcell->setBrushColor(PREDICTED_COLOR); else qtcell->setBrushColor(INACTIVE_COLOR); } } //this->setLayout(CellGrid); } }