void MusicPlaylistFoundWidget::createPlaylistItem(const MusicResultsItem &item) { if(!m_firstInit) { delete m_statusLabel; m_statusLabel = nullptr; m_container->removeWidget(m_mainWindow); QScrollArea *scrollArea = new QScrollArea(this); scrollArea->setStyleSheet(MusicUIObject::MScrollBarStyle01); scrollArea->setWidgetResizable(true); scrollArea->setFrameShape(QFrame::NoFrame); scrollArea->setAlignment(Qt::AlignLeft); scrollArea->setWidget(m_mainWindow); m_container->addWidget(scrollArea); m_firstInit = true; QHBoxLayout *mainlayout = MStatic_cast(QHBoxLayout*, m_mainWindow->layout()); QWidget *containTopWidget = new QWidget(m_mainWindow); QHBoxLayout *containTopLayout = new QHBoxLayout(containTopWidget); containTopLayout->setContentsMargins(30, 0, 30, 0); m_categoryButton = new MusicPlaylistFoundCategoryPopWidget(m_mainWindow); m_categoryButton->setCategory(m_downloadThread->getQueryServer(), this); containTopLayout->addWidget(m_categoryButton); containTopLayout->addStretch(1); foreach(const QString &data, QStringList() << tr("Recommend") << tr("Top") << tr("Hot") << tr("New")) { QLabel *l = new QLabel(data, containTopWidget); l->setStyleSheet(QString("QLabel::hover{%1}").arg(MusicUIObject::MColorStyle08)); QFrame *hline = new QFrame(containTopWidget); hline->setFrameShape(QFrame::VLine); hline->setStyleSheet(MusicUIObject::MColorStyle06); containTopLayout->addWidget(l); containTopLayout->addWidget(hline); } containTopWidget->setLayout(containTopLayout); QFrame *line = new QFrame(m_mainWindow); line->setFrameShape(QFrame::HLine); line->setStyleSheet(MusicUIObject::MColorStyle06); QWidget *containWidget = new QWidget(m_mainWindow); m_gridLayout = new QGridLayout(containWidget); m_gridLayout->setVerticalSpacing(35); containWidget->setLayout(m_gridLayout); mainlayout->addWidget(containTopWidget); mainlayout->addWidget(line); mainlayout->addWidget(containWidget); m_pagingWidgetObject = new MusicPagingWidgetObject(m_mainWindow); connect(m_pagingWidgetObject, SIGNAL(mapped(int)), SLOT(buttonClicked(int))); int total = ceil(m_downloadThread->getPageTotal()*1.0/m_downloadThread->getPageSize()); mainlayout->addWidget(m_pagingWidgetObject->createPagingWidget(m_mainWindow, total)); mainlayout->addStretch(1); }
QFrame* MainWindow::initVideoFrame() { QFrame *frame = new QFrame(this); QVBoxLayout *layout = new QVBoxLayout(); player->setMinimumHeight(240); #ifdef MACOSX player->openImage(qApp->applicationDirPath().append("/../Resources/placeholder.jpg")); #else player->openImage(qApp->applicationDirPath().append("/placeholder.jpg")); #endif frame->setObjectName("video_frame"); frame->setStyleSheet("QFrame#video_frame { background: qlineargradient(x1:0.5, y1:0, x2:0.5, y2:1, stop:0 rgb(8, 9, 9), stop:0.6 rgb(40, 40, 40), " "stop:0.8 rgb(57, 57, 57), stop:0.9 rgb(51, 51, 51), stop:1 rgb(31, 31, 31)) } "); frame->setLayout(layout); layout->setMargin(0); layout->addWidget(player); return frame; }
LivePanel::LivePanel(QWidget *parent) : QWidget(parent) { QVBoxLayout *vboxLayout = new QVBoxLayout(this); vboxLayout->setSpacing(0); vboxLayout->setMargin(0); splitter = new QSplitter(this); splitter->setOrientation(Qt::Vertical); splitter->setOpaqueResize(false); vboxLayout->addWidget(splitter); QListView *listView = new QListView(splitter); //listView1->setSizePolicy(* new QSizePolicy(QSizePolicy::Preferred,QSizePolicy::Maximum)); //listView1->setGeometry(0,0,400,300); QFrame *frame = new QFrame(splitter); frame->setStyleSheet("background-color:white"); //QMessageBox::about(this,QString::number(frame1->width()),""); //frame1->resize(frame1->width(),frame1->width()*3/4); frame->resize(256,192); //frame1->setFrameStyle(QFrame::Raised); QLabel *label = new QLabel(frame); label->setGeometry(10,10,400,300); label->setFrameStyle(QFrame::Box); label->setStyleSheet("background-color:green"); label->setText("<html><head><body><center><h1>上山打老虎 1<br>2<br>3<br>4<br>5<br>6<br>7<br>8<br>9<br>0<br>2<br>3<br>4<br>5<br>6<br>7<br>8<br>9<br>0<br><h1></center></body></html>"); }
void NewslineWidget::setItems(const QList<NewsItemData>& Items) { QBoxLayout* Layout = dynamic_cast<QBoxLayout*>(ui->NewslineContents->layout()); QLayoutItem* LayoutItem; while ((LayoutItem = Layout->takeAt(0)) != NULL) { if (LayoutItem->widget() != NULL) LayoutItem->widget()->deleteLater(); delete LayoutItem; } bool isFirst = true; foreach (NewsItemData IData, Items) { if (isFirst) isFirst = false; else { QFrame* SepFrame = new QFrame(this); SepFrame->setFrameShape(QFrame::HLine); SepFrame->setStyleSheet("color : grey;"); Layout->addWidget(SepFrame); } Layout->addWidget(new NewsItemWidget(IData,this)); } Layout->addStretch(); }
ImportPrivKeyDialog::ImportPrivKeyDialog(QWidget* parent) : QDialog(parent) , ui(new Ui::ImportPrivKeyDialog) { ui->setupUi(this); GUIUtil::setupPrivKeyWidget(ui->privKeyEdit, this); ui->buttonBox->button(QDialogButtonBox::Ok)->setText(tr("Ok")); ui->buttonBox->button(QDialogButtonBox::Ok)->setCursor(Qt::PointingHandCursor); ui->buttonBox->button(QDialogButtonBox::Ok)->setStyleSheet(GULDEN_DIALOG_CONFIRM_BUTTON_STYLE_NOMARGIN); ui->buttonBox->button(QDialogButtonBox::Reset)->setText(tr("Cancel")); ui->buttonBox->button(QDialogButtonBox::Reset)->setCursor(Qt::PointingHandCursor); ui->buttonBox->button(QDialogButtonBox::Reset)->setStyleSheet(GULDEN_DIALOG_CANCEL_BUTTON_STYLE_NOMARGIN); QObject::connect(ui->buttonBox->button(QDialogButtonBox::Reset), SIGNAL(clicked()), this, SLOT(reject())); QFrame* horizontalLine = new QFrame(this); horizontalLine->setFrameStyle(QFrame::HLine); horizontalLine->setFixedHeight(1); horizontalLine->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); horizontalLine->setStyleSheet(GULDEN_DIALOG_HLINE_STYLE_NOMARGIN); ui->verticalLayout->insertWidget(1, horizontalLine); setMinimumSize(300, 200); }
ImageTypeEditor::ImageTypeEditor(QWidget *parent) : QWidget(parent), m_currentFileId(0) { //init m_browseButton = new QPushButton(tr("Select"), this); QFrame *backgroundFrame = new QFrame(this); QVBoxLayout *frameLayout = new QVBoxLayout(backgroundFrame); frameLayout->addWidget(m_browseButton); frameLayout->setContentsMargins(0, 0, 0, 0); frameLayout->setSpacing(0); QVBoxLayout *mainLayout = new QVBoxLayout(this); mainLayout->addWidget(backgroundFrame); mainLayout->setContentsMargins(0, 0, 0, 0); mainLayout->setSpacing(0); //style backgroundFrame->setStyleSheet("QFrame { background-color: palette(base); }"); //focus proxy setFocusProxy(m_browseButton); //connections connect(m_browseButton, SIGNAL(clicked()), this, SLOT(browseButtonClicked())); }
QFrame* MainWindow::initStatusBarFrame(QWidget *parent) { QFrame *frame = new QFrame(parent); QHBoxLayout *mainLayout = new QHBoxLayout(frame); filesCountLabel->setStyleSheet("QLabel {" "font: bold 12px \"Arial\";" "color: rgb(123, 123, 123);" "border: none;" "background: transparent;" "image: url(:/resources/files_count.png);" "image-position: left;" "}"); frame->setFixedHeight(30); frame->setStyleSheet("QFrame {" "background: qlineargradient(x1:0.5, y1:0, x2:0.5, y2:1," "stop:0 rgb(245, 245, 245)," "stop:1 rgb(205, 205, 205));" "border-top: 1px solid rgb(217, 217, 217);" "}"); mainLayout->setAlignment(Qt::AlignCenter); mainLayout->setMargin(0); mainLayout->addWidget(filesCountLabel); return frame; }
void MainWindow::createWidgets() { QFrame* frame = new QFrame(); frame->setStyleSheet(PSS("QWidget { background: kColour1; border-color: kColour2; }")); frame->setFrameStyle(QFrame::Box); QVBoxLayout *layout = new TightVBoxLayout; frame->setLayout(layout); layout->addWidget(new WindowHeader); QWidget* blackSep = new QWidget(); blackSep->setFixedHeight(1); blackSep->setStyleSheet(PSS("QWidget { background: kColour2; }")); layout->addWidget(blackSep); layout->addSpacing(50); { QLabel* deviceImage = new QLabel(); deviceImage->setFixedSize(600, 136); deviceImage->setStyleSheet(QString("QWidget { background-image: url(:/Device); }")); layout->addWidget(deviceImage, 0, Qt::AlignHCenter); } layout->addSpacing(50); m_controlsWidget = new ControlsWidget(); layout->addWidget(m_controlsWidget, 0, Qt::AlignHCenter); layout->addStretch(); setCentralWidget(frame); }
QFrame *DialogFrame::line() { QFrame *frame = new QFrame(this); frame->setMinimumHeight(1); frame->setStyleSheet(LS("border:1px solid #e5e5e5;")); return frame; }
//! //! Constructor of the TimelinePanel class. //! //! \param parent The parent widget the created instance will be a child of. //! \param flags Extra widget options. //! TimelinePanel::TimelinePanel ( QWidget *parent /* = 0 */, Qt::WindowFlags flags /* = 0 */ ) : ViewPanel(ViewPanel::T_Timeline, parent, flags), m_scaleScrollBar(0), m_timelineWidget(0), m_controlToolBar(0) { setupUi(this); // create the timeline widget as a child of the scroll area m_timelineWidget = new TimelineWidget(ui_scrollArea); ui_scrollArea->setWidget(m_timelineWidget); // set up signal relay connections from the timeline widget connect(m_timelineWidget, SIGNAL(currentFrameSet(int)), SIGNAL(currentFrameSet(int))); connect(m_timelineWidget, SIGNAL(startFrameSet(int)), SIGNAL(startFrameSet(int))); connect(m_timelineWidget, SIGNAL(endFrameSet(int)), SIGNAL(endFrameSet(int))); connect(m_timelineWidget, SIGNAL(inFrameSet(int)), SIGNAL(inFrameSet(int))); connect(m_timelineWidget, SIGNAL(outFrameSet(int)), SIGNAL(outFrameSet(int))); // set up action connections connect(ui_autoScrollAction, SIGNAL(toggled(bool)), m_timelineWidget, SLOT(setAutoScroll(bool))); // create the tool bar for timeline controls m_controlToolBar = new QToolBar("Timeline Controls", this); m_controlToolBar->setStyleSheet( "QToolButton {" " max-height: 24px;" "}" ); ui_horizontalLayout->insertWidget(2, m_controlToolBar); // set the special value text for the frame step spin box to an empty string that is displayed instead of "1st" ui_frameStepSpinBox->setSpecialValueText(" "); // Give a little space to the keyframe widget QWidget *spacerWidget = new QWidget(); spacerWidget->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed)); spacerWidget->setMinimumHeight(5); spacerWidget->setMaximumHeight(5); ui_verticalLayout->insertWidget(0, spacerWidget); // insert border widget to ui_verticalLayout at index 1 just over toolbar vbox QString borderStyle ( "border-top: 1px solid #393939; border-bottom: 1px solid #959595" ); QFrame *borderFrame = new QFrame(this); borderFrame->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); borderFrame->setMinimumHeight(2); borderFrame->setMaximumHeight(2); borderFrame->setStyleSheet(borderStyle); ui_verticalLayout->insertWidget(2, borderFrame); // insert border widget to ui_verticalLayout at index 1 just over toolbar vbox QFrame *borderFrame2 = new QFrame(this); borderFrame2->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); borderFrame2->setMinimumHeight(2); borderFrame2->setMaximumHeight(2); borderFrame2->setStyleSheet(borderStyle); ui_verticalLayout->insertWidget(4, borderFrame2); }
ToolBox::ToolBox(QWidget *parentWidget) : Utils::StyledBar(parentWidget), m_leftToolBar(new QToolBar("LeftSidebar", this)), m_rightToolBar(new QToolBar("RightSidebar", this)) { setMaximumHeight(44); setSingleRow(false); QFrame *frame = new QFrame(this); m_crumblePath = new Utils::CrumblePath(frame); frame->setStyleSheet("background-color: #4e4e4e;"); frame->setFrameShape(QFrame::NoFrame); QHBoxLayout *layout = new QHBoxLayout(frame); layout->setMargin(0); layout->setSpacing(0); frame->setLayout(layout); layout->addWidget(m_crumblePath); frame->setProperty("panelwidget", true); frame->setProperty("panelwidget_singlerow", false); QVBoxLayout *verticalLayout = new QVBoxLayout(this); verticalLayout->setMargin(0); verticalLayout->setSpacing(0); QHBoxLayout *horizontalLayout = new QHBoxLayout(); verticalLayout->addLayout(horizontalLayout); verticalLayout->addWidget(frame); horizontalLayout->setMargin(0); horizontalLayout->setSpacing(0); m_leftToolBar->setFloatable(true); m_leftToolBar->setMovable(true); m_leftToolBar->setOrientation(Qt::Horizontal); m_leftToolBar->setIconSize(QSize(24, 24)); QToolBar *stretchToolbar = new QToolBar(this); setSingleRow(false); m_leftToolBar->setProperty("panelwidget", true); m_leftToolBar->setProperty("panelwidget_singlerow", false); m_rightToolBar->setProperty("panelwidget", true); m_rightToolBar->setProperty("panelwidget_singlerow", false); stretchToolbar->setProperty("panelwidget", true); stretchToolbar->setProperty("panelwidget_singlerow", false); stretchToolbar->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding); m_rightToolBar->setOrientation(Qt::Horizontal); m_rightToolBar->setIconSize(QSize(24, 24)); horizontalLayout->addWidget(m_leftToolBar); horizontalLayout->addWidget(stretchToolbar); horizontalLayout->addWidget(m_rightToolBar); }
QFrame* MainWindow::initDragFrame(QWidget *parent) { QFrame *frame = new QFrame(parent); QLabel *logoLabel = new QLabel(frame); QLabel *dragLabel = new QLabel("Drop Folders Here Or", frame); //QPushButton *addFilesButton = new QPushButton("Select files", frame); QPushButton *addFilesButton = new QPushButton("Select Folder", frame); logoLabel->setPixmap(QPixmap(":/resources/logo.png")); dragLabel->setAlignment(Qt::AlignCenter); QHBoxLayout *mainLayout = new QHBoxLayout(frame); QVBoxLayout *addFilesLayout = new QVBoxLayout(); addFilesButton->setFixedSize(290, 30); addFilesLayout->setAlignment(Qt::AlignCenter); addFilesLayout->addWidget(dragLabel); addFilesLayout->addWidget(addFilesButton); mainLayout->addSpacing(25); mainLayout->addWidget(logoLabel); mainLayout->addLayout(addFilesLayout); mainLayout->addSpacing(65); frame->setFixedSize(570, 155); frame->setObjectName("add_files_frame"); frame->setStyleSheet("QFrame#add_files_frame {" "border: 3px dashed rgb(220, 220, 220);" "border-radius: 24px" "}" "QPushButton {" "background: qlineargradient(x1:0.5, y1:0, x2:0.5, y2:1, stop:0 rgb(245, 245, 245), stop:1 rgb(214, 214, 214));" "border: 1px solid rgb(171, 171, 171);" "border-radius: 5px" "}" "QPushButton:pressed {" "background: qlineargradient(x1:0.5, y1:0, x2:0.5, y2:1, stop:0 rgb(214, 214, 214), stop:1 rgb(230, 230, 230));" "}" "QWidget {" "font: bold 13px \"Arial\";" "color: rgb(58, 58, 58);" "}"); setMinimumWidth(frame->width()+10); //connect(addFilesButton, &QPushButton::clicked, this, [=](){ filesList->addFiles(QFileDialog::getOpenFileNames(this, "Select Files")); }); connect(addFilesButton, &QPushButton::clicked, this, [=](){ filesList->addFolder(QFileDialog::getExistingDirectory(this, "Select Directory")); }); return frame; }
QWidget *DialogController::frameWidget(QWidget *widget) { QFrame *frame = new QFrame(m_parent); frame->setLayout(new QHBoxLayout); frame->setObjectName("actionFrame"); frame->setMinimumWidth(widget->width()); frame->layout()->addWidget(widget); frame->layout()->setContentsMargins(0,0,0,0); if(m_mode == Bottom) { frame->setStyleSheet("QFrame#actionFrame { background: rgb(35,35,35); border:none; border-top:2px solid rgb(108,108,108);}"); } return frame; }
//---------------------------------------------------------------------------- QFrame *DialogLoadGRIB::newSeparator (char orientation) { QFrame *ftmp; ftmp = new QFrame (); assert (ftmp); if (orientation == 'H') { ftmp->setFrameShape(QFrame::HLine); } else { ftmp->setFrameShape(QFrame::VLine); } ftmp->setStyleSheet ("color:#AAAAAA"); return ftmp; }
//---------------------------------------------------------------------------- void DialogLoadMBLUE::addSeparator (QLayout *layout, char orientation) { QFrame *ftmp; ftmp = new QFrame (); assert (ftmp); if (orientation == 'H') { ftmp->setFrameShape(QFrame::HLine); } else { ftmp->setFrameShape(QFrame::VLine); } ftmp->setStyleSheet ("color:#AAAAAA"); layout->addWidget(ftmp); }
QFrame* MainWindow::initControlFrame() { QFrame *frame = new QFrame(this); QVBoxLayout *layout = new QVBoxLayout(frame); frame->setStyleSheet("QFrame { background-color: white } "); layout->setAlignment(Qt::AlignTop); layout->setContentsMargins(0, 0, 0, 0); layout->setSpacing(0); layout->addWidget(initFilesFrame(frame)); layout->addWidget(initRenameFrame(frame)); layout->addWidget(initFilesListFrame(frame)); layout->addWidget(initStatusBarFrame(frame)); return frame; }
QFrame* MainWindow::initFilesFrame(QWidget *parent) { QFrame *frame = new QFrame(parent); //QAbstractButton *addFilesButton = createIconButton(QString(":/resources/add_files_button%1.png"), "Add Files", frame); QAbstractButton *addFolderButton = createIconButton(QString(":/resources/add_folder_button%1.png"), "", frame); QAbstractButton *resetButton = createIconButton(QString(":/resources/reset_button%1.png"), "", frame); QAbstractButton *renameButton = createIconButton(QString(":/resources/rename_button%1.png"), "", frame); QHBoxLayout *layout = new QHBoxLayout(frame); frame->setFixedHeight(56); //addFolderButton->setFixedWidth(175); //resetButton->setFixedWidth(125); //renameButton->setFixedWidth(85); frame->setStyleSheet("QFrame {" "background: qlineargradient(x1:0.5, y1:0, x2:0.5, y2:1, stop:0 rgb(60, 60, 60), stop:1 rgb(60, 60, 60));" //"border-bottom: 1px solid rgb(198, 198, 198);" "image: url(:/resources/frame_center.png);" "}" "QAbstractButton {" "background: transparent;" "font: bold 13px \"Arial\";" "color: rgb(58, 58, 58);" "}"); layout->setContentsMargins(0, 2, 0, 2); layout->setSpacing(90); layout->setAlignment(Qt::AlignCenter); //layout->addWidget(addFilesButton); layout->addWidget(addFolderButton); layout->addWidget(resetButton); layout->addWidget(renameButton); //connect(addFilesButton, &QPushButton::clicked, this, [=](){ filesList->addFiles(QFileDialog::getOpenFileNames(this, "Select Files")); }); connect(addFolderButton, &QPushButton::clicked, this, [=](){ filesList->addFolder(QFileDialog::getExistingDirectory(this, "Select Directory")); }); connect(resetButton, SIGNAL(clicked()), filesList, SLOT(reset())); connect(renameButton, SIGNAL(clicked()), filesList, SLOT(renameFiles())); return frame; }
SettingsDialog::SettingsDialog(Settings *settings, QWidget *parent) : QDialog(parent) { setAttribute(Qt::WA_DeleteOnClose); setWindowFlags(windowFlags() ^ Qt::WindowContextHelpButtonHint); setWindowTitle(SCHAT_NAME); setMinimumWidth(320); QFrame *topFrame = new QFrame(this); topFrame->setObjectName(LS("TopFrame")); topFrame->setStyleSheet(LS("#TopFrame{background-color:#fff;}")); m_settingsBtn = addBtn(QIcon(LS(":/images/32/gear.png")), tr("Settings")); m_settingsBtn->setChecked(true); m_aboutBtn = new QToolButton(this); m_aboutBtn->setText(QApplication::applicationVersion()); m_aboutBtn->setAutoRaise(true); m_aboutBtn->setCheckable(true); m_aboutBtn->setToolButtonStyle(Qt::ToolButtonTextOnly); connect(m_aboutBtn, SIGNAL(clicked()), SLOT(tooglePage())); m_pages = new QStackedWidget(this); m_pages->addWidget(new SettingsPage(settings, this)); m_pages->addWidget(new AboutPage(settings, this)); QFrame *line = new QFrame(this); line->setFrameStyle(QFrame::HLine | QFrame::Sunken); QHBoxLayout *btnLay = new QHBoxLayout(topFrame); btnLay->addWidget(m_settingsBtn); btnLay->addStretch(); btnLay->addWidget(m_aboutBtn, 0, Qt::AlignTop); btnLay->setMargin(4); QVBoxLayout *layout = new QVBoxLayout(this); layout->addWidget(topFrame); layout->addWidget(line); layout->addWidget(m_pages); layout->setMargin(0); layout->setSpacing(0); }
QFrame* MainWindow::initRenameFrame(QWidget *parent) { QFrame *frame = new QFrame(parent); QAbstractButton *copyDownButton = createIconButton(QString(":/resources/copy_down_button%1.png"), "Copy Down", frame); QCheckBox *autoRenameBox = new QCheckBox("Auto Rename", frame); QHBoxLayout *layout = new QHBoxLayout(frame); frame->setFixedHeight(36); frame->setStyleSheet("QFrame {" "background: qlineargradient(x1:0.5, y1:0, x2:0.5, y2:0.6, x3:0.5, y3:1," "stop:0 rgb(245, 245, 245)," "stop:0.6 rgb(236, 236, 236)," "stop:1 rgb(220, 220, 220));" "border-bottom: 1px solid rgb(185, 185, 185);" "}" "QCheckBox::indicator:unchecked { image: url(:/resources/check_box_unchecked.png); }" "QCheckBox::indicator:unchecked:pressed { image: url(:/resources/check_box_unchecked_pressed.png); }" "QCheckBox::indicator:checked { image: url(:/resources/check_box_checked.png); }" "QCheckBox::indicator:checked:pressed { image: url(:/resources/check_box_checked_pressed.png); }" "QAbstractButton {" "background: transparent;" "font: bold 11px \"Arial\";" "color: rgb(58, 58, 58);" "}"); autoRenameBox->setCursor(Qt::PointingHandCursor); layout->setContentsMargins(0, 2, 0, 2); layout->setSpacing(20); layout->setAlignment(Qt::AlignCenter); layout->addWidget(copyDownButton); layout->addWidget(autoRenameBox); connect(copyDownButton, SIGNAL(clicked()), filesListWidget, SLOT(copyDown())); connect(autoRenameBox, SIGNAL(toggled(bool)), filesList, SLOT(setAutoRename(bool))); return frame; }
foreach(QString s, names){ if(s=="|"){ QFrame *line = new QFrame(this); line->setObjectName(QString::fromUtf8("line")); if(flag==Qt::AlignLeft||flag==Qt::AlignRight){ line->setFrameShape(QFrame::VLine); } else { line->setFrameShape(QFrame::HLine); } line->setFrameShadow(QFrame::Sunken); line->setStyleSheet("background:black;"); layout->addWidget(line); } else { lds_toolbar_button *t=new lds_toolbar_button(this); t->setText(s); if(t->text()==tr("退出") ||t->text()==tr("取消"))t->setProperty("outer_stylesheet", "pushbutton_blue"); else t->setProperty("outer_stylesheet", "pushbutton"); layout->addWidget(t); nameTool.insert(s, t); } }
QFrame * newLineWidget(const bool &pHorizontal, const QColor &pColor, QWidget *pParent) { // Create and return a 'real' line widget, i.e. one which is 1 pixel wide, // using a QFrame widget QFrame *res = new QFrame(pParent); res->setStyleSheet(QString("QFrame {" " border: 1px solid rgb(%1, %2, %3);" "}").arg(QString::number(pColor.red()), QString::number(pColor.green()), QString::number(pColor.blue()))); if (pHorizontal) { res->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); res->setFixedHeight(1); } else { res->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Preferred); res->setFixedWidth(1); } return res; }
AccountWidget::AccountWidget( QWidget* parent ) : QWidget( parent ) { QHBoxLayout *mainLayout = new QHBoxLayout( this ); TomahawkUtils::unmarginLayout( mainLayout ); setLayout( mainLayout ); setContentsMargins( 8, 8, 8, 8 ); m_imageLabel = new QLabel( this ); mainLayout->addWidget( m_imageLabel ); mainLayout->setSpacing( 4 ); QGridLayout* vLayout = new QGridLayout( this ); vLayout->setMargin( 3 ); vLayout->setSpacing( 3 ); mainLayout->addLayout( vLayout ); QFrame* idContainer = new QFrame( this ); idContainer->setAttribute( Qt::WA_TranslucentBackground, false ); vLayout->addWidget( idContainer, 0, 0 ); QHBoxLayout* idContLayout = new QHBoxLayout( idContainer ); idContainer->setLayout( idContLayout ); idContainer->setContentsMargins( 0, 0, 0, 0 ); idContLayout->setMargin( 2 ); m_idLabel = new ElidedLabel( idContainer ); m_idLabel->setElideMode( Qt::ElideRight ); m_idLabel->setContentsMargins( 3, 0, 3, 0 ); m_idLabel->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Preferred ); m_idLabel->setAlignment( Qt::AlignLeft | Qt::AlignVCenter ); idContLayout->addWidget( m_idLabel ); m_spinnerWidget = new QWidget( idContainer ); QSize spinnerSize = 16 > m_spinnerWidget->logicalDpiX() * .2 ? QSize( 16, 16 ) : QSize( m_spinnerWidget->logicalDpiX() * .15, m_spinnerWidget->logicalDpiX() * .15 ); m_spinnerWidget->setFixedSize( spinnerSize ); idContLayout->addWidget( m_spinnerWidget ); m_spinnerWidget->setContentsMargins( 0, 0, 0, 0 ); m_spinner = new AnimatedSpinner( m_spinnerWidget->size(), m_spinnerWidget ); idContainer->setStyleSheet( QString( "QFrame {" "border: 1px solid #e9e9e9;" "border-radius: %1px;" "background: #e9e9e9;" "}" ).arg( idContainer->sizeHint().height() / 2 + 1 ) ); m_statusToggle = new SlideSwitchButton( this ); m_statusToggle->setContentsMargins( 0, 0, 0, 0 ); m_statusToggle->setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Expanding ); m_statusToggle->setFixedSize( m_statusToggle->sizeHint() ); QHBoxLayout *statusToggleLayout = new QHBoxLayout( this ); vLayout->addLayout( statusToggleLayout, 0, 1, 1, 1 ); statusToggleLayout->addStretch(); statusToggleLayout->addWidget( m_statusToggle ); //vLayout->addWidget( m_statusToggle, 0, 1 ); m_inviteContainer = new UnstyledFrame( this ); vLayout->addWidget( m_inviteContainer, 1, 0 ); m_inviteContainer->setFrameColor( QColor( 0x8c, 0x8c, 0x8c ) ); //from ProxyStyle m_inviteContainer->setFixedWidth( m_inviteContainer->logicalDpiX() * 2 ); m_inviteContainer->setContentsMargins( 1, 1, 1, 2 ); m_inviteContainer->setAttribute( Qt::WA_TranslucentBackground, false ); m_inviteContainer->setStyleSheet( "background: white" ); QHBoxLayout* containerLayout = new QHBoxLayout( m_inviteContainer ); m_inviteContainer->setLayout( containerLayout ); TomahawkUtils::unmarginLayout( containerLayout ); containerLayout->setContentsMargins( 1, 1, 0, 0 ); m_addAccountIcon = new QLabel( m_inviteContainer ); m_addAccountIcon->setContentsMargins( 1, 0, 0, 0 ); m_addAccountIcon->setPixmap( QIcon( RESPATH "images/add-contact.png" ).pixmap( 16 ) ); m_addAccountIcon->setSizePolicy( QSizePolicy::Minimum, QSizePolicy::Expanding ); m_addAccountIcon->setAlignment( Qt::AlignCenter ); containerLayout->addWidget( m_addAccountIcon ); m_inviteEdit = new QLineEdit( m_inviteContainer ); m_inviteEdit->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ); containerLayout->addWidget( m_inviteEdit ); m_inviteEdit->setFrame( false ); idContainer->setFixedWidth( m_inviteContainer->width() ); m_inviteButton = new QPushButton( this ); m_inviteButton->setFixedWidth( m_inviteButton->logicalDpiX() * 0.8 ); m_inviteButton->setText( tr( "Invite" ) ); vLayout->addWidget( m_inviteButton, 1, 1 ); setInviteWidgetsEnabled( false ); }
AccountWidget::AccountWidget( QWidget* parent ) : QWidget( parent ) , TomahawkUtils::DpiScaler( this ) { QHBoxLayout *mainLayout = new QHBoxLayout(); TomahawkUtils::unmarginLayout( mainLayout ); setLayout( mainLayout ); setContentsMargins( 0, scaledY( 8 ), 0, scaledY( 8 ) ); m_imageLabel = new QLabel( this ); mainLayout->addWidget( m_imageLabel ); mainLayout->setSpacing( scaledX( 4 ) ); QGridLayout* vLayout = new QGridLayout(); vLayout->setSpacing( 8 ); mainLayout->addLayout( vLayout ); QFrame* idContainer = new QFrame( this ); idContainer->setAttribute( Qt::WA_TranslucentBackground, false ); vLayout->addWidget( idContainer, 0, 0 ); QHBoxLayout* idContLayout = new QHBoxLayout(); idContainer->setLayout( idContLayout ); idContainer->setContentsMargins( 0, 0, 0, 0 ); idContLayout->setMargin( 2 ); m_idLabel = new ElidedLabel( idContainer ); m_idLabel->setElideMode( Qt::ElideRight ); m_idLabel->setContentsMargins( 3, 0, 3, 0 ); m_idLabel->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Preferred ); m_idLabel->setAlignment( Qt::AlignLeft | Qt::AlignVCenter ); idContLayout->addWidget( m_idLabel ); m_spinnerWidget = new QWidget( idContainer ); QSize spinnerSize = 16 > TomahawkUtils::defaultFontHeight() ? QSize( 16, 16 ) : QSize( TomahawkUtils::defaultFontHeight(), TomahawkUtils::defaultFontHeight() ); m_spinnerWidget->setFixedSize( spinnerSize ); idContLayout->addWidget( m_spinnerWidget ); m_spinnerWidget->setContentsMargins( 0, 1, 0, 0 ); m_spinner = new AnimatedSpinner( m_spinnerWidget->size() - QSize( 2, 2 ), m_spinnerWidget ); idContainer->setStyleSheet( QString( "QFrame {" "border: 1px solid #e9e9e9;" "border-radius: %1px;" "background: #e9e9e9;" "}" ).arg( idContainer->sizeHint().height() / 2 + 1 ) ); idContainer->setMinimumHeight( spinnerSize.height() + 6 /*margins*/ ); m_statusToggle = new SlideSwitchButton( this ); m_statusToggle->setContentsMargins( 0, 0, 0, 0 ); m_statusToggle->setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Expanding ); m_statusToggle->setFixedSize( m_statusToggle->sizeHint() ); QHBoxLayout *statusToggleLayout = new QHBoxLayout(); vLayout->addLayout( statusToggleLayout, 0, 1, 1, 1 ); statusToggleLayout->addStretch(); statusToggleLayout->addWidget( m_statusToggle ); m_inviteContainer = new QFrame( this ); m_inviteContainer->setObjectName( "inviteContainer" ); vLayout->addWidget( m_inviteContainer, 1, 0 ); m_inviteContainer->setStyleSheet( QString( "QWidget { background: white; } QFrame#%1 { border: 1px solid %2; }" ).arg( m_inviteContainer->objectName() ).arg( TomahawkStyle::BORDER_LINE.name() ) ); m_inviteContainer->setMinimumWidth( m_inviteContainer->logicalDpiX() * 2 ); m_inviteContainer->setContentsMargins( 1, 1, 1, 2 ); m_inviteContainer->setAttribute( Qt::WA_TranslucentBackground, false ); QHBoxLayout* containerLayout = new QHBoxLayout(); m_inviteContainer->setLayout( containerLayout ); TomahawkUtils::unmarginLayout( containerLayout ); containerLayout->setContentsMargins( 1, 1, 0, 0 ); m_addAccountIcon = new QLabel( m_inviteContainer ); m_addAccountIcon->setContentsMargins( 1, 0, 0, 0 ); m_addAccountIcon->setPixmap( TomahawkUtils::defaultPixmap( TomahawkUtils::AddContact, TomahawkUtils::Original, QSize( 16, 16 ) ) ); m_addAccountIcon->setSizePolicy( QSizePolicy::Minimum, QSizePolicy::Expanding ); m_addAccountIcon->setAlignment( Qt::AlignCenter ); containerLayout->addWidget( m_addAccountIcon ); m_inviteEdit = new QLineEdit( m_inviteContainer ); m_inviteEdit->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ); containerLayout->addWidget( m_inviteEdit ); m_inviteEdit->setFrame( false ); m_inviteButton = new QPushButton( this ); m_inviteButton->setMinimumWidth( m_inviteButton->logicalDpiX() * 0.8 ); m_inviteButton->setText( AccountWidget::tr( "Invite" ) ); m_inviteButton->setSizePolicy( QSizePolicy::Minimum, QSizePolicy::Preferred ); vLayout->addWidget( m_inviteButton, 1, 1 ); vLayout->setColumnStretch( 0, 1 ); #ifdef Q_OS_MAC layout()->setContentsMargins( 0, 0, 0, 0 ); #endif setInviteWidgetsEnabled( false ); }
MagpieFileImportPopup::MagpieFileImportPopup() : Dialog(TApp::instance()->getMainWindow(), true, true, "MagPieFileImport"), m_levelField(0), m_fromField(0), m_toField(0), m_flipbook(0), m_levelPath() { setWindowTitle(tr("Import Magpie File")); beginVLayout(); setLabelWidth(45); addSeparator(tr("Frame Range")); QWidget *fromToWidget = new QWidget(this); fromToWidget->setFixedHeight(DVGui::WidgetHeight); fromToWidget->setFixedSize(210, DVGui::WidgetHeight); QHBoxLayout *fromToLayout = new QHBoxLayout(fromToWidget); fromToLayout->setMargin(0); fromToLayout->setSpacing(0); m_fromField = new DVGui::IntLineEdit(fromToWidget, 1, 1, 1); fromToLayout->addWidget(m_fromField, 0, Qt::AlignLeft); m_toField = new DVGui::IntLineEdit(fromToWidget, 1, 1, 1); QLabel *toLabel = new QLabel(tr("To:")); toLabel->setAlignment(Qt::AlignRight | Qt::AlignVCenter); toLabel->setFixedSize(20, m_toField->height()); fromToLayout->addWidget(toLabel, 0, Qt::AlignRight); fromToLayout->addWidget(m_toField, 0, Qt::AlignLeft); fromToWidget->setLayout(fromToLayout); addWidget(tr("From:"), fromToWidget); addSeparator(tr("Animation Level")); m_levelField = new DVGui::FileField(this); m_levelField->setFileMode(QFileDialog::AnyFile); m_levelField->setFixedWidth(200); bool ret = connect(m_levelField, SIGNAL(pathChanged()), SLOT(onLevelPathChanged())); addWidget(tr("Level:"), m_levelField); QLabel *frameLabel = new QLabel(" Frame", this); frameLabel->setFixedHeight(DVGui::WidgetHeight); addWidget(tr("Phoneme"), frameLabel); int i; for (i = 0; i < 9; i++) { IntLineEdit *field = new IntLineEdit(this, 1, 1); QLabel *label = new QLabel("", this); label->setAlignment(Qt::AlignRight | Qt::AlignVCenter); label->setFixedSize(getLabelWidth(), field->height()); m_actFields.append(QPair<QLabel *, IntLineEdit *>(label, field)); addWidgets(label, field); } endVLayout(); QFrame *frame = new QFrame(this); frame->setFrameStyle(QFrame::StyledPanel); frame->setObjectName("LipSynkViewer"); frame->setStyleSheet("#LipSynkViewer { border: 1px solid rgb(150,150,150); }"); QVBoxLayout *frameLayout = new QVBoxLayout(frame); frameLayout->setMargin(0); frameLayout->setSpacing(0); UINT buttonMask = FlipConsole::cFullConsole & (~(FlipConsole::eRate | FlipConsole::eSound | FlipConsole::eSaveImg | FlipConsole::eHisto | FlipConsole::eCompare | FlipConsole::eCustomize | FlipConsole::eSave | FlipConsole::eBegin | FlipConsole::eEnd | FlipConsole::eFirst | FlipConsole::eNext | FlipConsole::ePause | FlipConsole::ePlay | FlipConsole::ePrev | FlipConsole::eRate | FlipConsole::eWhiteBg | FlipConsole::eCheckBg | FlipConsole::eBlackBg | FlipConsole::eNext | FlipConsole::eLast | FlipConsole::eLoop | FlipConsole::eGRed | FlipConsole::eGGreen | FlipConsole::eGBlue | FlipConsole::eRed | FlipConsole::eGreen | FlipConsole::eBlue | FlipConsole::eMatte | FlipConsole::eDefineSubCamera | FlipConsole::eDefineLoadBox | FlipConsole::eUseLoadBox | FlipConsole::eFilledRaster)); m_flipbook = new FlipBook(this, tr("Import Magpie File"), buttonMask); m_flipbook->setFixedHeight(250); frameLayout->addWidget(m_flipbook); frame->setLayout(frameLayout); addWidget(frame); QPushButton *okBtn = new QPushButton(tr("Import"), this); okBtn->setDefault(true); QPushButton *cancelBtn = new QPushButton(tr("Cancel"), this); ret = ret && connect(okBtn, SIGNAL(clicked()), this, SLOT(onOkPressed())); ret = ret && connect(cancelBtn, SIGNAL(clicked()), this, SLOT(reject())); assert(ret); addButtonBarWidget(okBtn, cancelBtn); }
AMActionRunnerQueueView3::AMActionRunnerQueueView3(AMActionRunner3* actionRunner, QWidget *parent) : QWidget(parent) { actionRunner_ = actionRunner; isCollapsed_ = false; treeView_ = new QTreeView(); treeView_->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); treeView_->setModel(actionRunner_->queueModel()); treeView_->setHeaderHidden(true); treeView_->setAttribute(Qt::WA_MacShowFocusRect, false); treeView_->setSelectionBehavior(QAbstractItemView::SelectRows); treeView_->setSelectionMode(QAbstractItemView::ExtendedSelection); treeView_->setAlternatingRowColors(true); treeView_->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel); treeView_->setAutoScroll(true); treeView_->setAutoScrollMargin(20); treeView_->setDragEnabled(true); treeView_->viewport()->setAcceptDrops(true); treeView_->setDropIndicatorShown(true); treeView_->setDragDropMode(QTreeView::DragDrop); treeView_->setItemDelegate(new AMActionRunnerQueueItemDelegate3(this)); QFrame* topFrame = new QFrame(); topFrame->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed); topFrame->setObjectName("topFrame"); topFrame->setStyleSheet("QFrame#topFrame {\nbackground-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 rgba(89, 89, 89, 255), stop:0.494444 rgba(89, 89, 89, 255), stop:0.5 rgba(58, 58, 58, 255), stop:1 rgba(58, 58, 58, 255));\nborder-bottom: 1px solid black;\n}"); QHBoxLayout* hl = new QHBoxLayout(); hl->setSpacing(0); hl->setContentsMargins(6, 2, 12, 1); hideButton_ = new QToolButton(); hideButton_->setStyleSheet("QToolButton {\nborder: none;\nbackground-color: rgba(255, 255, 255, 0);\ncolor: white;\n image: url(:/22x22/arrow-white-down.png)} \nQToolButton::checked {\n image: url(:/22x22/arrow-white-right.png);\n}\n"); hideButton_->setCheckable(true); hideButton_->setChecked(false); hl->addWidget(hideButton_); hl->addSpacing(10); QVBoxLayout* vl2 = new QVBoxLayout(); vl2->setContentsMargins(0,0,0,0); vl2->setSpacing(0); headerTitle_ = new QLabel("Upcoming Actions"); headerTitle_->setStyleSheet("color: white;\nfont: " AM_FONT_XLARGE_ "pt \"Lucida Grande\""); headerSubTitle_ = new QLabel(QString("%1 actions in the workflow queue.").arg(actionRunner_->queuedActionCount())); headerSubTitle_->setStyleSheet("color: rgb(204, 204, 204);\nfont: " AM_FONT_REGULAR_ "pt \"Lucida Grande\""); vl2->addWidget(headerTitle_); vl2->addWidget(headerSubTitle_); hl->addLayout(vl2); hl->addStretch(1); duplicateButton_ = new QPushButton("Duplicate"); duplicateButton_->setDisabled(true); hl->addWidget(duplicateButton_); deleteButton_ = new QPushButton("Delete"); deleteButton_->setDisabled(true); hl->addWidget(deleteButton_); hl->addSpacing(20); pauseButton_ = new QPushButton; QIcon pauseIcon(":/22x22/media-playback-pause.png"); pauseIcon.addPixmap(QPixmap(":/22x22/media-playback-start.png"), QIcon::Normal, QIcon::On); pauseButton_->setIcon(pauseIcon); pauseButton_->setIconSize(QSize(22, 22)); pauseButton_->setCheckable(true); pauseButton_->setChecked(true); pauseButton_->setStyleSheet("QPushButton { border: 2px solid #8f8f91; border-radius: 6px;background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 rgb(102,255,102), stop: 1 #dadbde);min-width: 140px; padding: 0px 5px 0 5px;} QPushButton:pressed { background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #dadbde, stop: 1 #f6f7fa); } QPushButton:flat { border: none; /* no border for a flat push button */ } QPushButton:checked { background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 rgb(102,102,255), stop: 1 #f6f7fa); } QPushButton:checked:pressed { background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #dadbde, stop: 1 #f6f7fa); }"); hl->addWidget(pauseButton_); pauseButtonConfiguration(); topFrame->setLayout(hl); QVBoxLayout* vl = new QVBoxLayout(); vl->setContentsMargins(0,0,0,0); vl->setSpacing(0); vl->addWidget(topFrame); vl->addWidget(treeView_); setLayout(vl); connect(hideButton_, SIGNAL(toggled(bool)), this, SLOT(collapse(bool))); connect(pauseButton_, SIGNAL(toggled(bool)), this, SLOT(onPauseButtonClicked(bool))); connect(duplicateButton_, SIGNAL(clicked()), this, SLOT(onDuplicateButtonClicked())); connect(deleteButton_, SIGNAL(clicked()), this, SLOT(onDeleteButtonClicked())); connect(actionRunner_->queueModel(), SIGNAL(rowsInserted(QModelIndex,int,int)), this, SLOT(onQueueActionAddedOrRemoved())); connect(actionRunner_->queueModel(), SIGNAL(rowsRemoved(QModelIndex,int,int)), this, SLOT(onQueueActionAddedOrRemoved())); connect(treeView_->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)), this, SLOT(onSelectionChanged())); connect(actionRunner_, SIGNAL(queuePausedChanged(bool)), this, SLOT(onQueuePaused(bool))); }
BasicHeader::BasicHeader( QWidget* parent ) : QWidget( parent ) { QLayout* l = new QVBoxLayout; TomahawkUtils::unmarginLayout( l ); setLayout( l ); m_mainLayout = new QHBoxLayout; m_imageLabel = new QLabel( this ); m_imageLabel->setFixedSize( 48, 48 ); m_mainLayout->addWidget( m_imageLabel ); m_mainLayout->addSpacing( 8 ); m_verticalLayout = new QVBoxLayout; m_mainLayout->addLayout( m_verticalLayout ); m_captionLabel = new ElidedLabel( this ); m_descriptionLabel = new ElidedLabel( this ); m_verticalLayout->addWidget( m_captionLabel ); m_verticalLayout->addWidget( m_descriptionLabel ); m_verticalLayout->addStretch(); m_mainLayout->addSpacing( 8 ); m_mainLayout->setStretchFactor( m_verticalLayout, 2 ); QPalette pal = palette(); pal.setColor( QPalette::Foreground, TomahawkStyle::HEADER_TEXT ); pal.setBrush( backgroundRole(), TomahawkStyle::HEADER_BACKGROUND ); m_captionLabel->setPalette( pal ); m_descriptionLabel->setPalette( pal ); QFont font = m_captionLabel->font(); font.setPointSize( TomahawkUtils::defaultFontSize() + 4 ); font.setBold( true ); m_captionLabel->setFont( font ); m_captionLabel->setElideMode( Qt::ElideRight ); m_captionLabel->setAlignment( Qt::AlignTop | Qt::AlignLeft ); font.setPointSize( TomahawkUtils::defaultFontSize() + 1 ); font.setBold( false ); m_descriptionLabel->setFont( font ); m_descriptionLabel->setAlignment( Qt::AlignTop | Qt::AlignLeft ); m_captionLabel->setMargin( 2 ); m_descriptionLabel->setMargin( 2 ); /* QGraphicsDropShadowEffect* effect = new QGraphicsDropShadowEffect(); effect->setBlurRadius( 4 ); effect->setXOffset( 0 ); effect->setYOffset( 0 ); effect->setColor( Qt::white ); m_captionLabel->setGraphicsEffect( effect );*/ // m_descriptionLabel->setGraphicsEffect( effect ); QFrame* lineAbove = new QFrame( this ); lineAbove->setStyleSheet( QString( "QFrame { border: 1px solid %1; }" ).arg( TomahawkStyle::HEADER_BACKGROUND.name() ) ); lineAbove->setFrameShape( QFrame::HLine ); lineAbove->setMaximumHeight( 1 ); QFrame* lineBelow = new QFrame( this ); lineBelow->setStyleSheet( QString( "QFrame { border: 1px solid black; }" ) ); lineBelow->setFrameShape( QFrame::HLine ); lineBelow->setMaximumHeight( 1 ); l->addItem( m_mainLayout ); l->addWidget( lineAbove ); l->addWidget( lineBelow ); TomahawkUtils::unmarginLayout( m_mainLayout ); m_mainLayout->setContentsMargins( 8, 4, 8, 4 ); setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ); setFixedHeight( 58 ); setAutoFillBackground( true ); setPalette( pal ); }
// The following two functions are very big. Lots of code is necessay for // dynamically build guis. void DisplayArea::setupChannels() { this->labelConnect->setClickable(false); QSettings settings; settings.beginGroup(setcon::DEVICE_GROUP); settings.beginGroup(settings.value(setcon::DEVICE_ACTIVE).toString()); if (settings.contains(setcon::DEVICE_PORT)) { // if there is a device we must enable the connect button. this->labelConnect->setClickable(true); // TODO: One could make this more intelligent and only create / delete // channels that are (no longer) needed. // remove all channels from the frame if there are any. Happens if the // user changes the device specs or chooses another one. for (auto f : this->channelFramesVec) { utils::clearLayout(f->layout()); this->frameChannels->layout()->removeWidget(f); delete (f); } // clear the vector this->channelFramesVec.clear(); this->chanwVector.clear(); // create the frames that control one channel for (int i = 1; i <= settings.value(setcon::DEVICE_CHANNELS).toInt(); i++) { std::shared_ptr<ChannelWidgets> chanw = std::make_shared<ChannelWidgets>(); QFrame *channelFrameContainer = new QFrame(); channelFrameContainer->setLayout(new QVBoxLayout()); channelFrameContainer->setObjectName("ch" + QString::number(i) + "Container"); // this is the container frame QString frameQss = QString("QFrame#%1 {border: 1px solid ") + globcon::GREENCOLOR + ";}"; channelFrameContainer->setStyleSheet( frameQss.arg(channelFrameContainer->objectName())); channelFrameContainer->layout()->setSpacing(0); channelFrameContainer->layout()->setContentsMargins(QMargins()); this->frameChannels->layout()->addWidget(channelFrameContainer); // now the frame for the electrical values V, A, W. QFrame *vawFrame = new QFrame(); vawFrame->setObjectName("ch" + QString::number(i) + "vawFrame"); QString vawFrameQss = QString("QFrame#%1 {border-bottom: 1px solid ") + globcon::GREENCOLOR + ";}"; vawFrame->setStyleSheet(vawFrameQss.arg(vawFrame->objectName())); QGridLayout *vawLayout = new QGridLayout(); vawFrame->setLayout(vawLayout); channelFrameContainer->layout()->addWidget(vawFrame); vawLayout->addWidget(new QLabel("CH" + QString::number(i)), 0, 0, 1, 0, Qt::AlignLeft); chanw->voltageActual = new QLabel("0.00"); QFont actualFont = chanw->voltageActual->font(); actualFont.setPointSize(20); chanw->voltageActual->setAlignment(Qt::AlignRight | Qt::AlignVCenter); chanw->voltageActual->setStyleSheet( QString("QLabel {padding-right: 0.5em;}")); chanw->voltageActual->setFont(actualFont); chanw->currentActual = new QLabel("0.000"); chanw->currentActual->setAlignment(Qt::AlignRight | Qt::AlignVCenter); chanw->currentActual->setStyleSheet( QString("QLabel {padding-right: 0.5em;}")); chanw->currentActual->setFont(actualFont); chanw->wattageActual = new QLabel("0.000"); chanw->wattageActual->setAlignment(Qt::AlignRight | Qt::AlignVCenter); chanw->wattageActual->setStyleSheet( QString("QLabel {padding-right: 0.5em;}")); chanw->wattageActual->setFont(actualFont); vawLayout->addWidget(chanw->voltageActual, 1, 0); vawLayout->addWidget(chanw->currentActual, 2, 0); vawLayout->addWidget(chanw->wattageActual, 3, 0); QLabel *vActualUnit = new QLabel("V"); vActualUnit->setSizePolicy(QSizePolicy::Policy::Fixed, QSizePolicy::Policy::Preferred); vActualUnit->setAlignment(Qt::AlignTop); QLabel *aActualUnit = new QLabel("A"); aActualUnit->setSizePolicy(QSizePolicy::Policy::Fixed, QSizePolicy::Policy::Preferred); aActualUnit->setAlignment(Qt::AlignTop); QLabel *wActualUnit = new QLabel("W"); wActualUnit->setSizePolicy(QSizePolicy::Policy::Fixed, QSizePolicy::Policy::Preferred); wActualUnit->setAlignment(Qt::AlignTop); vawLayout->addWidget(vActualUnit, 1, 1); vawLayout->addWidget(aActualUnit, 2, 1); vawLayout->addWidget(wActualUnit, 3, 1); QFrame *bottomContainer = new QFrame(); bottomContainer->setLayout(new QHBoxLayout()); channelFrameContainer->layout()->addWidget(bottomContainer); bottomContainer->layout()->setSpacing(0); bottomContainer->layout()->setContentsMargins(QMargins()); QFrame *setContainer = new QFrame(); setContainer->setObjectName("ch" + QString::number(i) + "setContainer"); QGridLayout *setContLayout = new QGridLayout(); setContainer->setLayout(setContLayout); QString setContainerQss = QString("QFrame#%1 {border-right: 1px solid ") + globcon::GREENCOLOR + ";}"; setContainer->setStyleSheet( setContainerQss.arg(setContainer->objectName())); chanw->voltageSet = new ClickableLabel("0.00"); chanw->currentSet = new ClickableLabel("0.000"); chanw->voltageSet->setAlignment(Qt::AlignRight | Qt::AlignVCenter); chanw->currentSet->setAlignment(Qt::AlignRight | Qt::AlignVCenter); // Now the lambdas for the set widgets QObject::connect( chanw->voltageSet, &ClickableLabel::doubleClick, [this, chanw, i](QPoint pos, double value) { this->controlValuesDialog( std::move(pos), chanw->voltageSet, global_constants::LPQ_DATATYPE::SETVOLTAGE, value); if (this->valuesDialog->exec()) { emit this->doubleValueChanged( this->valuesDialogData->voltage, static_cast<int>( global_constants::LPQ_DATATYPE::SETVOLTAGE), i); } }); QObject::connect( chanw->currentSet, &ClickableLabel::doubleClick, [this, chanw, i](QPoint pos, double value) { this->controlValuesDialog( std::move(pos), chanw->currentSet, global_constants::LPQ_DATATYPE::SETCURRENT, value); if (this->valuesDialog->exec()) { emit this->doubleValueChanged( this->valuesDialogData->current, static_cast<int>( global_constants::LPQ_DATATYPE::SETCURRENT), i); } }); QLabel *setLabel = new QLabel("Set"); setLabel->setAlignment(Qt::AlignCenter); QLabel *voltageSetUnit = new QLabel("V"); QFont bottomUnitFont = voltageSetUnit->font(); bottomUnitFont.setPointSize(8); voltageSetUnit->setFont(bottomUnitFont); voltageSetUnit->setSizePolicy(QSizePolicy::Policy::Fixed, QSizePolicy::Policy::Preferred); voltageSetUnit->setAlignment(Qt::AlignTop); QLabel *currentSetUnit = new QLabel("A"); currentSetUnit->setFont(bottomUnitFont); currentSetUnit->setSizePolicy(QSizePolicy::Policy::Fixed, QSizePolicy::Policy::Preferred); currentSetUnit->setAlignment(Qt::AlignTop); setContLayout->addWidget(setLabel, 0, 0, 1, 0); setContLayout->addWidget(chanw->voltageSet, 1, 0); setContLayout->addWidget(voltageSetUnit, 1, 1); setContLayout->addWidget(chanw->currentSet, 2, 0); setContLayout->addWidget(currentSetUnit, 2, 1); QFrame *modeOutputContainer = new QFrame(); modeOutputContainer->setLayout(new QVBoxLayout()); modeOutputContainer->layout()->setSpacing(0); modeOutputContainer->layout()->setContentsMargins(QMargins()); QFrame *modeContainer = new QFrame(); modeContainer->setLayout(new QHBoxLayout()); modeContainer->setObjectName("ch" + QString::number(i) + "modeContainer"); QString modeContainerQss = QString("QFrame#%1 {border-bottom: 1px solid ") + globcon::GREENCOLOR + ";}"; modeContainer->setStyleSheet( modeContainerQss.arg(modeContainer->objectName())); QLabel *modeLabel = new QLabel("Mode"); chanw->modeActual = new QLabel("CV"); modeContainer->layout()->addWidget(modeLabel); modeContainer->layout()->addWidget(chanw->modeActual); QFrame *outputContainer = new QFrame(); outputContainer->setLayout(new QHBoxLayout()); QLabel *outputLabel = new QLabel("Output"); chanw->outputSet = new ClickableLabel("Off"); chanw->outputSet->setNoReturnValue(true); QObject::connect( chanw->outputSet, &ClickableLabel::doubleClickNoValue, [this, chanw, i]() { emit this->deviceControlValueChanged( static_cast<int>(global_constants::LPQ_CONTROL::OUTPUT), i); }); outputContainer->layout()->addWidget(outputLabel); outputContainer->layout()->addWidget(chanw->outputSet); modeOutputContainer->layout()->addWidget(modeContainer); modeOutputContainer->layout()->addWidget(outputContainer); bottomContainer->layout()->addWidget(setContainer); bottomContainer->layout()->addWidget(modeOutputContainer); this->channelFramesVec.push_back(channelFrameContainer); // move semantics are needed here because unique_ptr does not allow // copying what push_back actually does. this->chanwVector.push_back(std::move(chanw)); } } }
NotificationDialog::NotificationDialog(Notification *notification, QWidget *parent) : QDialog(parent), m_notification(notification), m_closeLabel(NULL) { QFrame *notificationFrame = new QFrame(this); notificationFrame->setObjectName(QLatin1String("notificationFrame")); notificationFrame->setStyleSheet(QLatin1String("#notificationFrame {padding:5px;border:1px solid #CCC;border-radius:10px;background:#F0F0f0;}")); notificationFrame->setCursor(QCursor(Qt::PointingHandCursor)); notificationFrame->installEventFilter(this); QBoxLayout *mainLayout = new QBoxLayout(QBoxLayout::LeftToRight); mainLayout->setContentsMargins(0, 0, 0, 0); mainLayout->setSpacing(0); mainLayout->setSizeConstraint(QLayout::SetMinimumSize); mainLayout->addWidget(notificationFrame); QLabel *iconLabel = new QLabel(this); iconLabel->setPixmap(Utils::getIcon(QLatin1String("otter-browser-32")).pixmap(32, 32)); iconLabel->setStyleSheet(QLatin1String("padding:5px;")); QLabel *messageLabel = new QLabel(this); messageLabel->setText(m_notification->getMessage()); messageLabel->setStyleSheet(QLatin1String("padding:5px;font-size:13px;")); messageLabel->setWordWrap(true); QStyleOption option; option.rect = QRect(0, 0, 16, 16); QPixmap pixmap(16, 16); pixmap.fill(Qt::transparent); QPainter painter(&pixmap); style()->drawPrimitive(QStyle::PE_IndicatorTabClose, &option, &painter, this); m_closeLabel = new QLabel(notificationFrame); m_closeLabel->setToolTip(tr("Close")); m_closeLabel->setPixmap(pixmap); m_closeLabel->setAlignment(Qt::AlignTop); m_closeLabel->setMargin(5); m_closeLabel->installEventFilter(this); QBoxLayout *notificationLayout = new QBoxLayout(QBoxLayout::LeftToRight); notificationLayout->setContentsMargins(0, 0, 0, 0); notificationLayout->setSpacing(0); notificationLayout->setSizeConstraint(QLayout::SetMinimumSize); notificationLayout->addWidget(iconLabel); notificationLayout->addWidget(messageLabel); notificationLayout->addWidget(m_closeLabel); notificationFrame->setLayout(notificationLayout); setLayout(mainLayout); setFixedWidth(400); setMinimumHeight(50); setMaximumHeight(150); setWindowOpacity(0); setWindowFlags(Qt::WindowStaysOnTopHint | Qt::Tool | Qt::FramelessWindowHint); setFocusPolicy(Qt::NoFocus); setAttribute(Qt::WA_ShowWithoutActivating); setAttribute(Qt::WA_TranslucentBackground); adjustSize(); m_animation = new QPropertyAnimation(this, QStringLiteral("windowOpacity").toLatin1()); m_animation->setDuration(500); m_animation->setStartValue(0.0); m_animation->setEndValue(1.0); m_animation->start(); const int visibilityDuration = SettingsManager::getValue(QLatin1String("Interface/NotificationVisibilityDuration")).toInt(); if (visibilityDuration > 0) { QTimer::singleShot((visibilityDuration * 1000), this, SLOT(aboutToClose())); } }
void RunningScriptsWidget::setRunningScripts(const QStringList& list) { setUpdatesEnabled(false); QLayoutItem* widget; while ((widget = ui->scrollAreaWidgetContents->layout()->takeAt(0)) != NULL) { delete widget->widget(); delete widget; } QHash<QString, int> hash; const int CLOSE_ICON_HEIGHT = 12; for (int i = 0; i < list.size(); i++) { if (!hash.contains(list.at(i))) { hash.insert(list.at(i), 1); } QWidget* row = new QWidget(ui->scrollAreaWidgetContents); row->setLayout(new QHBoxLayout(row)); QUrl url = QUrl(list.at(i)); QLabel* name = new QLabel(url.fileName(), row); if (hash.find(list.at(i)).value() != 1) { name->setText(name->text() + "(" + QString::number(hash.find(list.at(i)).value()) + ")"); } ++hash[list.at(i)]; QPushButton* closeButton = new QPushButton(row); closeButton->setFlat(true); closeButton->setIcon( QIcon(QPixmap(Application::resourcesPath() + "images/kill-script.svg").scaledToHeight(CLOSE_ICON_HEIGHT))); closeButton->setSizePolicy(QSizePolicy(QSizePolicy::Maximum, QSizePolicy::Preferred)); closeButton->setStyleSheet("border: 0;"); closeButton->setCursor(Qt::PointingHandCursor); connect(closeButton, SIGNAL(clicked()), &_signalMapper, SLOT(map())); _signalMapper.setMapping(closeButton, url.toString()); row->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed)); row->layout()->setContentsMargins(4, 4, 4, 4); row->layout()->setSpacing(0); row->layout()->addWidget(name); row->layout()->addWidget(closeButton); row->setToolTip(url.toString()); QFrame* line = new QFrame(row); line->setFrameShape(QFrame::HLine); line->setStyleSheet("color: #E1E1E1; margin-left: 6px; margin-right: 6px;"); ui->scrollAreaWidgetContents->layout()->addWidget(row); ui->scrollAreaWidgetContents->layout()->addWidget(line); } ui->noRunningScriptsLabel->setVisible(list.isEmpty()); ui->reloadAllButton->setVisible(!list.isEmpty()); ui->stopAllButton->setVisible(!list.isEmpty()); ui->scrollAreaWidgetContents->updateGeometry(); setUpdatesEnabled(true); Application::processEvents(); repaint(); }
BitcoinGUI::BitcoinGUI(QWidget *parent) : QMainWindow(parent), clientModel(0), encryptWalletAction(0), changePassphraseAction(0), aboutQtAction(0), trayIcon(0), notificator(0), rpcConsole(0), prevBlocks(0) { setFixedSize(970, 550); setWindowTitle(tr("BitTor") + " " + tr("Wallet")); qApp->setStyleSheet("QMainWindow { background-image:url(:images/bkg);border:none;font-family:'Open Sans,sans-serif'; } #frame { } QToolBar QLabel { padding-top:15px;padding-bottom:10px;margin:0px; } #spacer { background:rgb(90,64,15);border:none; } #toolbar2 { border:none;width:10px; background-color:qlineargradient(x1: 0, y1: 0, x2: 0.5, y2: 0.5,stop: 0 rgb(170,99,203), stop: 1 rgb(255,255,58)); } #toolbar { border:none;height:100%;padding-top:20px; background: rgb(90,64,15); text-align: left; color: white;min-width:200px;max-width:200px;} QToolBar QToolButton:hover {background-color:qlineargradient(x1: 0, y1: 0, x2: 2, y2: 2,stop: 0 rgb(90,64,15), stop: 1 rgb(255,255,58),stop: 2 rgb(170,99,203));} QToolBar QToolButton { font-family:Century Gothic;padding-left:20px;padding-right:200px;padding-top:10px;padding-bottom:10px; width:100%; color: white; text-align: left; background-color: rgb(90,64,15) } #labelMiningIcon { padding-left:5px;font-family:Century Gothic;width:100%;font-size:10px;text-align:center;color:white; } QMenu { background: rgb(90,64,15); color:white; padding-bottom:10px; } QMenu::item { color:white; background-color: transparent; } QMenu::item:selected { background-color:qlineargradient(x1: 0, y1: 0, x2: 0.5, y2: 0.5,stop: 0 rgb(90,64,15), stop: 1 rgb(219,219,48)); } QMenuBar { background: rgb(90,64,15); color:white; } QMenuBar::item { font-size:12px;padding-bottom:12px;padding-top:12px;padding-left:15px;padding-right:15px;color:white; background-color: transparent; } QMenuBar::item:selected { background-color:qlineargradient(x1: 0, y1: 0, x2: 0.5, y2: 0.5,stop: 0 rgb(90,64,15), stop: 1 rgb(219,219,48)); }"); #ifndef Q_OS_MAC qApp->setWindowIcon(QIcon(":icons/bitcoin")); setWindowIcon(QIcon(":icons/bitcoin")); #else setUnifiedTitleAndToolBarOnMac(true); QApplication::setAttribute(Qt::AA_DontShowIconsInMenus); #endif // Create wallet frame and make it the central widget walletFrame = new WalletFrame(this); setCentralWidget(walletFrame); // Accept D&D of URIs setAcceptDrops(true); // Create actions for the toolbar, menu bar and tray/dock icon // Needs walletFrame to be initialized createActions(); // Create application menu bar createMenuBar(); // Create the toolbars createToolBars(); // Create system tray icon and notification createTrayIcon(); // Status bar notification icons QFrame *frameBlocks = new QFrame(); frameBlocks->setStyleSheet("frameBlocks { background: rgb(244,87,94); }"); frameBlocks->setContentsMargins(0,0,0,0); frameBlocks->setMinimumWidth(30); frameBlocks->setMaximumWidth(30); QVBoxLayout *frameBlocksLayout = new QVBoxLayout(frameBlocks); frameBlocksLayout->setContentsMargins(1,0,1,0); frameBlocksLayout->setSpacing(15); labelEncryptionIcon = new QLabel(); labelConnectionsIcon = new QLabel(); labelBlocksIcon = new QLabel(); frameBlocksLayout->addWidget(labelEncryptionIcon); frameBlocksLayout->addWidget(labelConnectionsIcon); frameBlocksLayout->addWidget(labelBlocksIcon); frameBlocksLayout->addStretch(); // 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->addWidget(frameBlocks); syncIconMovie = new QMovie(":/movies/update_spinner", "gif", this); rpcConsole = new RPCConsole(this); connect(openRPCConsoleAction, SIGNAL(triggered()), rpcConsole, SLOT(show())); // Install event filter to be able to catch status tip events (QEvent::StatusTip) this->installEventFilter(this); }