QWidget* MainPage::showNoContactsYetSuggestions(QWidget *parent, std::function<void()> addNewContactsRoutine) { if (!noContactsYetSuggestions_) { noContactsYetSuggestions_ = new QWidget(parent); noContactsYetSuggestions_->setSizePolicy(QSizePolicy::Policy::Expanding, QSizePolicy::Policy::Expanding); noContactsYetSuggestions_->setStyleSheet("background-color: white;"); { auto l = new QVBoxLayout(noContactsYetSuggestions_); l->setContentsMargins(0, 0, 0, 0); l->setSpacing(0); l->setAlignment(Qt::AlignCenter); { auto p = new QWidget(noContactsYetSuggestions_); p->setSizePolicy(QSizePolicy::Policy::Expanding, QSizePolicy::Policy::Preferred); auto pl = new QHBoxLayout(p); pl->setContentsMargins(0, 0, 0, 0); pl->setAlignment(Qt::AlignCenter); { auto w = new QWidget(p); w->setSizePolicy(QSizePolicy::Policy::Fixed, QSizePolicy::Policy::Fixed); w->setStyleSheet("image: url(:/resources/main_window/content_logo_200.png);"); w->setFixedSize(Utils::scale_value(64), Utils::scale_value(64)); pl->addWidget(w); } l->addWidget(p); } { auto p = new QWidget(noContactsYetSuggestions_); p->setSizePolicy(QSizePolicy::Policy::Expanding, QSizePolicy::Policy::Preferred); auto pl = new QHBoxLayout(p); pl->setContentsMargins(0, 0, 0, 0); pl->setAlignment(Qt::AlignCenter); { auto w = new Ui::TextEmojiWidget(p, Utils::FontsFamily::SEGOE_UI, Utils::scale_value(24), QColor("#282828"), Utils::scale_value(44)); w->setSizePolicy(QSizePolicy::Policy::Preferred, w->sizePolicy().verticalPolicy()); w->setText(QT_TRANSLATE_NOOP("placeholders", "Install ICQ on mobile")); pl->addWidget(w); } l->addWidget(p); } { auto p = new QWidget(noContactsYetSuggestions_); p->setSizePolicy(QSizePolicy::Policy::Expanding, QSizePolicy::Policy::Preferred); auto pl = new QHBoxLayout(p); pl->setContentsMargins(0, 0, 0, 0); pl->setAlignment(Qt::AlignCenter); { auto w = new Ui::TextEmojiWidget(p, Utils::FontsFamily::SEGOE_UI, Utils::scale_value(24), QColor("#282828"), Utils::scale_value(30)); w->setSizePolicy(QSizePolicy::Policy::Preferred, w->sizePolicy().verticalPolicy()); w->setText(QT_TRANSLATE_NOOP("placeholders", "to synchronize your contacts")); pl->addWidget(w); } l->addWidget(p); } { auto p = new QWidget(noContactsYetSuggestions_); p->setSizePolicy(QSizePolicy::Policy::Expanding, QSizePolicy::Policy::Preferred); auto pl = new QHBoxLayout(p); pl->setContentsMargins(0, Utils::scale_value(28), 0, 0); pl->setSpacing(Utils::scale_value(8)); pl->setAlignment(Qt::AlignCenter); { auto as = new QPushButton(p); as->setSizePolicy(QSizePolicy::Policy::Fixed, QSizePolicy::Policy::Fixed); as->setFlat(true); auto asu = QString(":/resources/placeholders/content_badge_appstore_%1_200.png").arg(Ui::get_gui_settings()->get_value(settings_language, QString("")).toUpper()); auto asi = QString("QPushButton { border-image: url(%1); } QPushButton:hover { border-image: url(%2); }").arg(asu).arg(asu); as->setStyleSheet(asi); as->setFixedSize(Utils::scale_value(152), Utils::scale_value(44)); as->setCursor(Qt::PointingHandCursor); parent->connect(as, &QPushButton::clicked, []() { QDesktopServices::openUrl(QUrl("https://app.appsflyer.com/id302707408?pid=icq_win")); GetDispatcher()->post_stats_to_core(core::stats::stats_event_names::cl_empty_ios); }); pl->addWidget(as); auto gp = new QPushButton(p); gp->setSizePolicy(QSizePolicy::Policy::Fixed, QSizePolicy::Policy::Fixed); gp->setFlat(true); auto gpu = QString(":/resources/placeholders/content_badge_gplay_%1_200.png").arg(Ui::get_gui_settings()->get_value(settings_language, QString("")).toUpper()); auto gpi = QString("QPushButton { border-image: url(%1); } QPushButton:hover { border-image: url(%2); }").arg(gpu).arg(gpu); gp->setStyleSheet(gpi); gp->setFixedSize(Utils::scale_value(152), Utils::scale_value(44)); gp->setCursor(Qt::PointingHandCursor); parent->connect(gp, &QPushButton::clicked, []() { QDesktopServices::openUrl(QUrl("https://app.appsflyer.com/com.icq.mobile.client?pid=icq_win")); GetDispatcher()->post_stats_to_core(core::stats::stats_event_names::cl_empty_android); }); pl->addWidget(gp); } l->addWidget(p); } { auto p = new QWidget(noContactsYetSuggestions_); p->setSizePolicy(QSizePolicy::Policy::Expanding, QSizePolicy::Policy::Preferred); auto pl = new QHBoxLayout(p); pl->setContentsMargins(0, 0, 0, 0); pl->setSpacing(0); pl->setAlignment(Qt::AlignCenter); { auto w1 = new Ui::TextEmojiWidget(p, Utils::FontsFamily::SEGOE_UI, Utils::scale_value(18), QColor("#282828"), Utils::scale_value(46)); w1->setSizePolicy(QSizePolicy::Policy::Preferred, w1->sizePolicy().verticalPolicy()); w1->setText(QT_TRANSLATE_NOOP("placeholders", "or ")); pl->addWidget(w1); auto w2 = new Ui::TextEmojiWidget(p, Utils::FontsFamily::SEGOE_UI, Utils::scale_value(18), QColor("#579e1c"), Utils::scale_value(46)); w2->setSizePolicy(QSizePolicy::Policy::Preferred, w2->sizePolicy().verticalPolicy()); w2->setText(QT_TRANSLATE_NOOP("placeholders", "find friends")); w2->setCursor(Qt::PointingHandCursor); parent->connect(w2, &Ui::TextEmojiWidget::clicked, addNewContactsRoutine); pl->addWidget(w2); } l->addWidget(p); } { auto p = new QWidget(noContactsYetSuggestions_); p->setSizePolicy(QSizePolicy::Policy::Expanding, QSizePolicy::Policy::Preferred); auto pl = new QHBoxLayout(p); pl->setContentsMargins(0, 0, 0, 0); pl->setAlignment(Qt::AlignCenter); { auto w = new Ui::TextEmojiWidget(p, Utils::FontsFamily::SEGOE_UI, Utils::scale_value(15), QColor("#696969"), Utils::scale_value(20)); w->setSizePolicy(QSizePolicy::Policy::Preferred, w->sizePolicy().verticalPolicy()); w->setText(QT_TRANSLATE_NOOP("placeholders", "by phone number or UIN")); pl->addWidget(w); } l->addWidget(p); } } } return noContactsYetSuggestions_; }
DmWidget::DmWidget(QWidget *parent) : QWidget(parent) { //installEventFilter(this); setObjectName("dmwidget"); setStyleSheet("QWidget#dmwidget {padding-right: 90px; border-radius: 7px; background-color: rgba(55, 55, 55, 210); color: #fff; font-size: 15px;} QLineEdit { border-radius: 2px; background-color: rgba(55, 55, 55, 210); color: #fff; } QLabel { color: #fff; } "); setMaximumSize(QSize(420, 320)); setFixedSize(QSize(250, 80)); QVBoxLayout *layout = new QVBoxLayout(this); QHBoxLayout *topLayout = new QHBoxLayout(); QHBoxLayout *middleLayout = new QHBoxLayout(); layout->addLayout(topLayout); layout->addLayout(middleLayout); m_wlTitle = new QLabel(this); m_wlTitle->setText("Ac/Dc - Back In Black"); m_wlTitle->setStyleSheet("font-size: 12px;"); m_wlTitle->setAlignment(Qt::AlignCenter); topLayout->addWidget(m_wlTitle); //middleLayout m_wlMb = new QLabel(this); m_wlMb->setStyleSheet("font-size: 10px;"); m_wlMb->setText("5/25 Mb"); middleLayout->addWidget(m_wlMb); m_wlQueue = new QLabel(this); m_wlQueue->setStyleSheet("font-size: 10px;"); m_wlQueue->setText("In queue: 5"); m_wlQueue->setAlignment(Qt::AlignRight); middleLayout->addWidget(m_wlQueue); m_wProgress = new QProgressBar(this); m_wProgress->setStyleSheet(":horizontal {border-radius: 0px; background: #BDBDBD;} ::chunk:horizontal { background: #000;}"); m_wProgress->setFixedHeight(3); m_wProgress->setRange(0, 100); m_wProgress->setValue(25); layout->addWidget(m_wProgress); m_wbCancel = new StyledButton(tr("Cancel"), this); m_wbCancel->setFixedSize(50, 20); layout->addWidget(m_wbCancel); connect(m_wbCancel, SIGNAL(clicked()), this, SIGNAL(cancelAll())); connect(m_wbCancel, SIGNAL(clicked()), this, SLOT(onCancelAll())); //layout->addWidget(m_wList); hide(); repaint(); m_effect = new QGraphicsOpacityEffect(this); m_effect->setOpacity(0.0); setGraphicsEffect(m_effect); m_animation = new QPropertyAnimation(m_effect, "opacity"); m_animation->setDuration(550); }
BitcoinGUI::BitcoinGUI(QWidget *parent): QMainWindow(parent), clientModel(0), walletModel(0), encryptWalletAction(0), changePassphraseAction(0), unlockWalletAction(0), lockWalletAction(0), aboutQtAction(0), trayIcon(0), notificator(0), rpcConsole(0) { setFixedSize(970, 550); setWindowTitle(tr("ClickCoin") + " - " + tr("Wallet")); qApp->setStyleSheet("QMainWindow { background-image:url(:images/bkg);border:none; } #frame { } QToolBar QLabel { padding-top:0px;padding-bottom:0px;spacing:10px; } #spacer { background:transparent;border:none; } #toolbar2 { border:none;width:0px;hight:0px;padding-top:40px;padding-bottom:0px; } #toolbar { border:none;height:100%;padding-top:20px; background: #FFFFFF; text-align: center; color: black;min-width:80px;max-width:80px;} QToolBar QToolButton:hover {background-color:rgb(0,0,0));} QToolBar QToolButton { font-family:Century Gothic;padding-left:20px;padding-right:80px;padding-top:0px;padding-bottom:0px; width:100%; color: black; text-align: left; background-color: rgb(0,0,0) } #labelMiningIcon { padding-left:5px;font-family:Century Gothic;width:100%;font-size:10px;text-align:center;color:black; } QMenu { background: rgb(0,0,0); color:black; padding-bottom:10px; } QMenu::item { color:white; background-color: transparent; } QMenu::item:selected { background-color:rgb(0,0,0)); } QMenuBar { background: rgb(0,0,0); color:black; } QMenuBar::item { font-size:12px;padding-bottom:3px;padding-top:3px;padding-left:15px;padding-right:15px;color: black; background-color: white; } QMenuBar::item:selected { background-color:rgb(0,0,0)); }"); #ifndef Q_OS_MAC qApp->setWindowIcon(QIcon(":icons/bitcoin")); setWindowIcon(QIcon(":icons/bitcoin")); #else setUnifiedTitleAndToolBarOnMac(true); QApplication::setAttribute(Qt::AA_DontShowIconsInMenus); #endif // Accept D&D of URIs setAcceptDrops(true); // Create actions for the toolbar, menu bar and tray/dock icon createActions(); // Create application menu bar createMenuBar(); // Create the toolbars createToolBars(); // Create the tray icon (or setup the dock icon) createTrayIcon(); // Create tabs overviewPage = new OverviewPage(); transactionsPage = new QWidget(this); QVBoxLayout *vbox = new QVBoxLayout(); transactionView = new TransactionView(this); vbox->addWidget(transactionView); transactionsPage->setLayout(vbox); addressBookPage = new AddressBookPage(AddressBookPage::ForEditing, AddressBookPage::SendingTab); receiveCoinsPage = new AddressBookPage(AddressBookPage::ForEditing, AddressBookPage::ReceivingTab); sendCoinsPage = new SendCoinsDialog(this); signVerifyMessageDialog = new SignVerifyMessageDialog(this); centralWidget = new QStackedWidget(this); centralWidget->addWidget(overviewPage); centralWidget->addWidget(transactionsPage); centralWidget->addWidget(addressBookPage); centralWidget->addWidget(receiveCoinsPage); centralWidget->addWidget(sendCoinsPage); setCentralWidget(centralWidget); // Status bar notification icons labelEncryptionIcon = new QLabel(); labelStakingIcon = new QLabel(); labelConnectionsIcon = new QLabel(); labelBlocksIcon = new QLabel(); if (GetBoolArg("-staking", true)) { QTimer *timerStakingIcon = new QTimer(labelStakingIcon); connect(timerStakingIcon, SIGNAL(timeout()), this, SLOT(updateStakingIcon())); timerStakingIcon->start(30 * 1000); updateStakingIcon(); } // Progress bar and label for blocks download progressBarLabel = new QLabel(); progressBarLabel->setVisible(false); progressBar = new QProgressBar(); addToolBarBreak(Qt::LeftToolBarArea); QToolBar *toolbar2 = addToolBar(tr("Tabs toolbar")); addToolBar(Qt::LeftToolBarArea,toolbar2); toolbar2->setOrientation(Qt::Vertical); toolbar2->setMovable( false ); toolbar2->setObjectName("toolbar2"); toolbar2->setFixedWidth(28); toolbar2->setIconSize(QSize(28,54)); toolbar2->addWidget(labelEncryptionIcon); toolbar2->addWidget(labelStakingIcon); toolbar2->addWidget(labelConnectionsIcon); toolbar2->addWidget(labelBlocksIcon); toolbar2->setStyleSheet("#toolbar2 QToolButton { background: transparent;border:none;padding:0px;margin:0px;height:54px;width:28px; }"); syncIconMovie = new QMovie(":/movies/update_spinner", "mng", this); // Clicking on a transaction on the overview page simply sends you to transaction history page connect(overviewPage, SIGNAL(transactionClicked(QModelIndex)), this, SLOT(gotoHistoryPage())); connect(overviewPage, SIGNAL(transactionClicked(QModelIndex)), transactionView, SLOT(focusTransaction(QModelIndex))); // Double-clicking on a transaction on the transaction history page shows details connect(transactionView, SIGNAL(doubleClicked(QModelIndex)), transactionView, SLOT(showDetails())); rpcConsole = new RPCConsole(this); connect(openRPCConsoleAction, SIGNAL(triggered()), rpcConsole, SLOT(show())); // Clicking on "Verify Message" in the address book sends you to the verify message tab connect(addressBookPage, SIGNAL(verifyMessage(QString)), this, SLOT(gotoVerifyMessageTab(QString))); // Clicking on "Sign Message" in the receive coins page sends you to the sign message tab connect(receiveCoinsPage, SIGNAL(signMessage(QString)), this, SLOT(gotoSignMessageTab(QString))); gotoOverviewPage(); }
WarehouseGroup::WarehouseGroup(QWidget *pParent, const char *pName) : QGroupBox(pParent) { _selectedOnly = false; if (_x_preferences) if (_x_preferences->boolean("selectedSites")) _selectedOnly=true; if(pName) setObjectName(pName); _fixed = true; _selectedGroup = new QWidget(this); QButtonGroup * buttonGroup = new QButtonGroup(this); _all = new QRadioButton(tr("All Sites"), this); _all->setObjectName("_all"); _site = new QLabel(tr("Site:"),this); _site->setObjectName("_site"); _selected = new QRadioButton(tr("Selected:"), _selectedGroup); _selected->setObjectName("_selected"); if (!_selectedOnly) { _all->setChecked(TRUE); buttonGroup->addButton(_all); buttonGroup->addButton(_selected); } _warehouses = new WComboBox(_selectedGroup, "_warehouses"); if(_selectedOnly) { QHBoxLayout *hLayout = new QHBoxLayout(_selectedGroup); hLayout->setContentsMargins(0, 0, 0, 0); hLayout->setSpacing(5); hLayout->addWidget(_site); hLayout->addWidget(_warehouses); hLayout->addStretch(); _selectedGroup->setLayout(hLayout); QVBoxLayout *vLayout = new QVBoxLayout(this); vLayout->setContentsMargins(5, 5, 5, 5); vLayout->setSpacing(0); vLayout->addWidget(_selectedGroup); setLayout(vLayout); _all->hide(); _selected->hide(); } else { _site->hide(); setFixedSize(false); } connect(_selected, SIGNAL(toggled(bool)), _warehouses, SLOT(setEnabled(bool))); connect(buttonGroup, SIGNAL(buttonClicked(int)), this, SIGNAL(updated())); connect(_warehouses, SIGNAL(newID(int)), this, SIGNAL(updated())); if (((_x_preferences) ? _x_preferences->value("PreferredWarehouse").toInt() : -1) != -1) _selected->setChecked(TRUE); setTabOrder(_all, _selected); setTabOrder(_selected, _warehouses); setTabOrder(_warehouses, _all); setFocusProxy(_all); if (_x_metrics) { if (!_x_metrics->boolean("MultiWhs")) { this->hide(); setAll(); } } }
QPixmapButton(QWidget *parent, const QPixmap &first, const QPixmap &second) : QPushButton(parent), m_showFirst(true), m_first(first), m_second(second) { setFixedSize(m_first.size()); }
InviteWidget::InviteWidget(QStringList items, QString gd, QWidget *parent) : THWidgetBase(parent) { setAttribute(Qt::WA_DeleteOnClose); setFixedSize(250, 180); setTitleBarWidth(250); setWindowFlags(Qt::FramelessWindowHint | Qt::Tool); setWindowModality(Qt::ApplicationModal); bar->setBarButtons(HappyTitleBar::MinButtonHint); bar->setBarButtons(HappyTitleBar::MaxButtonHint); bar->setExtraButtonVisible(false); bar->setBarIcon(":res/happy.png"); bar->setBarContent(cn("邀请成员列表")); connect(bar, &HappyTitleBar::signalClose, this, [=] () { this->close(); }); members = items; gdm = gd; QLabel *lab = new QLabel(cn("选择邀请对象(未筛选)")); lab->setFixedWidth(120); lab->setStyleSheet(QStringLiteral("font-family:微软雅黑;font:12px;color:white;")); QPushButton *pb = new QPushButton(cn("筛选"), this); pb->setFixedWidth(50); pb->setCheckable(true); QHBoxLayout *h1 = new QHBoxLayout(); h1->setContentsMargins(0, 0, 0, 0); h1->addStretch(1); h1->addWidget(lab, 0, Qt::AlignCenter); h1->addWidget(pb, 0, Qt::AlignCenter); h1->addStretch(1); CheckList *list = new CheckList(this); QPushButton *confrim = new QPushButton(cn("确认"), this); confrim->setFixedWidth(50); QVBoxLayout *v = new QVBoxLayout(this); v->setContentsMargins(10, 35, 10, 15); v->addLayout(h1, 1); v->addWidget(list, 5); v->addWidget(confrim, 1, Qt::AlignCenter); QFile file; file.setFileName(":res/css/button2.css"); if (file.open(QIODevice::ReadOnly)) { QByteArray ba = file.readAll(); pb->setStyleSheet(QTextCodec::codecForLocale()->toUnicode(ba)); confrim->setStyleSheet(QTextCodec::codecForLocale()->toUnicode(ba)); } file.close(); file.setFileName(":res/css/list2.css"); if (file.open(QIODevice::ReadOnly)) { QByteArray ba = file.readAll(); list->setStyleSheet(QTextCodec::codecForLocale()->toUnicode(ba)); } file.close(); // load data ConfigureData *conf = ConfigureData::getInstance(); updateColor(conf->getColorIni("color1"), conf->getColorIni("color2")); list->setmyuid(conf->getUuid()); connect(pb, &QPushButton::toggled, this, [=] (bool b) { QString str = cn("选择邀请对象(%1)"); if (b) { QStringList selectList; QStringList items = gdm.split(";"); for (QString str : members) { QStringList temp = str.split(":"); if (temp.size() == 2) { if (!items.contains(temp.last())) { selectList << str; } } } list->addCheckItems(selectList); str = str.arg(cn("筛选")); } else { list->addCheckItems(members); str = str.arg(cn("未筛选")); } lab->setText(str); }); connect(confrim, &QPushButton::clicked, this, [=] () { QString uids = list->checkedids(); QStringList lst = uids.split(";"); if (lst.size() <= 1) { MsgBox::ShowMsgBox(cn("提示"), cn("没有选择"), cn("确定")); return; } emit confrimInvite(lst); this->close(); }); list->addCheckItems(items); }
SplashScreen::SplashScreen(Qt::WindowFlags f, const NetworkStyle *networkStyle) : QWidget(0, f), curAlignment(0) { // set reference point, paddings int paddingRight = 50; int paddingTop = 50; int titleVersionVSpace = 17; int titleCopyrightVSpace = 40; float fontFactor = 1.0; float devicePixelRatio = 1.0; #if QT_VERSION > 0x050100 devicePixelRatio = ((QGuiApplication*)QCoreApplication::instance())->devicePixelRatio(); #endif // define text to place QString titleText = tr("Bitcoin Core"); QString versionText = QString("Version %1").arg(QString::fromStdString(FormatFullVersion())); QString copyrightText = QChar(0xA9)+QString(" 2009-%1 ").arg(COPYRIGHT_YEAR) + QString(tr("The Bitcoin Core developers")); QString titleAddText = networkStyle->getTitleAddText(); QString font = "Arial"; // create a bitmap according to device pixelratio QSize splashSize(480*devicePixelRatio,320*devicePixelRatio); pixmap = QPixmap(splashSize); #if QT_VERSION > 0x050100 // change to HiDPI if it makes sense pixmap.setDevicePixelRatio(devicePixelRatio); #endif QPainter pixPaint(&pixmap); pixPaint.setPen(QColor(100,100,100)); // draw a slighly radial gradient QRadialGradient gradient(QPoint(0,0), splashSize.width()/devicePixelRatio); gradient.setColorAt(0, Qt::white); gradient.setColorAt(1, QColor(247,247,247)); QRect rGradient(QPoint(0,0), splashSize); pixPaint.fillRect(rGradient, gradient); // draw the bitcoin icon, expected size of PNG: 1024x1024 QRect rectIcon(QPoint(-150,-122), QSize(430,430)); const QSize requiredSize(1024,1024); QPixmap icon(networkStyle->getAppIcon().pixmap(requiredSize)); pixPaint.drawPixmap(rectIcon, icon); // check font size and drawing with pixPaint.setFont(QFont(font, 33*fontFactor)); QFontMetrics fm = pixPaint.fontMetrics(); int titleTextWidth = fm.width(titleText); if(titleTextWidth > 160) { // strange font rendering, Arial probably not found fontFactor = 0.75; } pixPaint.setFont(QFont(font, 33*fontFactor)); fm = pixPaint.fontMetrics(); titleTextWidth = fm.width(titleText); pixPaint.drawText(pixmap.width()/devicePixelRatio-titleTextWidth-paddingRight,paddingTop,titleText); pixPaint.setFont(QFont(font, 15*fontFactor)); // if the version string is to long, reduce size fm = pixPaint.fontMetrics(); int versionTextWidth = fm.width(versionText); if(versionTextWidth > titleTextWidth+paddingRight-10) { pixPaint.setFont(QFont(font, 10*fontFactor)); titleVersionVSpace -= 5; } pixPaint.drawText(pixmap.width()/devicePixelRatio-titleTextWidth-paddingRight+2,paddingTop+titleVersionVSpace,versionText); // draw copyright stuff pixPaint.setFont(QFont(font, 10*fontFactor)); pixPaint.drawText(pixmap.width()/devicePixelRatio-titleTextWidth-paddingRight,paddingTop+titleCopyrightVSpace,copyrightText); // draw additional text if special network if(!titleAddText.isEmpty()) { QFont boldFont = QFont(font, 10*fontFactor); boldFont.setWeight(QFont::Bold); pixPaint.setFont(boldFont); fm = pixPaint.fontMetrics(); int titleAddTextWidth = fm.width(titleAddText); pixPaint.drawText(pixmap.width()/devicePixelRatio-titleAddTextWidth-10,15,titleAddText); } pixPaint.end(); // Set window title setWindowTitle(titleText + " " + titleAddText); // Resize window and move to center of desktop, disallow resizing QRect r(QPoint(), QSize(pixmap.size().width()/devicePixelRatio,pixmap.size().height()/devicePixelRatio)); resize(r.size()); setFixedSize(r.size()); move(QApplication::desktop()->screenGeometry().center() - r.center()); subscribeToCoreSignals(); }
void OamCanvas::setScale(unsigned z) { imageSize = 64 * z; setFixedSize(imageSize + frameWidth() * 2, imageSize + frameWidth() * 2); refresh(); }
SplashScreen::SplashScreen(interfaces::Node& node, Qt::WindowFlags f, const NetworkStyle *networkStyle) : QWidget(0, f), curAlignment(0), m_node(node) { // set reference point, paddings int paddingRight = 50; int paddingTop = 50; int titleVersionVSpace = 17; int titleCopyrightVSpace = 40; float fontFactor = 1.0; float devicePixelRatio = 1.0; #if QT_VERSION > 0x050100 devicePixelRatio = static_cast<QGuiApplication*>(QCoreApplication::instance())->devicePixelRatio(); #endif // define text to place QString titleText = tr(PACKAGE_NAME); QString versionText = QString("Version %1").arg(QString::fromStdString(FormatFullVersion())); QString copyrightText = QString::fromUtf8(CopyrightHolders(strprintf("\xc2\xA9 %u-%u ", 2013, COPYRIGHT_YEAR)).c_str()); QString titleAddText = networkStyle->getTitleAddText(); QString font = QApplication::font().toString(); // create a bitmap according to device pixelratio QSize splashSize(480*devicePixelRatio,320*devicePixelRatio); pixmap = QPixmap(splashSize); #if QT_VERSION > 0x050100 // change to HiDPI if it makes sense pixmap.setDevicePixelRatio(devicePixelRatio); #endif QPainter pixPaint(&pixmap); pixPaint.setPen(QColor(100,100,100)); // draw a slightly radial gradient QRadialGradient gradient(QPoint(0,0), splashSize.width()/devicePixelRatio); gradient.setColorAt(0, Qt::white); gradient.setColorAt(1, QColor(247,247,247)); QRect rGradient(QPoint(0,0), splashSize); pixPaint.fillRect(rGradient, gradient); // draw the bitcoin icon, expected size of PNG: 1024x1024 QRect rectIcon(QPoint(-150,-122), QSize(430,430)); const QSize requiredSize(1024,1024); QPixmap icon(networkStyle->getAppIcon().pixmap(requiredSize)); pixPaint.drawPixmap(rectIcon, icon); // check font size and drawing with pixPaint.setFont(QFont(font, 33*fontFactor)); QFontMetrics fm = pixPaint.fontMetrics(); int titleTextWidth = fm.width(titleText); if (titleTextWidth > 176) { fontFactor = fontFactor * 176 / titleTextWidth; } pixPaint.setFont(QFont(font, 33*fontFactor)); fm = pixPaint.fontMetrics(); titleTextWidth = fm.width(titleText); pixPaint.drawText(pixmap.width()/devicePixelRatio-titleTextWidth-paddingRight,paddingTop,titleText); pixPaint.setFont(QFont(font, 15*fontFactor)); // if the version string is too long, reduce size fm = pixPaint.fontMetrics(); int versionTextWidth = fm.width(versionText); if(versionTextWidth > titleTextWidth+paddingRight-10) { pixPaint.setFont(QFont(font, 10*fontFactor)); titleVersionVSpace -= 5; } pixPaint.drawText(pixmap.width()/devicePixelRatio-titleTextWidth-paddingRight+2,paddingTop+titleVersionVSpace,versionText); // draw copyright stuff { pixPaint.setFont(QFont(font, 10*fontFactor)); const int x = pixmap.width()/devicePixelRatio-titleTextWidth-paddingRight; const int y = paddingTop+titleCopyrightVSpace; QRect copyrightRect(x, y, pixmap.width() - x - paddingRight, pixmap.height() - y); pixPaint.drawText(copyrightRect, Qt::AlignLeft | Qt::AlignTop | Qt::TextWordWrap, copyrightText); } // draw additional text if special network if(!titleAddText.isEmpty()) { QFont boldFont = QFont(font, 10*fontFactor); boldFont.setWeight(QFont::Bold); pixPaint.setFont(boldFont); fm = pixPaint.fontMetrics(); int titleAddTextWidth = fm.width(titleAddText); pixPaint.drawText(pixmap.width()/devicePixelRatio-titleAddTextWidth-10,15,titleAddText); } pixPaint.end(); // Set window title setWindowTitle(titleText + " " + titleAddText); // Resize window and move to center of desktop, disallow resizing QRect r(QPoint(), QSize(pixmap.size().width()/devicePixelRatio,pixmap.size().height()/devicePixelRatio)); resize(r.size()); setFixedSize(r.size()); move(QApplication::desktop()->screenGeometry().center() - r.center()); subscribeToCoreSignals(); installEventFilter(this); }
void VirtualKeyboardQt::SwitchLayout(const QString &lang) { if (!m_parentEdit) { VERBOSE(VB_IMPORTANT, LOC_ERR + "No edit receiving output"); reject(); return; } QString language = lang.toLower(); QString theme_file = QString("keyboard/%1_").arg(language); if (!loadThemedWindow("keyboard", theme_file)) { VERBOSE(VB_GENERAL, LOC_WARN + QString("Cannot find layout for '%1'").arg(language)); // cannot find layout so fallback to US English layout if (!loadThemedWindow("keyboard", "keyboard/en_us_")) { VERBOSE(VB_IMPORTANT, LOC_ERR + "Cannot find layout for US English"); reject(); return; } } // get dialog size from keyboard_container area LayerSet *container = getContainer("keyboard_container"); if (!container) { VERBOSE(VB_IMPORTANT, LOC_ERR + "Cannot find the 'keyboard_container' in your theme"); reject(); return; } m_popupWidth = container->GetAreaRect().width(); m_popupHeight = container->GetAreaRect().height(); setFixedSize(QSize(m_popupWidth, m_popupHeight)); QWidget *pw = m_parentEdit; QWidget *tlw = pw->topLevelWidget(); QRect pwg = pw->geometry(); QRect tlwg = tlw->frameGeometry(); QPoint newpos; PopupPositionQt preferredPos; if (m_parentEdit->inherits("MythLineEdit")) { MythLineEdit *par = (MythLineEdit *)m_parentEdit; preferredPos = par->getPopupPosition(); } else if (m_parentEdit->inherits("MythRemoteLineEdit")) { MythRemoteLineEdit *par = (MythRemoteLineEdit *)m_parentEdit; preferredPos = par->getPopupPosition(); } else if (m_parentEdit->inherits("MythComboBox")) { MythComboBox *par = (MythComboBox *)m_parentEdit; preferredPos = par->getPopupPosition(); } else { preferredPos = VKQT_POSCENTERDIALOG; } if (preferredPos == VKQT_POSBELOWEDIT) { if (pw->mapTo(tlw, QPoint(0,pwg.height() + m_popupHeight + 5)).y() < tlwg.height()) { newpos = QPoint(pwg.width() / 2 - m_popupWidth / 2, pwg.height() + 5); } else { newpos = QPoint(pwg.width() / 2 - m_popupWidth / 2, - 5 - m_popupHeight); } } else if (preferredPos == VKQT_POSABOVEEDIT) { if (pw->mapTo(tlw, QPoint(0, - m_popupHeight - 5)).y() > 0) { newpos = QPoint(pwg.width() / 2 - m_popupWidth / 2, - 5 - m_popupHeight); } else { newpos = QPoint(pwg.width() / 2 - m_popupWidth / 2, pwg.height() + 5); } } else if (preferredPos == VKQT_POSTOPDIALOG) { newpos = QPoint(tlwg.width() / 2 - m_popupWidth / 2, 5); this->move(newpos); } else if (preferredPos == VKQT_POSBOTTOMDIALOG) { newpos = QPoint(tlwg.width() / 2 - m_popupWidth / 2, tlwg.height() - 5 - m_popupHeight); this->move(newpos); } else if (preferredPos == VKQT_POSCENTERDIALOG) { newpos = QPoint(tlwg.width() / 2 - m_popupWidth / 2, tlwg.height() / 2 - m_popupHeight / 2); this->move(newpos); } if (preferredPos == VKQT_POSABOVEEDIT || preferredPos == VKQT_POSBELOWEDIT) { int delx = pw->mapTo(tlw,newpos).x() + m_popupWidth - tlwg.width() + 5; newpos = QPoint(newpos.x() - (delx > 0 ? delx : 0), newpos.y()); delx = pw->mapTo(tlw, newpos).x(); newpos = QPoint(newpos.x() - (delx < 0 ? delx : 0), newpos.y()); int xbase, width, ybase, height; float wmult, hmult; GetMythUI()->GetScreenSettings(xbase, width, wmult, ybase, height, hmult); newpos.setX(newpos.x() - xbase); newpos.setY(newpos.y() - ybase); this->move( pw->mapToGlobal( newpos ) ); } // find the UIKeyboardType m_keyboard = getUIKeyboardType("keyboard"); if (!m_keyboard) { VERBOSE(VB_IMPORTANT, LOC_ERR + "Cannot find the UIKeyboardType in your theme"); reject(); return; } if (m_parentEdit->inherits("QComboBox")) { QComboBox *combo = (QComboBox *) m_parentEdit; m_keyboard->SetEdit(combo->lineEdit()); } else m_keyboard->SetEdit(m_parentEdit); m_keyboard->SetParentDialog(this); }
///////////////////////////////////////////////////////////////////////////////////////////////// // Trade dialog class ///////////////////////////////////////////////////////////////////////////////////////////////// CasinoDialog::CasinoDialog(const PlayerState* player, QWidget *parent, const char * name) : QDialog(parent, name, true) { unsigned int money = player->get_money(); setCaption("Welcome to the Casino."); //----------------------------------------------------------------------------------------------- // Set up acceptance and rejection buttons //----------------------------------------------------------------------------------------------- QPushButton *ok = new QPushButton ("Place your bet", this); ok->setGeometry( 110, 300, 215, 30); connect( ok, SIGNAL(clicked()), SLOT(accept())); //----------------------------------------------------------------------------------------------- // Set up frames for trading players //----------------------------------------------------------------------------------------------- QLabel *avail = new QLabel ( QString("Available Money: $") + QString::number(money), this); avail->setGeometry( 130, 170, 205, 30); QLabel *betLabel = new QLabel ( "Place Your Bet:", this); betLabel->setGeometry( 130, 200, 205, 30); _spin = new QSpinBox( (money < 100 ? money : 100) , money, 100, this, "_spin"); _spin->setGeometry(230, 205, 50, 20); //----------------------------------------------------------------------------------------------- // Set up property check boxes for first player //----------------------------------------------------------------------------------------------- QRadioButton *Prop1, *Prop2, *Prop3, *Prop4, *Prop5; Prop1 = new QRadioButton( "Any Craps: wins on a throw of 2, 3 or 12 with a payoff of 8:1", this); Prop1->setGeometry( 5, 0, 400, 30); Prop2 = new QRadioButton( "Any Seven: wins on a throw of 7 with a payoff of 5:1", this); Prop2->setGeometry( 5, 25, 400, 30); Prop3 = new QRadioButton( "Eleven: wins on a throw of 11 with a payoff of 16:1", this); Prop3->setGeometry( 5, 50, 400, 30); Prop4 = new QRadioButton( "Ace Duece: wins on a throw of 3 with a payoff of 16:1", this); Prop4->setGeometry( 5, 75, 400, 30); Prop5 = new QRadioButton( "Aces or Boxcars: wins on a throw of 2 or 12 with a payoff of 30:1", this); Prop5->setGeometry( 5, 100, 410, 30); _group = new QButtonGroup(this); _group->setGeometry(0, 0, 0, 0); // type = kCCraps, kCSeven, kCEleven, kCDuece, kCAorB _group->insert(Prop1,0); // any craps _group->insert(Prop2,1); // any seven _group->insert(Prop3,2); // eleven _group->insert(Prop4,3); // ace duece _group->insert(Prop5,4); // aces or boxcars setFixedSize(420,335); }
/** * @brief Constructor for the GameBoard class sets the Central Widget of the MainWindow to the game board. * @param parent Central Widget * @param jellies_speed the speed of the jellies * @param lvl game level * */ GameBoard::GameBoard(QWidget *parent, size_t jellies_speed, unsigned int lvl) : QWidget(parent), ui(new Ui::GameBoard), jellies_speed(jellies_speed), level(lvl) { ui->setupUi(this); // Create the top widget, that will Top = new QWidget; // This code creates the Top bar // Level: # Timer: # Top->setFixedSize(450,40); // set style of the top bar Top->setStyleSheet("QLabel{ font-family: Odin Rounded; font-size: 18px; color: white; }"); // Create the top bar QHBoxLayout *top_bar = new QHBoxLayout(Top); // top_bar layout is used to space the elements from the Top Widget and the _Board Widget. // Level: # QLabel* level_text = new QLabel("Level: "); level_value = new QLabel(QString::number(level)); // level is either 1, 2 or 3 // Add the level widgets to the Top bar top_bar->addWidget(level_text); top_bar->addWidget(level_value); // Add in horizontal space before the next labels QSpacerItem* horizontal_space = new QSpacerItem(200,10); // Add the horizontal space to the top_bar layout top_bar->addSpacerItem(horizontal_space); // Level: # Timer: # QLabel* time_text = new QLabel("Timer: "); time_value = new QLabel(QString::number(0)); // start at 0 seconds top_bar->addWidget(time_text); top_bar->addWidget(time_value); // Create the Board Board = new QWidget; Board->setFixedSize(450,450); // Now we piece everything together // Central Widget is composed of Top and Board // Top // -------- // Board // Do not allow board to be resized, otherwise spacings get messed up setFixedSize(550,550); // Create a vertical box layout for the two pieces QVBoxLayout *piece_together = new QVBoxLayout; piece_together->addWidget(Top,0,Qt::AlignCenter); piece_together->addWidget(Board,0,Qt::AlignCenter); QPushButton* quit = new QPushButton("Quit"); quit->setFixedSize(450, 30); QObject::connect(quit, SIGNAL(clicked()), parent, SLOT(game_over())); piece_together->addWidget(quit,0,Qt::AlignCenter); this->setLayout(piece_together); // **************** Everything is now pieced together ****************************** // **************** We now draw the user box and the angry jellies ************** // Set user box position to be in the middle of the larger square x_player_jelly = 155; y_player_jelly = 155; // Number of colored jellies number_jellies = 4; x_jellies = new double[number_jellies]; y_jellies = new double[number_jellies]; width_jellies = new double[number_jellies] ; height_jellies = new double[number_jellies]; // Set first jelly size and starting positions x_jellies[0] = 220.0; y_jellies[0] = 280.0; width_jellies[0] = 60.0; height_jellies[0] = 50.0; // Set second jelly size and starting positions x_jellies[1] = 250.0; y_jellies[1] = 10.0; width_jellies[1] = 100.0; height_jellies[1] = 40.0; // Set third jelly size and starting positions x_jellies[2] = 20.0; y_jellies[2] = 20.0; width_jellies[2] = 30.0; height_jellies[2] = 60.0; // Set fourth jelly size and starting positions x_jellies[3] = 20.0; y_jellies[3] = 270.0; width_jellies[3] = 50.0; height_jellies[3] = 60.0; // set the moving directions of the jellies dirx_jellies = new double[4]; diry_jellies = new double[4]; // set the x moving directions for the four jellies dirx_jellies[0] = 1; dirx_jellies[1] = 1; dirx_jellies[2] = 1; dirx_jellies[3] = 1; // set the y moving directions for the four jellies diry_jellies[0] = 1; diry_jellies[1] = 1; diry_jellies[2] = 1; diry_jellies[3] = 1; // set images // **************** CHANGE FILE PATH OF THE IMAGES HERE **************/ // QString fileName(":/images/black_blank.jpg"); // set the player's jelly image QString fileName(":/images/black_blank.png"); player_jelly_image = new QPixmap(fileName); // set the images for the monsters jelly_image_0 = new QPixmap(":/images/yellow_blank.png"); jelly_image_1 = new QPixmap(":/images/green_blank.png"); jelly_image_2 = new QPixmap(":/images/red_blank.png"); jelly_image_3 = new QPixmap(":/images/blue_blank.png"); // set background images large_square_border = new QPixmap(":/images/jelly_background.jpg"); large_square = new QPixmap(":/images/border.png"); larger_square_border = new QPixmap(":/images/border.png"); /*** create the alert box to be displayed when the game is over ***/ GameOver = new QDialog(this); QVBoxLayout *gameover_layout = new QVBoxLayout(GameOver); GameOver_text = new QLabel; GameOver_text->setStyleSheet("QLabel{ color: white; font: 20px Odin Rounded, sans-serif; }"); GameOver_pushbutton = new QPushButton("Ok"); GameOver_pushbutton->setStyleSheet("QPushButton{ background-color: white; color: blue; font: 20px Odin Rounded, sans-serif; }"); GameOver_pushbutton->setFixedSize(50,25); gameover_layout->addWidget(GameOver_text,0,Qt::AlignCenter); gameover_layout->addWidget(GameOver_pushbutton, 0,Qt::AlignCenter); /*** change image path here ***/ // set image with the instructions GameOver->setStyleSheet("QDialog{ border-image: url(:/images/jellies.jpg);}"); /*** prepare game settings and slots ***/ // set score and seconds to 0, since player has not started to play seconds = 0; score = ""; // connect the _game_over() signal of the GameBoard class to the game_over() function from the MainWindow class connect(this, SIGNAL(_game_over()), parent, SLOT(game_over())); // connect the _unlock_medium() signal of the GameBoard class to the unlock_medium() function from the MainWindow class connect(this, SIGNAL(_unlock_medium()), parent, SLOT(unlock_medium())); // connect the _unlock_hard() signal of the GameBoard class to the unlock_hard() function from the MainWindow class connect(this, SIGNAL(_unlock_hard()), parent, SLOT(unlock_hard())); // connect easy, medium and hard game signals of the GameBoard class to the easy, medium and hard game signals from the MainWindow class // this will enable going from a level to the next connect(this, SIGNAL(_medium_game()), parent, SLOT(on_Medium_clicked())); connect(this, SIGNAL(_hard_game()), parent, SLOT(on_Hard_clicked())); // game has not started yet game_on = 0; // prepare to move jellies timer = new QTimer(this); connect(timer, SIGNAL(timeout()), this, SLOT(move_jellies())); // prepare chronometer time = new QElapsedTimer(); }
Klavishi::Klavishi(QWidget*parent) :QWidget(parent) { setWindowTitle("RDM-11");// выбираем название окна setFixedSize(490,240); // устанавливаем размер окна //setStyleSheet(AlignHCenter); //setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding); setAutoFillBackground(true); akkum = new QProgressBar; akkum->setFixedSize(60,15); akkum->setValue(24); label = new QLabel("11:16 23.05.2013"); picture.load(":/im/image1.jpg"); picture_multichannel.load(":/im/imag.jpg"); picture_singlechannel.load(":/im/ima.jpg"); handle =new QPushButton(tr("Настройки"));// делаем кнопку для калибровки handle->setIcon(picture); handle->setIconSize(picture.size()); translator =new QTranslator; multichannel = new QPushButton(tr("Сплошной режим")); // делаем кнопку для многоканального multichannel->setIcon(picture_multichannel); multichannel->setIconSize(picture_multichannel.size()); singlechannel = new QPushButton(tr("Одноканальный")); // делаем кнопку для singlechannel->setIcon(picture_singlechannel); singlechannel->setIconSize(picture_singlechannel.size()); frame_handle = new QFrame; frame_multichannel = new QFrame; frame_singlechannel = new QFrame; frame_akkum =new QFrame; connect(handle,SIGNAL(clicked()),SLOT(handle_channel())); connect(multichannel,SIGNAL(clicked()),SLOT(multi_channel())); connect(singlechannel,SIGNAL(clicked()),SLOT(single_channel())); //pal_1.setBrush(QPalette::Background,Qt::white); //frame_handle->setPalette(pal_1); frame_handle->setAutoFillBackground(true); frame_handle->setFixedSize(170,120); frame_handle->setLayout(new QVBoxLayout()); frame_handle->layout()->addWidget(handle); //frame_handle->layout()->addWidget(label); frame_akkum->setAutoFillBackground(true); frame_akkum->setFixedSize(150,40); frame_akkum->setLayout(new QHBoxLayout()); frame_akkum->layout()->addWidget(akkum); frame_akkum->layout()->addWidget(label); //frame_multichannel->setPalette(pal_1); frame_multichannel->setAutoFillBackground(true); frame_multichannel->setFixedSize(250,120); frame_multichannel->setLayout(new QVBoxLayout()); frame_multichannel->layout()->addWidget(multichannel); //frame_singlechannel->setPalette(pal_1); frame_singlechannel->setAutoFillBackground(true); frame_singlechannel->setLayout(new QVBoxLayout()); frame_singlechannel->setFixedSize(190,120); frame_singlechannel->layout()->addWidget(singlechannel); translator =new QTranslator; QVBoxLayout * mainLayout = new QVBoxLayout; mainLayout->setMargin(0); mainLayout->setSpacing(0); mainLayout->addSpacing(-50); QHBoxLayout * phbxLayout = new QHBoxLayout; phbxLayout->setMargin(0); phbxLayout->addSpacing(0); QHBoxLayout * layout_handle=new QHBoxLayout; layout_handle->addWidget(frame_handle); layout_handle->setAlignment(Qt::AlignLeft); QHBoxLayout * layout_multichannel=new QHBoxLayout; layout_multichannel->addWidget(frame_multichannel); layout_multichannel->setAlignment(Qt::AlignCenter); //layout_multichannel->addStretch(0); QHBoxLayout *layout_singlechannel=new QHBoxLayout; layout_singlechannel->addWidget(frame_singlechannel); layout_singlechannel->setAlignment(Qt::AlignRight); QHBoxLayout * layout_akkum = new QHBoxLayout; layout_akkum->addWidget(frame_akkum); layout_akkum->setAlignment(Qt::AlignRight); phbxLayout->addLayout(layout_handle); phbxLayout->addLayout(layout_multichannel); phbxLayout->addLayout(layout_singlechannel); mainLayout->addLayout(layout_akkum); mainLayout->addLayout(phbxLayout); setLayout(mainLayout); }
void GUIView::initialize() { setFixedSize(840, 700); setWindowTitle("GUIView"); srcRect.setRect(0,0,640,480); frontCameraRect.setRect(0,0,320,240); downCameraRect.setRect(320,0,320,240); //frontCameraImage = QImage(":/img/MDA.jpg"); //Creating an image that holds a gradient of blue //Create an image to be painted on QImage sub(640,480,QImage::Format_RGB32); //Setup the painter to paint/draw on the image QPainter subImgPainter; subImgPainter.begin(&sub); //Paint on that image //Create the gradient QLinearGradient blueGradient(0,0,640,480); //Set the starting color and end colors blueGradient.setColorAt(0.0,QColor(62,58,200));// 0.0 is start position as a qreal blueGradient.setColorAt(1.0,QColor(175,80,255)); //1.0 is end position as a qreal //Create a brush from the gradient (to paint with) QBrush blueGradientBrush(blueGradient); //Use the brush //subImgPainter.fillRect(sub.rect(), blueGradientBrush); //subImgPainter.end(); downCameraImage = sub; // Show Case View Widget initialization powerStatus = new QLabel("Power: Off"); powerButton = new QPushButton("Turn Power On/Off"); powerButton->setCheckable(true); motorButton = new QPushButton("Turn Motors On"); movement = new QLabel("Movement"); leftButton = new QPushButton("Veer Left"); rightButton = new QPushButton("Veer right"); forwardButton = new QPushButton("Move Forward"); backwardButton = new QPushButton("Move Backward"); sinkButton = new QPushButton("Sink"); riseButton = new QPushButton("Rise"); stopButton = new QPushButton("Stop"); specialActions = new QLabel("Special Actions"); surfaceButton = new QPushButton("Surface"); gateButton = new QPushButton("Gate Task"); pathButton = new QPushButton("Path Task"); systemActions = new QLabel("System Actions"); menuButton = new QPushButton("Menu"); exitButton = new QPushButton("Exit"); depthReading = new QLabel("Depth:"); yawReading = new QLabel("Yaw:"); targetDepthLabel = new QLabel("Target:"); targetYawLabel = new QLabel("Target:"); // Show Case View layouts QVBoxLayout *verticalLayout = new QVBoxLayout(); QHBoxLayout *mainLayout = new QHBoxLayout(this); QGridLayout *readingsLayout = new QGridLayout(); //Show Case view Widget Positioning //Down want to add rects from view to layout //What to do? : set other BoxLayouts and add spacing? verticalLayout->addWidget(powerStatus); verticalLayout->addWidget(powerButton); verticalLayout->addWidget(motorButton); verticalLayout->addSpacing(10); verticalLayout->addWidget(movement); verticalLayout->addWidget(leftButton); verticalLayout->addWidget(rightButton); verticalLayout->addWidget(sinkButton); verticalLayout->addWidget(riseButton); verticalLayout->addWidget(forwardButton); verticalLayout->addWidget(backwardButton); verticalLayout->addWidget(stopButton); verticalLayout->addSpacing(10); //Spacing size of 20 pixels verticalLayout->addWidget(specialActions); verticalLayout->addWidget(surfaceButton); verticalLayout->addWidget(gateButton); verticalLayout->addWidget(pathButton); verticalLayout->addSpacing(10); //Spacing size of 20 pixels verticalLayout->addWidget(systemActions); verticalLayout->addWidget(menuButton); verticalLayout->addWidget(exitButton); verticalLayout->addSpacing(10); readingsLayout->addWidget(yawReading, 0, 0, Qt::AlignLeft); readingsLayout->addWidget(targetYawLabel, 0, 1, Qt::AlignLeft); readingsLayout->addWidget(depthReading, 1, 0, Qt::AlignLeft); readingsLayout->addWidget(targetDepthLabel, 1, 1, Qt::AlignLeft); verticalLayout->addLayout(readingsLayout); mainLayout->addSpacing(1280); mainLayout->addLayout(verticalLayout); this->setLayout(mainLayout); // Setup connections connect(powerButton, SIGNAL(clicked()), controller, SLOT(handlePowerButtonToggled())); connect(motorButton, SIGNAL(clicked()), controller, SLOT(handleMotorButtonClick())); connect(leftButton, SIGNAL(clicked()), controller, SLOT(handleMoveLeftButtonClick())); connect(rightButton, SIGNAL(clicked()), controller, SLOT(handleMoveRightButtonClick())); connect(sinkButton, SIGNAL(clicked()), controller, SLOT(handleSinkButtonClick())); connect(riseButton, SIGNAL(clicked()), controller, SLOT(handleRiseButtonClick())); connect(forwardButton, SIGNAL(clicked()), controller, SLOT(handleMoveForwardButtonClick())); connect(backwardButton, SIGNAL(clicked()), controller, SLOT(handleMoveBackwardButtonClick())); connect(stopButton, SIGNAL(clicked()), controller, SLOT(handleStopButtonClick())); connect(gateButton, SIGNAL(clicked()), controller, SLOT(handleGateTaskClick())); connect(pathButton, SIGNAL(clicked()), controller, SLOT(handlePathTaskClick())); connect(menuButton, SIGNAL(clicked()), stage, SLOT(switchToMenuView())); connect(exitButton, SIGNAL(clicked()), stage, SLOT(exit())); }
memory_viewer_panel::memory_viewer_panel(QWidget* parent) : QDialog(parent) { setWindowTitle(tr("Memory Viewer")); setAttribute(Qt::WA_DeleteOnClose); exit = false; m_addr = 0; m_colcount = 16; m_rowcount = 16; pSize = 10; //Font and Colors mono = QFontDatabase::systemFont(QFontDatabase::FixedFont); mono.setPointSize(pSize); fontMetrics = new QFontMetrics(mono); pal_bg.setColor(QPalette::Background, QColor(240, 240, 240)); setPalette(pal_bg); //Layout: QVBoxLayout* vbox_panel = new QVBoxLayout(); //Tools QHBoxLayout* hbox_tools = new QHBoxLayout(); //Tools: Memory Viewer Options QGroupBox* tools_mem = new QGroupBox(tr("Memory Viewer Options")); QHBoxLayout* hbox_tools_mem = new QHBoxLayout(); //Tools: Memory Viewer Options: Address QGroupBox* tools_mem_addr = new QGroupBox(tr("Address")); QHBoxLayout* hbox_tools_mem_addr = new QHBoxLayout(); t_addr = new QLineEdit(this); t_addr->setPlaceholderText("00000000"); t_addr->setFont(mono); t_addr->setMaxLength(8); t_addr->setFixedWidth(75); t_addr->setFocus(); hbox_tools_mem_addr->addWidget(t_addr); tools_mem_addr->setLayout(hbox_tools_mem_addr); //Tools: Memory Viewer Options: Bytes QGroupBox* tools_mem_bytes = new QGroupBox(tr("Bytes")); QHBoxLayout* hbox_tools_mem_bytes = new QHBoxLayout(); sb_bytes = new QSpinBox(this); sb_bytes->setRange(1, 16); sb_bytes->setValue(16); hbox_tools_mem_bytes->addWidget(sb_bytes); tools_mem_bytes->setLayout(hbox_tools_mem_bytes); //Tools: Memory Viewer Options: Control QGroupBox* tools_mem_buttons = new QGroupBox(tr("Control")); QHBoxLayout* hbox_tools_mem_buttons = new QHBoxLayout(); QPushButton* b_fprev = new QPushButton("<<", this); QPushButton* b_prev = new QPushButton("<", this); QPushButton* b_next = new QPushButton(">", this); QPushButton* b_fnext = new QPushButton(">>", this); b_fprev->setFixedWidth(20); b_prev->setFixedWidth(20); b_next->setFixedWidth(20); b_fnext->setFixedWidth(20); b_fprev->setAutoDefault(false); b_prev->setAutoDefault(false); b_next->setAutoDefault(false); b_fnext->setAutoDefault(false); hbox_tools_mem_buttons->addWidget(b_fprev); hbox_tools_mem_buttons->addWidget(b_prev); hbox_tools_mem_buttons->addWidget(b_next); hbox_tools_mem_buttons->addWidget(b_fnext); tools_mem_buttons->setLayout(hbox_tools_mem_buttons); //Merge Tools: Memory Viewer hbox_tools_mem->addWidget(tools_mem_addr); hbox_tools_mem->addWidget(tools_mem_bytes); hbox_tools_mem->addWidget(tools_mem_buttons); tools_mem->setLayout(hbox_tools_mem); //Tools: Raw Image Preview Options QGroupBox* tools_img = new QGroupBox(tr("Raw Image Preview Options")); QHBoxLayout* hbox_tools_img = new QHBoxLayout();; //Tools: Raw Image Preview Options : Size QGroupBox* tools_img_size = new QGroupBox(tr("Size")); QHBoxLayout* hbox_tools_img_size = new QHBoxLayout(); QLabel* l_x = new QLabel(" x "); sb_img_size_x = new QSpinBox(this); sb_img_size_y = new QSpinBox(this); sb_img_size_x->setRange(1, 8192); sb_img_size_y->setRange(1, 8192); sb_img_size_x->setValue(256); sb_img_size_y->setValue(256); hbox_tools_img_size->addWidget(sb_img_size_x); hbox_tools_img_size->addWidget(l_x); hbox_tools_img_size->addWidget(sb_img_size_y); tools_img_size->setLayout(hbox_tools_img_size); //Tools: Raw Image Preview Options: Mode QGroupBox* tools_img_mode = new QGroupBox(tr("Mode")); QHBoxLayout* hbox_tools_img_mode = new QHBoxLayout(); cbox_img_mode = new QComboBox(this); cbox_img_mode->addItem("RGB"); cbox_img_mode->addItem("ARGB"); cbox_img_mode->addItem("RGBA"); cbox_img_mode->addItem("ABGR"); cbox_img_mode->setCurrentIndex(1); //ARGB hbox_tools_img_mode->addWidget(cbox_img_mode); tools_img_mode->setLayout(hbox_tools_img_mode); //Merge Tools: Raw Image Preview Options hbox_tools_img->addWidget(tools_img_size); hbox_tools_img->addWidget(tools_img_mode); tools_img->setLayout(hbox_tools_img); //Tools: Tool Buttons QGroupBox* tools_buttons = new QGroupBox(tr("Tools")); QVBoxLayout* hbox_tools_buttons = new QVBoxLayout(this); QPushButton* b_img = new QPushButton(tr("View\nimage"), this); b_img->setAutoDefault(false); hbox_tools_buttons->addWidget(b_img); tools_buttons->setLayout(hbox_tools_buttons); //Merge Tools = Memory Viewer Options + Raw Image Preview Options + Tool Buttons hbox_tools->addSpacing(10); hbox_tools->addWidget(tools_mem); hbox_tools->addWidget(tools_img); hbox_tools->addWidget(tools_buttons); hbox_tools->addSpacing(10); //Memory Panel: QHBoxLayout* hbox_mem_panel = new QHBoxLayout(); //Memory Panel: Address Panel t_mem_addr = new QLabel(""); t_mem_addr->setFont(mono); t_mem_addr->setAutoFillBackground(true); t_mem_addr->setTextInteractionFlags(Qt::TextSelectableByMouse | Qt::TextSelectableByKeyboard); QPalette palette_addr = t_mem_addr->palette(); palette_addr.setColor(t_mem_addr->backgroundRole(), QColor(240, 240, 240)); palette_addr.setColor(t_mem_addr->foregroundRole(), QColor(75, 135, 150)); t_mem_addr->setPalette(palette_addr); //Memory Panel: Hex Panel t_mem_hex = new QLabel(""); t_mem_hex->setFont(mono); t_mem_hex->setAutoFillBackground(true); t_mem_hex->setTextInteractionFlags(Qt::TextSelectableByMouse | Qt::TextSelectableByKeyboard); QPalette palette_hex = t_mem_hex->palette(); palette_hex.setColor(t_mem_hex->backgroundRole(), QColor(240, 240, 240)); palette_hex.setColor(t_mem_hex->foregroundRole(), Qt::black); t_mem_hex->setPalette(palette_hex); //Memory Panel: ASCII Panel t_mem_ascii = new QLabel(""); t_mem_ascii->setFont(mono); t_mem_ascii->setAutoFillBackground(true); t_mem_ascii->setTextInteractionFlags(Qt::TextSelectableByMouse | Qt::TextSelectableByKeyboard); QPalette palette_ascii = t_mem_ascii->palette(); palette_ascii.setColor(t_mem_ascii->backgroundRole(), QColor(240, 240, 240)); palette_ascii.setColor(t_mem_ascii->foregroundRole(), Qt::black); t_mem_ascii->setPalette(palette_ascii); //Merge Memory Panel: hbox_mem_panel->setAlignment(Qt::AlignLeft); hbox_mem_panel->addSpacing(20); hbox_mem_panel->addWidget(t_mem_addr); hbox_mem_panel->addSpacing(10); hbox_mem_panel->addWidget(t_mem_hex); hbox_mem_panel->addSpacing(10); hbox_mem_panel->addWidget(t_mem_ascii); hbox_mem_panel->addSpacing(10); //Memory Panel: Set size of the QTextEdits t_mem_hex->setFixedSize(QSize(pSize * 3 * m_colcount + 6, 228)); t_mem_ascii->setFixedSize(QSize(pSize * m_colcount + 6, 228)); //Set Margins to adjust WindowSize vbox_panel->setContentsMargins(0, 0, 0, 0); hbox_tools->setContentsMargins(0, 0, 0, 0); tools_mem_addr->setContentsMargins(0, 10, 0, 0); tools_mem_bytes->setContentsMargins(0, 10, 0, 0); tools_mem_buttons->setContentsMargins(0, 10, 0, 0); tools_img_mode->setContentsMargins(0, 10, 0, 0); tools_img_size->setContentsMargins(0, 10, 0, 0); tools_mem->setContentsMargins(0, 10, 0, 0); tools_img->setContentsMargins(0, 10, 0, 0); tools_buttons->setContentsMargins(0, 10, 0, 0); hbox_mem_panel->setContentsMargins(0, 0, 0, 0); //Merge and display everything vbox_panel->addSpacing(10); vbox_panel->addLayout(hbox_tools); vbox_panel->addSpacing(10); vbox_panel->addLayout(hbox_mem_panel); vbox_panel->addSpacing(10); setLayout(vbox_panel); //Events connect(t_addr, &QLineEdit::returnPressed, [=](){ bool ok; m_addr = t_addr->text().toULong(&ok, 16); t_addr->setText(QString("%1").arg(m_addr, 8, 16, QChar('0'))); // get 8 digits in input line ShowMemory(); }); connect(sb_bytes, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), [=](){ m_colcount = sb_bytes->value(); t_mem_hex->setFixedSize(QSize(pSize * 3 * m_colcount + 6, 228)); t_mem_ascii->setFixedSize(QSize(pSize * m_colcount + 6, 228)); ShowMemory(); }); connect(b_prev, &QAbstractButton::clicked, [=]() { m_addr -= m_colcount; ShowMemory(); }); connect(b_next, &QAbstractButton::clicked, [=]() { m_addr += m_colcount; ShowMemory(); }); connect(b_fprev, &QAbstractButton::clicked, [=]() { m_addr -= m_rowcount * m_colcount; ShowMemory(); }); connect(b_fnext, &QAbstractButton::clicked, [=]() { m_addr += m_rowcount * m_colcount; ShowMemory(); }); connect(b_img, &QAbstractButton::clicked, [=]() { u32 addr = m_addr; int mode = cbox_img_mode->currentIndex(); int sizex = sb_img_size_x->value(); int sizey = sb_img_size_y->value(); ShowImage(this, m_addr, mode, sizex, sizey, false); }); //Fill the QTextEdits ShowMemory(); setFixedSize(sizeHint()); };
TrainDialog::TrainDialog(QWidget *parent) : QDialog(parent), ui(new Ui::TrainDialog) { ui->setupUi(this); setFixedSize(width(), height()); }
CreateGroup::CreateGroup(QStringList items, QWidget *parent) : THWidgetBase(parent) { setAttribute(Qt::WA_DeleteOnClose); setFixedSize(380, 250); setTitleBarWidth(380); setWindowFlags(Qt::FramelessWindowHint | Qt::Tool); setWindowModality(Qt::ApplicationModal); bar->setBarButtons(HappyTitleBar::MinButtonHint); bar->setBarButtons(HappyTitleBar::MaxButtonHint); bar->setExtraButtonVisible(false); bar->setBarIcon(":res/happy.png"); bar->setBarContent(cn("创建群/讨论组")); connect(bar, &HappyTitleBar::signalClose, this, [=] () { this->close(); }); QVBoxLayout *v= new QVBoxLayout(); v->setContentsMargins(0, 0, 0, 0); QHBoxLayout *h = new QHBoxLayout(); h->setContentsMargins(0, 0, 0, 0); QVBoxLayout *v1= new QVBoxLayout(); v1->setContentsMargins(0, 0, 0, 0); QVBoxLayout *v2= new QVBoxLayout(); v2->setContentsMargins(0, 0, 0, 0); EmojiLabel *photo = new EmojiLabel(this); photo->setMoiveRes(":res/ui3/default_group_create.gif"); photo->setMovieable(true); photo->setFixedSize(70, 70); photo->setStyleSheet(cns("QLabel{border-width:1px;border-style:solid;border-radius:3px;border-color:transparent;" "background:transparent;}" "QLabel:hover{border-width:1px;border-style:solid;border-radius:3px;border-color:white;}" "QLabel:pressed{border-width:1px;border-style:solid;border-radius:3px;border-color:rgba(240,240,240,50);}")); QLabel *lbl1 = new QLabel(cn("修改群图片(点击)"), this); lbl1->setStyleSheet(QStringLiteral("font-family:微软雅黑;font:12px;color:white;")); QPushButton *pb1 = new QPushButton(cn("从表情库中选择"), this); pb1->setFixedWidth(120); v1->addWidget(photo, 8, Qt::AlignCenter); v1->addWidget(lbl1, 1, Qt::AlignCenter); v1->addWidget(pb1, 1, Qt::AlignCenter); QLineEdit *edit1 = new QLineEdit(this); edit1->setAlignment(Qt::AlignCenter); edit1->setFixedWidth(180); edit1->setPlaceholderText(cn("输入群/讨论组名称")); QLineEdit *edit2 = new QLineEdit(this); edit2->setText(cn("讨论组")); edit2->setReadOnly(true); edit2->setAlignment(Qt::AlignCenter); edit2->setFixedWidth(180); edit2->setPlaceholderText(cn("选择属性")); HappyTextEdit *edit3 = new HappyTextEdit(this); edit3->setPlaceholderText(cn("写点什么吧,这群是干啥的")); edit3->setFixedWidth(180); v2->addWidget(edit1, 1, Qt::AlignCenter); v2->addWidget(edit2, 1, Qt::AlignCenter); v2->addWidget(edit3, 8, Qt::AlignCenter); h->addLayout(v1, 2); h->addLayout(v2, 3); QHBoxLayout *h1 = new QHBoxLayout(); h1->setContentsMargins(55, 0, 0, 10); QPushButton *selectPb = new QPushButton(cn("选择成员"), this); selectPb->setCheckable(true); selectPb->setFixedWidth(70); QPushButton *confirmPb = new QPushButton(cn("确定"), this); confirmPb->setFixedWidth(50); QPushButton *cancelPb = new QPushButton(cn("取消"), this); cancelPb->setFixedWidth(50); h1->addStretch(7); h1->addWidget(selectPb); h1->addWidget(confirmPb); h1->addWidget(cancelPb); h1->addStretch(1); v->addLayout(h, 9); v->addLayout(h1, 1); QHBoxLayout *h2 = new QHBoxLayout(this); h2->setContentsMargins(5, 35, 5, 10); CheckList *list = new CheckList(this); list->setFixedSize(120, 195); list->setVisible(false); h2->addLayout(v, 5); h2->addWidget(list, 1, Qt::AlignHCenter | Qt::AlignTop); h2->addSpacing(15); QFile file; file.setFileName(":res/css/lineedit.css"); if (file.open(QIODevice::ReadOnly)) { QByteArray ba = file.readAll(); edit1->setStyleSheet(QTextCodec::codecForLocale()->toUnicode(ba)); edit2->setStyleSheet(QTextCodec::codecForLocale()->toUnicode(ba)); } file.close(); file.setFileName(":res/css/button2.css"); if (file.open(QIODevice::ReadOnly)) { QByteArray ba = file.readAll(); pb1->setStyleSheet(QTextCodec::codecForLocale()->toUnicode(ba)); selectPb->setStyleSheet(QTextCodec::codecForLocale()->toUnicode(ba)); confirmPb->setStyleSheet(QTextCodec::codecForLocale()->toUnicode(ba)); cancelPb->setStyleSheet(QTextCodec::codecForLocale()->toUnicode(ba)); } file.close(); file.setFileName(":res/css/list2.css"); if (file.open(QIODevice::ReadOnly)) { QByteArray ba = file.readAll(); list->setStyleSheet(QTextCodec::codecForLocale()->toUnicode(ba)); } file.close(); // load data ConfigureData *conf = ConfigureData::getInstance(); updateColor(conf->getColorIni("color1"), conf->getColorIni("color2")); list->setmyuid(conf->getUuid()); list->addCheckItems(items); connect(confirmPb, &QPushButton::clicked, this, [=] () { QString name = edit1->text(); if (name.trimmed().isEmpty()) { MsgBox::ShowMsgBox(cn("错误"), cn("不能使用空的名称"), cn("确定")); return; } QString attr = edit2->text(); QString des = edit3->toPlainText(); if (des.trimmed().isEmpty()) { int rlt = MsgBox::ShowMsgBox(cn("提示"), cn("真的不写点什么?"), cn("不写了"), cn("那写点")); if (rlt != 0) return; } QString uids = list->checkedids(); if (uids.split(";").size() <= 1) { int rlt = MsgBox::ShowMsgBox(cn("提示"), cn("这个组里面只有你一个人\n" "确定创建这个寂寞的群组么?"), cn("确定"), cn("去选人")); if (rlt == 1) { selectPb->setChecked(true); return; } } // check image QString newPhotoName = photo->ImagePath(); QString path = GetWorkPath() + "/face"; if (QDir().mkpath(path)) { QFile file; file.setFileName(newPhotoName); if (file.exists()) { QString temp = path + "/" + QFileInfo(newPhotoName).fileName(); if (QFile::exists(temp)) { newPhotoName = temp; } else { bool b = file.copy(temp); if (b) newPhotoName = temp; } } file.close(); } // 创建数据 GroupData gd; gd.setName(name); gd.setAttr(attr); gd.setGroupdescribe(des); gd.setPhoto(newPhotoName); gd.setGroupmember(uids); gd.setUid(getUuid()); gd.setDeleteable(true); gd.setEditable(true); QDateTime dt = QDateTime::currentDateTime(); gd.setCreationtime(dt.toString("yyyy-MM-dd hh:mm:ss")); gd.setUpdatetime(dt.toTime_t()); gd.setCreator(conf->getIni("nickname")); gd.setPort(qrand() % 10000 + 20000); gd.setNetmask(createNetmask()); emit confrimCreate(gd); close(); }); connect(cancelPb, &QPushButton::clicked, this, [=] () { emit bar->signalClose(); }); connect(selectPb, &QPushButton::toggled, this, [=] (bool b) { if (b) { setFixedWidth(480); setTitleBarWidth(480); } else { setFixedWidth(380); setTitleBarWidth(380); } list->setVisible(b); }); connect(this, &CreateGroup::updateItems, list, &CheckList::addCheckItems); connect(pb1, &QPushButton::clicked, this, [=] () { EmotionsBox *box = EmotionsBox::GetInstance(); box->show(); box->activateWindow(); QPoint p = QCursor::pos(); box->move(p.x() - box->width() / 2, p.y() - 20 - box->height()); connect(box, &EmotionsBox::select, this, [=] (QString str) { photo->setMoiveRes(str); }); connect(box, &EmotionsBox::signalHide, this, [=] () { disconnect(box, &EmotionsBox::signalHide, 0, 0); disconnect(box, &EmotionsBox::select, 0, 0); }); }); connect(photo, &EmojiLabel::clicked, this, [=] () { QString filter = cns("图片资源(*.jpg *.gif *.png*.bmp);;全部文件(*.*)"); QString path = QFileDialog::getOpenFileName(this, QStringLiteral("选择图片"), ".", filter); if (!QFileInfo(path).isFile() && !QImageReader(path).canRead()) { MsgBox::ShowMsgBox(cn("错误"), cn("不是有效的文件"), cn("确定")); return; } photo->setMoiveRes(path); }); }
BitcrushControlDialog::BitcrushControlDialog( BitcrushControls * controls ) : EffectControlDialog( controls ) { setAutoFillBackground( true ); QPalette pal; pal.setBrush( backgroundRole(), PLUGIN_NAME::getIconPixmap( "artwork" ) ); setPalette( pal ); setFixedSize( 181, 128 ); // labels QLabel * inLabel = new QLabel( tr( "IN" ), this ); inLabel->move( 24, 15 ); QLabel * outLabel = new QLabel( tr( "OUT" ), this ); outLabel->move( 139, 15 ); // input knobs Knob * inGain = new Knob( knobBright_26, this ); inGain->move( 16, 32 ); inGain->setModel( & controls->m_inGain ); inGain->setLabel( tr( "GAIN" ) ); inGain->setHintText( tr( "Input gain:" ) , " dBFS" ); Knob * inNoise = new Knob( knobBright_26, this ); inNoise->move( 14, 76 ); inNoise->setModel( & controls->m_inNoise ); inNoise->setLabel( tr( "NOISE" ) ); inNoise->setHintText( tr( "Input noise:" ) , "%" ); // output knobs Knob * outGain = new Knob( knobBright_26, this ); outGain->move( 138, 32 ); outGain->setModel( & controls->m_outGain ); outGain->setLabel( tr( "GAIN" ) ); outGain->setHintText( tr( "Output gain:" ) , " dBFS" ); Knob * outClip = new Knob( knobBright_26, this ); outClip->move( 138, 76 ); outClip->setModel( & controls->m_outClip ); outClip->setLabel( tr( "CLIP" ) ); outClip->setHintText( tr( "Output clip:" ) , "%" ); // leds LedCheckBox * rateEnabled = new LedCheckBox( "", this, tr( "Rate enabled" ), LedCheckBox::Green ); rateEnabled->move( 64, 14 ); rateEnabled->setModel( & controls->m_rateEnabled ); ToolTip::add( rateEnabled, tr( "Enable sample-rate crushing" ) ); LedCheckBox * depthEnabled = new LedCheckBox( "", this, tr( "Depth enabled" ), LedCheckBox::Green ); depthEnabled->move( 101, 14 ); depthEnabled->setModel( & controls->m_depthEnabled ); ToolTip::add( depthEnabled, tr( "Enable bit-depth crushing" ) ); // rate crushing knobs Knob * rate = new Knob( knobBright_26, this ); rate->move( 59, 32 ); rate->setModel( & controls->m_rate ); rate->setLabel( tr( "FREQ" ) ); rate->setHintText( tr( "Sample rate:" ) , " Hz" ); Knob * stereoDiff = new Knob( knobBright_26, this ); stereoDiff->move( 72, 76 ); stereoDiff->setModel( & controls->m_stereoDiff ); stereoDiff->setLabel( tr( "STEREO" ) ); stereoDiff->setHintText( tr( "Stereo difference:" ) , "%" ); // depth crushing knob Knob * levels = new Knob( knobBright_26, this ); levels->move( 92, 32 ); levels->setModel( & controls->m_levels ); levels->setLabel( tr( "QUANT" ) ); levels->setHintText( tr( "Levels:" ) , "" ); }
bool LoginDialog::event(QEvent *e) { if (e->type() == QEvent::LayoutRequest) setFixedSize(sizeHint()); return QDialog::event(e); }
Seperator::Seperator(QWidget *parent) : QLabel(parent) { setFixedSize(1, 16); }
void WSpinny::setup(QDomNode node, const SkinContext& context, QString group) { m_group = group; // Set images m_pBgImage = WImageStore::getImage(context.getSkinPath(context.selectString(node, "PathBackground"))); m_pFgImage = WImageStore::getImage(context.getSkinPath(context.selectString(node, "PathForeground"))); m_pGhostImage = WImageStore::getImage(context.getSkinPath(context.selectString(node, "PathGhost"))); if (m_pBgImage && !m_pBgImage->isNull()) { setFixedSize(m_pBgImage->size()); } #ifdef __VINYLCONTROL__ // Find the vinyl input we should listen to reports about. if (m_pVCManager) { m_iVinylInput = m_pVCManager->vinylInputFromGroup(m_group); } m_iVinylScopeSize = MIXXX_VINYL_SCOPE_SIZE; m_qImage = QImage(m_iVinylScopeSize, m_iVinylScopeSize, QImage::Format_ARGB32); // fill with transparent black m_qImage.fill(qRgba(0,0,0,0)); #endif m_pPlay = new ControlObjectThread( group, "play"); m_pPlayPos = new ControlObjectThread( group, "playposition"); m_pVisualPlayPos = VisualPlayPosition::getVisualPlayPosition(group); m_pTrackSamples = new ControlObjectThread( group, "track_samples"); m_pTrackSampleRate = new ControlObjectThread( group, "track_samplerate"); m_pScratch = new ControlObjectThread( group, "scratch2"); m_pScratchToggle = new ControlObjectThread( group, "scratch_position_enable"); m_pScratchPos = new ControlObjectThread( group, "scratch_position"); m_pSlipEnabled = new ControlObjectThread( group, "slip_enabled"); m_pSlipPosition = new ControlObjectThread( group, "slip_playposition"); #ifdef __VINYLCONTROL__ m_pVinylControlSpeedType = new ControlObjectThread( group, "vinylcontrol_speed_type"); if (m_pVinylControlSpeedType) { //Initialize the rotational speed. this->updateVinylControlSpeed(m_pVinylControlSpeedType->get()); } m_pVinylControlEnabled = new ControlObjectThread( group, "vinylcontrol_enabled"); connect(m_pVinylControlEnabled, SIGNAL(valueChanged(double)), this, SLOT(updateVinylControlEnabled(double))); m_pSignalEnabled = new ControlObjectThread( group, "vinylcontrol_signal_enabled"); connect(m_pSignalEnabled, SIGNAL(valueChanged(double)), this, SLOT(updateVinylControlSignalEnabled(double))); //Match the vinyl control's set RPM so that the spinny widget rotates at the same //speed as your physical decks, if you're using vinyl control. connect(m_pVinylControlSpeedType, SIGNAL(valueChanged(double)), this, SLOT(updateVinylControlSpeed(double))); #else //if no vinyl control, just call it 33 this->updateVinylControlSpeed(33.0); #endif }
/// ///Default constructor. /// DieWidget::DieWidget() { setFixedSize(40, 40); rolledNumber = 1; }
BoutonGoban::BoutonGoban(int a, int o, boost::shared_ptr<Goban> gobanPtr) : QPushButton(), abs(a), ord(o), m_goban(boost::weak_ptr<Goban>(gobanPtr)) { setFixedSize(gobanPtr->ECART(),gobanPtr->ECART()); setFlat(true); }
void ArchiveViewer::die(){ setFocusPolicy(Qt::NoFocus); setFixedSize(0, 0); }
LapsEditor::LapsEditor(bool isSwim) : isSwim(isSwim) { setWindowTitle(tr("Laps Editor")); HelpWhatsThis *help = new HelpWhatsThis(this); this->setWhatsThis(help->getWhatsThisText(HelpWhatsThis::MenuBar_Activity_Manual_LapsEditor)); #ifdef Q_OS_MAC setFixedSize(625,415); #else setFixedSize(630,420); #endif // // Create the GUI widgets // // Laps table const int nCols = 7; const int nRows = 100; tableWidget = new QTableWidget(nRows, nCols, this); QStringList hLabels; tableWidget->setColumnWidth(0, 48); for (int j = 1; j < nCols; j++) tableWidget->setColumnWidth(j, 88); hLabels<<tr("reps")<<tr("work dist")<< tr("work min")<<tr("work sec")<<tr("rest dist")<<tr("rest min")<<tr("rest sec"); tableWidget->setHorizontalHeaderLabels(hLabels); tableWidget->verticalHeader()->setVisible(false); for (int i = 0; i < nRows; i++) { QTableWidgetItemUInt *item = new QTableWidgetItemUInt(); item->setTextAlignment(Qt::AlignRight); item->setData(Qt::EditRole, 1); tableWidget->setItem(i, 0, item); for (int j = 1; j < nCols; j++) { QTableWidgetItem *item; if (!isSwim && (j == 1 || j == 4)) item = new QTableWidgetItemUDouble(); else item = new QTableWidgetItemUInt(); item->setTextAlignment(Qt::AlignRight); item->setData(Qt::EditRole, 0); tableWidget->setItem(i, j, item); } } // buttons okButton = new QPushButton(tr("&OK"), this); cancelButton = new QPushButton(tr("&Cancel"), this); // save by default -- we don't overwrite and // the user will expect enter to save laps okButton->setDefault(true); cancelButton->setDefault(false); // // LAY OUT THE GUI // QVBoxLayout *mainLayout = new QVBoxLayout(this); QHBoxLayout *table = new QHBoxLayout; mainLayout->addLayout(table); table->addWidget(tableWidget); QHBoxLayout *buttons = new QHBoxLayout; mainLayout->addLayout(buttons); buttons->addStretch(); buttons->addWidget(okButton); buttons->addWidget(cancelButton); // dialog buttons connect(okButton, SIGNAL(clicked()), this, SLOT(okClicked())); connect(cancelButton, SIGNAL(clicked()), this, SLOT(cancelClicked())); }
MapGrid::MapGrid(QRect ecran,QList<QPoint> *chemin,gestionnaire *gest,Joueur1 *Adversaire,QWidget *parent) : QWidget(parent), gesti(gest) { elapsed=0; // setFixedSize((ecran.width()-(ecran.width()/10)),ecran.height()); setFixedSize(ecran.width(),ecran.height()); this->showFullScreen(); setAutoFillBackground(false); m_ecran=ecran; m_chemin=chemin; newtower=1; phaseini=true; // mapx=(ecran.width()-(ecran.width()/10))/24; mapx=(int)(ecran.width()/24); mapy=(int)(ecran.height()/24); connect(this,SIGNAL(AjoutTour(int,int,int,QRect)),gesti,SLOT(ajouttour(int,int,int,QRect))); if(Adversaire->numero==2) { for(int i=0;i<24;i++) { for(int j=0;j<24;j++) { if(i<=12 && j<=24) { grido[i][j]=1; } else { grido[i][j]=0; } } } } else { for(int i=0;i<24;i++) { for(int j=0;j<24;j++) { if(i<=12 && j<=24) { grido[i][j]=0; } else { grido[i][j]=1; } } } } for(int i=0;i<24;i++) { grido[i][24]=0; } for(int i=0;i<m_chemin->size();i++) { grido[m_chemin->at(i).x()][m_chemin->at(i).y()]=0; } // for(int i=0;i<24;i++) // { // for(int j=0;j<24;j++) // { // if(i<=12 && j<=24) // { // grido[i][j]=1; // } // else // { // grido[i][j]=0; // } // } // } // for(int i=0;i<24;i++) // { // grido[i][24]=0; // } // for(int i=0;i<m_chemin->size();i++) // { // grido[m_chemin->at(i).x()][m_chemin->at(i).y()]=0; // } }
LabelFocusWidget::LabelFocusWidget(QWidget *parent, const char *name) : QWidget(parent, name) { setFocusPolicy(ClickFocus); setFixedSize(QSize(1, 1)); }
Ball::Ball(QWidget *parent) : QWidget(parent), _isInteractive(false), _pressed(false) { setFixedSize(BallSize); }
QtWindow::QtWindow(QWidget *parent) : QWidget(parent) { setFixedSize(WIN_WIDTH, WIN_HEIGHT); setWindowTitle(QString::fromUtf8("42 GkRellM - Graphical Mode")); }
toolBarButton::toolBarButton(QWidget *parent) { setFocusPolicy(Qt::NoFocus); setFixedSize(16,16); }