BorderlessToolButton::BorderlessToolButton(QString imagePathName, QWidget *parent) : QToolButton(parent), movingActivated(false), draggingEnabled(false) {
    setIconSize(QSize(10, 10));
    setStyleSheet("image: url(" + imagePathName + "); border: none; margin: 0px; padding: 0px;");
};
Beispiel #2
0
SplashScreen::SplashScreen(Qt::WindowFlags f, const NetworkStyle *networkStyle) :
    QWidget(0, f), curAlignment(0)
{

    // transparent background
    setAttribute(Qt::WA_TranslucentBackground);
    setStyleSheet("background:transparent;");

    // no window decorations
    setWindowFlags(Qt::FramelessWindowHint);

    // set reference point, paddings
    int paddingLeft             = 14;
    int paddingTop              = 470;
    int titleVersionVSpace      = 17;
    int titleCopyrightVSpace    = 22;

    float fontFactor            = 1.0;

    // define text to place
    QString titleText       = tr(PACKAGE_NAME);
    QString versionText     = QString(tr("Version %1")).arg(QString::fromStdString(FormatFullVersion()));
    QString copyrightText   = QString::fromUtf8(CopyrightHolders("\xc2\xA9", 2014, COPYRIGHT_YEAR).c_str());
    QString titleAddText    = networkStyle->getTitleAddText();
    // networkstyle.cpp can't (yet) read themes, so we do it here to get the correct Splash-screen
    QString splashScreenPath = ":/images/" + GUIUtil::getThemeName() + "/splash";
    if(GetBoolArg("-regtest", false))
        splashScreenPath = ":/images/" + GUIUtil::getThemeName() + "/splash_testnet";
    if(GetBoolArg("-testnet", false))
        splashScreenPath = ":/images/" + GUIUtil::getThemeName() + "/splash_testnet";
    if(IsArgSet("-devnet"))
        splashScreenPath = ":/images/" + GUIUtil::getThemeName() + "/splash_testnet";

    QString font = QApplication::font().toString();

    // load the bitmap for writing some text over it
    pixmap = QPixmap(splashScreenPath);

    QPainter pixPaint(&pixmap);
    pixPaint.setPen(QColor(100,100,100));

    // check font size and drawing with
    pixPaint.setFont(QFont(font, 28*fontFactor));
    QFontMetrics fm = pixPaint.fontMetrics();
    int titleTextWidth = fm.width(titleText);
    if (titleTextWidth > 160) {
        fontFactor = 0.75;
    }

    pixPaint.setFont(QFont(font, 28*fontFactor));
    fm = pixPaint.fontMetrics();
    titleTextWidth  = fm.width(titleText);
    pixPaint.drawText(paddingLeft,paddingTop,titleText);

    pixPaint.setFont(QFont(font, 15*fontFactor));
    pixPaint.drawText(paddingLeft,paddingTop+titleVersionVSpace,versionText);

    // draw copyright stuff
    {
        pixPaint.setFont(QFont(font, 10*fontFactor));
        const int x = paddingLeft;
        const int y = paddingTop+titleCopyrightVSpace;
        QRect copyrightRect(x, y, pixmap.width() - x, 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()-titleAddTextWidth-10,pixmap.height()-25,titleAddText);
    }

    pixPaint.end();

    // Resize window and move to center of desktop, disallow resizing
    QRect r(QPoint(), pixmap.size());
    resize(r.size());
    setFixedSize(r.size());
    move(QApplication::desktop()->screenGeometry().center() - r.center());

    subscribeToCoreSignals();
    installEventFilter(this);
}
void MainWindow::initBackground()
{
    setStyleSheet("MainWindow { background-image: url(:/back.png) }");
}
int QWidget::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QObject::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        if (_id < 23)
            qt_static_metacall(this, _c, _id, _a);
        _id -= 23;
    }
#ifndef QT_NO_PROPERTIES
      else if (_c == QMetaObject::ReadProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: *reinterpret_cast< bool*>(_v) = isModal(); break;
        case 1: *reinterpret_cast< Qt::WindowModality*>(_v) = windowModality(); break;
        case 2: *reinterpret_cast< bool*>(_v) = isEnabled(); break;
        case 3: *reinterpret_cast< QRect*>(_v) = geometry(); break;
        case 4: *reinterpret_cast< QRect*>(_v) = frameGeometry(); break;
        case 5: *reinterpret_cast< QRect*>(_v) = normalGeometry(); break;
        case 6: *reinterpret_cast< int*>(_v) = x(); break;
        case 7: *reinterpret_cast< int*>(_v) = y(); break;
        case 8: *reinterpret_cast< QPoint*>(_v) = pos(); break;
        case 9: *reinterpret_cast< QSize*>(_v) = frameSize(); break;
        case 10: *reinterpret_cast< QSize*>(_v) = size(); break;
        case 11: *reinterpret_cast< int*>(_v) = width(); break;
        case 12: *reinterpret_cast< int*>(_v) = height(); break;
        case 13: *reinterpret_cast< QRect*>(_v) = rect(); break;
        case 14: *reinterpret_cast< QRect*>(_v) = childrenRect(); break;
        case 15: *reinterpret_cast< QRegion*>(_v) = childrenRegion(); break;
        case 16: *reinterpret_cast< QSizePolicy*>(_v) = sizePolicy(); break;
        case 17: *reinterpret_cast< QSize*>(_v) = minimumSize(); break;
        case 18: *reinterpret_cast< QSize*>(_v) = maximumSize(); break;
        case 19: *reinterpret_cast< int*>(_v) = minimumWidth(); break;
        case 20: *reinterpret_cast< int*>(_v) = minimumHeight(); break;
        case 21: *reinterpret_cast< int*>(_v) = maximumWidth(); break;
        case 22: *reinterpret_cast< int*>(_v) = maximumHeight(); break;
        case 23: *reinterpret_cast< QSize*>(_v) = sizeIncrement(); break;
        case 24: *reinterpret_cast< QSize*>(_v) = baseSize(); break;
        case 25: *reinterpret_cast< QPalette*>(_v) = palette(); break;
        case 26: *reinterpret_cast< QFont*>(_v) = font(); break;
        case 27: *reinterpret_cast< QCursor*>(_v) = cursor(); break;
        case 28: *reinterpret_cast< bool*>(_v) = hasMouseTracking(); break;
        case 29: *reinterpret_cast< bool*>(_v) = isActiveWindow(); break;
        case 30: *reinterpret_cast< Qt::FocusPolicy*>(_v) = focusPolicy(); break;
        case 31: *reinterpret_cast< bool*>(_v) = hasFocus(); break;
        case 32: *reinterpret_cast< Qt::ContextMenuPolicy*>(_v) = contextMenuPolicy(); break;
        case 33: *reinterpret_cast< bool*>(_v) = updatesEnabled(); break;
        case 34: *reinterpret_cast< bool*>(_v) = isVisible(); break;
        case 35: *reinterpret_cast< bool*>(_v) = isMinimized(); break;
        case 36: *reinterpret_cast< bool*>(_v) = isMaximized(); break;
        case 37: *reinterpret_cast< bool*>(_v) = isFullScreen(); break;
        case 38: *reinterpret_cast< QSize*>(_v) = sizeHint(); break;
        case 39: *reinterpret_cast< QSize*>(_v) = minimumSizeHint(); break;
        case 40: *reinterpret_cast< bool*>(_v) = acceptDrops(); break;
        case 41: *reinterpret_cast< QString*>(_v) = windowTitle(); break;
        case 42: *reinterpret_cast< QIcon*>(_v) = windowIcon(); break;
        case 43: *reinterpret_cast< QString*>(_v) = windowIconText(); break;
        case 44: *reinterpret_cast< double*>(_v) = windowOpacity(); break;
        case 45: *reinterpret_cast< bool*>(_v) = isWindowModified(); break;
        case 46: *reinterpret_cast< QString*>(_v) = toolTip(); break;
        case 47: *reinterpret_cast< QString*>(_v) = statusTip(); break;
        case 48: *reinterpret_cast< QString*>(_v) = whatsThis(); break;
        case 49: *reinterpret_cast< QString*>(_v) = accessibleName(); break;
        case 50: *reinterpret_cast< QString*>(_v) = accessibleDescription(); break;
        case 51: *reinterpret_cast< Qt::LayoutDirection*>(_v) = layoutDirection(); break;
        case 52: *reinterpret_cast< bool*>(_v) = autoFillBackground(); break;
        case 53: *reinterpret_cast< QString*>(_v) = styleSheet(); break;
        case 54: *reinterpret_cast< QLocale*>(_v) = locale(); break;
        case 55: *reinterpret_cast< QString*>(_v) = windowFilePath(); break;
        case 56: *reinterpret_cast< Qt::InputMethodHints*>(_v) = inputMethodHints(); break;
        }
        _id -= 57;
    } else if (_c == QMetaObject::WriteProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 1: setWindowModality(*reinterpret_cast< Qt::WindowModality*>(_v)); break;
        case 2: setEnabled(*reinterpret_cast< bool*>(_v)); break;
        case 3: setGeometry(*reinterpret_cast< QRect*>(_v)); break;
        case 8: move(*reinterpret_cast< QPoint*>(_v)); break;
        case 10: resize(*reinterpret_cast< QSize*>(_v)); break;
        case 16: setSizePolicy(*reinterpret_cast< QSizePolicy*>(_v)); break;
        case 17: setMinimumSize(*reinterpret_cast< QSize*>(_v)); break;
        case 18: setMaximumSize(*reinterpret_cast< QSize*>(_v)); break;
        case 19: setMinimumWidth(*reinterpret_cast< int*>(_v)); break;
        case 20: setMinimumHeight(*reinterpret_cast< int*>(_v)); break;
        case 21: setMaximumWidth(*reinterpret_cast< int*>(_v)); break;
        case 22: setMaximumHeight(*reinterpret_cast< int*>(_v)); break;
        case 23: setSizeIncrement(*reinterpret_cast< QSize*>(_v)); break;
        case 24: setBaseSize(*reinterpret_cast< QSize*>(_v)); break;
        case 25: setPalette(*reinterpret_cast< QPalette*>(_v)); break;
        case 26: setFont(*reinterpret_cast< QFont*>(_v)); break;
        case 27: setCursor(*reinterpret_cast< QCursor*>(_v)); break;
        case 28: setMouseTracking(*reinterpret_cast< bool*>(_v)); break;
        case 30: setFocusPolicy(*reinterpret_cast< Qt::FocusPolicy*>(_v)); break;
        case 32: setContextMenuPolicy(*reinterpret_cast< Qt::ContextMenuPolicy*>(_v)); break;
        case 33: setUpdatesEnabled(*reinterpret_cast< bool*>(_v)); break;
        case 34: setVisible(*reinterpret_cast< bool*>(_v)); break;
        case 40: setAcceptDrops(*reinterpret_cast< bool*>(_v)); break;
        case 41: setWindowTitle(*reinterpret_cast< QString*>(_v)); break;
        case 42: setWindowIcon(*reinterpret_cast< QIcon*>(_v)); break;
        case 43: setWindowIconText(*reinterpret_cast< QString*>(_v)); break;
        case 44: setWindowOpacity(*reinterpret_cast< double*>(_v)); break;
        case 45: setWindowModified(*reinterpret_cast< bool*>(_v)); break;
        case 46: setToolTip(*reinterpret_cast< QString*>(_v)); break;
        case 47: setStatusTip(*reinterpret_cast< QString*>(_v)); break;
        case 48: setWhatsThis(*reinterpret_cast< QString*>(_v)); break;
        case 49: setAccessibleName(*reinterpret_cast< QString*>(_v)); break;
        case 50: setAccessibleDescription(*reinterpret_cast< QString*>(_v)); break;
        case 51: setLayoutDirection(*reinterpret_cast< Qt::LayoutDirection*>(_v)); break;
        case 52: setAutoFillBackground(*reinterpret_cast< bool*>(_v)); break;
        case 53: setStyleSheet(*reinterpret_cast< QString*>(_v)); break;
        case 54: setLocale(*reinterpret_cast< QLocale*>(_v)); break;
        case 55: setWindowFilePath(*reinterpret_cast< QString*>(_v)); break;
        case 56: setInputMethodHints(*reinterpret_cast< Qt::InputMethodHints*>(_v)); break;
        }
        _id -= 57;
    } else if (_c == QMetaObject::ResetProperty) {
        switch (_id) {
        case 27: unsetCursor(); break;
        case 51: unsetLayoutDirection(); break;
        case 54: unsetLocale(); break;
        }
        _id -= 57;
    } else if (_c == QMetaObject::QueryPropertyDesignable) {
        bool *_b = reinterpret_cast<bool*>(_a[0]);
        switch (_id) {
        case 41: *_b = isWindow(); break;
        case 42: *_b = isWindow(); break;
        case 43: *_b = isWindow(); break;
        case 44: *_b = isWindow(); break;
        case 45: *_b = isWindow(); break;
        case 55: *_b = isWindow(); break;
        }
        _id -= 57;
    } else if (_c == QMetaObject::QueryPropertyScriptable) {
        _id -= 57;
    } else if (_c == QMetaObject::QueryPropertyStored) {
        _id -= 57;
    } else if (_c == QMetaObject::QueryPropertyEditable) {
        _id -= 57;
    } else if (_c == QMetaObject::QueryPropertyUser) {
        _id -= 57;
    }
#endif // QT_NO_PROPERTIES
    return _id;
}
FormEditorWidget::FormEditorWidget(FormEditorView *view)
    : QWidget(),
    m_formEditorView(view)
{
    QFile file(":/qmldesigner/formeditorstylesheet.css");
    file.open(QFile::ReadOnly);
    QString styleSheet = QLatin1String(file.readAll());
    setStyleSheet(styleSheet);

    QVBoxLayout *fillLayout = new QVBoxLayout(this);
    fillLayout->setMargin(0);
    fillLayout->setSpacing(0);
    setLayout(fillLayout);

    QList<QAction*> upperActions;

    m_toolActionGroup = new QActionGroup(this);

    m_transformToolAction = m_toolActionGroup->addAction("Transform Tool (Press Key Q)");
    m_transformToolAction->setShortcut(Qt::Key_Q);
    m_transformToolAction->setShortcutContext(Qt::WidgetWithChildrenShortcut);
    m_transformToolAction->setCheckable(true);
    m_transformToolAction->setChecked(true);
    m_transformToolAction->setIcon(QPixmap(":/icon/tool/transform.png"));
    connect(m_transformToolAction.data(), SIGNAL(triggered(bool)), SLOT(changeTransformTool(bool)));

    m_anchorToolAction = m_toolActionGroup->addAction("Anchor Tool (Press Key W)");
    m_anchorToolAction->setShortcut(Qt::Key_W);
    m_anchorToolAction->setShortcutContext(Qt::WidgetWithChildrenShortcut);
    m_anchorToolAction->setCheckable(true);
    m_anchorToolAction->setIcon(QPixmap(":/icon/tool/anchor.png"));
    connect(m_anchorToolAction.data(), SIGNAL(triggered(bool)), SLOT(changeAnchorTool(bool)));

//    addActions(m_toolActionGroup->actions());
//    upperActions.append(m_toolActionGroup->actions());

    QActionGroup *layoutActionGroup = new QActionGroup(this);
    layoutActionGroup->setExclusive(false);
    m_snappingAction = layoutActionGroup->addAction(tr("Snap to guides (E)"));
    m_snappingAction->setShortcut(Qt::Key_E);
    m_snappingAction->setShortcutContext(Qt::WidgetWithChildrenShortcut);
    m_snappingAction->setCheckable(true);
    m_snappingAction->setChecked(true);
    m_snappingAction->setIcon(QPixmap(":/icon/layout/snapping.png"));

    m_snappingAndAnchoringAction = layoutActionGroup->addAction("Toogle Snapping And Anchoring (Press Key R)");
    m_snappingAndAnchoringAction->setShortcut(Qt::Key_R);
    m_snappingAndAnchoringAction->setShortcutContext(Qt::WidgetWithChildrenShortcut);
    m_snappingAndAnchoringAction->setCheckable(true);
    m_snappingAndAnchoringAction->setChecked(false);
    m_snappingAndAnchoringAction->setEnabled(false);
    m_snappingAndAnchoringAction->setVisible(false);
    m_snappingAndAnchoringAction->setIcon(QPixmap(":/icon/layout/snapping_and_anchoring.png"));

    addActions(layoutActionGroup->actions());
    upperActions.append(layoutActionGroup->actions());

    QAction *separatorAction = new QAction(this);
    separatorAction->setSeparator(true);
    addAction(separatorAction);
    upperActions.append(separatorAction);

    m_showBoundingRectAction = new QAction(tr("Show bounding rectangles (A)"), this);
    m_showBoundingRectAction->setShortcut(Qt::Key_A);
    m_showBoundingRectAction->setShortcutContext(Qt::WidgetWithChildrenShortcut);
    m_showBoundingRectAction->setCheckable(true);
    m_showBoundingRectAction->setChecked(true);
    m_showBoundingRectAction->setIcon(QPixmap(":/icon/layout/boundingrect.png"));

    addAction(m_showBoundingRectAction.data());
    upperActions.append(m_showBoundingRectAction.data());

    m_selectOnlyContentItemsAction = new QAction(tr("Only select items with content (S)"), this);
    m_selectOnlyContentItemsAction->setShortcut(Qt::Key_S);
    m_selectOnlyContentItemsAction->setShortcutContext(Qt::WidgetWithChildrenShortcut);
    m_selectOnlyContentItemsAction->setCheckable(true);
    m_selectOnlyContentItemsAction->setChecked(false);
    m_selectOnlyContentItemsAction->setIcon(QPixmap(":/icon/selection/selectonlycontentitems.png"));

    addAction(m_selectOnlyContentItemsAction.data());
    upperActions.append(m_selectOnlyContentItemsAction.data());

    m_rootWidthAction = new LineEditAction("width", this);
    connect(m_rootWidthAction.data(), SIGNAL(textChanged(QString)), this, SLOT(changeRootItemWidth(QString)));
    addAction(m_rootWidthAction.data());
    upperActions.append(m_rootWidthAction.data());

    m_rootHeightAction =  new LineEditAction("height", this);
    connect(m_rootHeightAction.data(), SIGNAL(textChanged(QString)), this, SLOT(changeRootItemHeight(QString)));
    addAction(m_rootHeightAction.data());
    upperActions.append(m_rootHeightAction.data());

    m_snappingAndAnchoringAction = layoutActionGroup->addAction("Toogle Snapping And Anchoring (Press Key R)");

    m_toolBox = new ToolBox(this);
    fillLayout->addWidget(m_toolBox.data());
    m_toolBox->setLeftSideActions(upperActions);

    m_graphicsView = new FormEditorGraphicsView(this);
    fillLayout->addWidget(m_graphicsView.data());

    {
        QFile file(":/qmldesigner/scrollbar.css");
        file.open(QFile::ReadOnly);
        m_graphicsView.data()->setStyleSheet(file.readAll());
    }

    QList<QAction*> lowerActions;

    m_zoomAction = new ZoomAction(m_toolActionGroup.data());
    connect(m_zoomAction.data(), SIGNAL(zoomLevelChanged(double)), SLOT(setZoomLevel(double)));
    addAction(m_zoomAction.data());
    upperActions.append(m_zoomAction.data());
    m_toolBox->addRightSideAction(m_zoomAction.data());
}
void DPushButton::setTextColor(const QString &colorStr){
    QString style = sStyleTemplate.arg(colorStr);
    setStyleSheet(style);
}
Beispiel #7
0
PgxConsole::PgxConsole(Database *database)
{
    this->database = database;
    insertPlainText("");
    setViewportMargins(10, 0, 0, 0);
    setTabStopWidth(40);
    setUndoRedoEnabled(false);
    setWindowTitle(QApplication::translate("PgxConsole", "SQL console", 0, QApplication::UnicodeUTF8));
    setStyleSheet("QPlainTextEdit{background-color: white; font: bold 14px 'Courier New';}");

    createActions();

    highlighter = new Highlighter(document());
    prompt = new Prompt(this);

    toolbar = new QToolBar;
    toolbar->setIconSize(QSize(36,36));
    toolbar->setObjectName("pgxeditor");
    toolbar->setMovable(false);
    toolbar->addAction(cut_action);
    toolbar->addAction(copy_action);
    toolbar->addAction(paste_action);
    toolbar->addSeparator();
    toolbar->addAction(clear_action);
    toolbar->addAction(find_action);

    mainwin = new PgxConsoleMainWindow;
    mainwin->addToolBar(toolbar);
    mainwin->setCentralWidget(this);
    mainwin->setAttribute(Qt::WA_DeleteOnClose);

    find_bar = new QLineEdit;
    find_bar->setPlaceholderText(tr("Find"));
    find_bar->setVisible(false);
    mainwin->statusBar()->setSizeGripEnabled(false);
    mainwin->statusBar()->addPermanentWidget(casesensitivity_button, 0);
    mainwin->statusBar()->addPermanentWidget(wholeword_button, 0);
    mainwin->statusBar()->addPermanentWidget(backwards_button, 0);
    mainwin->statusBar()->addPermanentWidget(find_bar);

    connect(find_bar, SIGNAL(returnPressed()), this, SLOT(findText()));

    QShortcut *shortcut_paste = new QShortcut(QKeySequence::Paste, this);
    connect(shortcut_paste, SIGNAL(activated()), this, SLOT(pasteFromClipboard()));

    QShortcut *shortcut_single_paste = new QShortcut(QKeySequence("Ctrl+Shift+V"), this);
    connect(shortcut_single_paste, SIGNAL(activated()), this, SLOT(pasteAsSingleFromClipboard()));

    connect(this, SIGNAL(cursorPositionChanged()), this, SLOT(makePreviousBlocksReadonly()));

    //Tie command with QueryView creation.
    connect(this, SIGNAL(commandSignal(QString)), this, SLOT(showView(QString)));

    //Tie up and down keys with command history scolling.
    connect(this, SIGNAL(historyUp()), this, SLOT(historyUpCommand()));
    connect(this, SIGNAL(historyDown()), this, SLOT(historyDownCommand()));

    //Console updates.
    connect(this, SIGNAL(updateRequest(QRect,int)), this, SLOT(updatePrompt(QRect,int)));
    connect(mainwin, SIGNAL(pgxconsoleClosing()), this, SLOT(pgxconsoleClosing()));
}
Beispiel #8
0
void EmoticonLabel::updateStyleSheet(bool hover)
{
  setStyleSheet(LS("EmoticonLabel {background: ") + (hover ? LS("#eee") : LS("#fff")) + LS("; border-right: 1px solid #eee; border-bottom: 1px solid #eee;}"));
}
StartupView::StartupView( QWidget * parent ) 
  : QWidget( parent )
{
  m_templateListModel = std::shared_ptr<TemplateListModel>( new TemplateListModel() );

  setStyleSheet("openstudio--StartupView { background: #E6E6E6; }");
  
#ifdef Q_OS_MAC
  setWindowFlags(Qt::FramelessWindowHint);
#else
  setWindowFlags(Qt::CustomizeWindowHint);
#endif

  auto recentProjectsView = new QWidget();
  recentProjectsView->setStyleSheet("QWidget { background: #F2F2F2; }");
  auto recentProjectsLayout = new QVBoxLayout();
  recentProjectsLayout->setContentsMargins(10,10,10,10);
  QLabel * recentProjectsLabel = new QLabel("Recent Projects");
  recentProjectsLabel->setStyleSheet("QLabel { font: bold }");
  recentProjectsLayout->addWidget(recentProjectsLabel,0,Qt::AlignTop);
  recentProjectsView->setLayout(recentProjectsLayout);

  auto openButton = new QToolButton();
  openButton->setText("Open File");
  openButton->setStyleSheet("QToolButton { font: bold; }");
  openButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
  QIcon openIcon(":/images/open_file.png");
  openButton->setIcon(openIcon);
  openButton->setIconSize(QSize(40,40));
  connect(openButton, &QToolButton::clicked, this, &StartupView::openClicked);
  auto importButton = new QToolButton();
  importButton->setText("Import Idf");
  importButton->setStyleSheet("QToolButton { font: bold; }");
  importButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
  QIcon importIcon(":/images/import_file.png");
  importButton->setIcon(importIcon);
  importButton->setIconSize(QSize(40,40));
  connect(importButton, &QToolButton::clicked, this, &StartupView::importClicked);
/*  
  QToolButton * importSDDButton = new QToolButton();
  importSDDButton->setText("Import SDD");
  importSDDButton->setStyleSheet("QToolButton { font: bold; }");
  importSDDButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
  QIcon importSDDIcon(":/images/import_file.png");
  importSDDButton->setIcon(importSDDIcon);
  importSDDButton->setIconSize(QSize(40,40));
  connect(importSDDButton, &QToolButton::clicked, this, &StartupView::importSDDClicked);
*/
  auto projectChooserView = new QWidget();
  projectChooserView->setFixedWidth(238);
  projectChooserView->setStyleSheet("QWidget { background: #F2F2F2; }");
  auto projectChooserLayout = new QVBoxLayout();
  projectChooserLayout->setContentsMargins(10,10,10,10);
  QLabel * projectChooserLabel = new QLabel("Create New From Template");
  projectChooserLabel->setStyleSheet("QLabel { font: bold }");
  projectChooserLayout->addWidget(projectChooserLabel,0,Qt::AlignTop);
  m_listView = new QListView();
  m_listView->setViewMode(QListView::IconMode);
  m_listView->setModel(m_templateListModel.get());
  m_listView->setFocusPolicy(Qt::NoFocus);
  m_listView->setFlow(QListView::LeftToRight);
  m_listView->setUniformItemSizes(true);
  m_listView->setSelectionMode(QAbstractItemView::SingleSelection);
  projectChooserLayout->addWidget(m_listView);
  projectChooserView->setLayout(projectChooserLayout);

  m_projectDetailView = new QWidget();
  m_projectDetailView->setStyleSheet("QWidget { background: #F2F2F2; }");
  auto projectDetailLayout = new QVBoxLayout();
  projectDetailLayout->setContentsMargins(10,10,10,10);
  m_projectDetailView->setLayout(projectDetailLayout);

  auto footerView = new QWidget();
  footerView->setObjectName("FooterView");
  footerView->setStyleSheet("QWidget#FooterView { background: #E6E6E6; }");
  footerView->setMaximumHeight(50);
  footerView->setMinimumHeight(50);

  auto cancelButton = new QPushButton();
  cancelButton->setObjectName("StandardGrayButton");
  cancelButton->setMinimumSize(QSize(99,28));
  #ifdef OPENSTUDIO_PLUGIN
    cancelButton->setText("Cancel");
    connect(cancelButton, &QPushButton::clicked, this, &StartupView::hide);
  #else
    #ifdef Q_OS_MAC
      cancelButton->setText("Quit");
    #else
      cancelButton->setText("Exit");
    #endif
    connect(cancelButton, &QPushButton::clicked, OpenStudioApp::instance(), &OpenStudioApp::quit);
  #endif
  cancelButton->setStyleSheet("QPushButton { font: bold; }");

  auto chooseButton = new QPushButton();
  chooseButton->setObjectName("StandardBlueButton");
  chooseButton->setText("Choose");
  chooseButton->setMinimumSize(QSize(99,28));
  connect(chooseButton, &QPushButton::clicked, this, &StartupView::newFromTemplateSlot);
  chooseButton->setStyleSheet("QPushButton { font: bold; }");

  auto hFooterLayout = new QHBoxLayout();
  hFooterLayout->setSpacing(25);
  hFooterLayout->setContentsMargins(0,0,0,0);
  hFooterLayout->addStretch();
  hFooterLayout->addWidget(cancelButton);
  hFooterLayout->addWidget(chooseButton);
  footerView->setLayout(hFooterLayout);

  auto hLayout = new QHBoxLayout();
  auto vLayout = new QVBoxLayout();

  auto vOpenLayout = new QVBoxLayout();
  vOpenLayout->addWidget(recentProjectsView);
  vOpenLayout->addWidget(openButton);
  vOpenLayout->addWidget(importButton);
  //vOpenLayout->addWidget(importSDDButton);

  hLayout->addLayout(vOpenLayout);
  hLayout->addWidget(projectChooserView);
  hLayout->addWidget(m_projectDetailView,1);

  vLayout->addSpacing(50);
  vLayout->addLayout(hLayout);
  vLayout->addWidget(footerView);

  setLayout(vLayout);

  connect(m_listView, &QListView::clicked, this, &StartupView::showDetailsForItem);

  m_listView->setCurrentIndex(m_templateListModel->index(0,0));
  showDetailsForItem(m_templateListModel->index(0,0));
}
Beispiel #10
0
ProcessorOutputPortWidget::ProcessorOutputPortWidget(int filterId, const PortInfo &info, QWidget *parent)
    : FilterPortWidget(filterId, info, parent)
{
    setStyleSheet("background-color: #8080f0;");
    connect(this, SIGNAL(rename(PortId, QString)), &OlvisSingleton::instance(), SLOT(renameProcessorOutput(PortId,QString)));
}
CaptureFilterEdit::CaptureFilterEdit(QWidget *parent, bool plain) :
    SyntaxLineEdit(parent),
    plain_(plain),
    field_name_only_(false),
    enable_save_action_(false),
    save_action_(NULL),
    remove_action_(NULL),
    bookmark_button_(NULL),
    clear_button_(NULL),
    apply_button_(NULL)
{
    setAccessibleName(tr("Capture filter entry"));

    completion_model_ = new QStringListModel(this);
    setCompleter(new QCompleter(completion_model_, this));
    setCompletionTokenChars(libpcap_primitive_chars_);

    placeholder_text_ = QString(tr("Enter a capture filter %1")).arg(UTF8_HORIZONTAL_ELLIPSIS);
#if QT_VERSION >= QT_VERSION_CHECK(4, 7, 0)
    setPlaceholderText(placeholder_text_);
#endif

    if (!plain_) {
        bookmark_button_ = new StockIconToolButton(this, "x-capture-filter-bookmark");
        bookmark_button_->setCursor(Qt::ArrowCursor);
        bookmark_button_->setMenu(new QMenu());
        bookmark_button_->setPopupMode(QToolButton::InstantPopup);
        bookmark_button_->setToolTip(tr("Manage saved bookmarks."));
        bookmark_button_->setIconSize(QSize(14, 14));
        bookmark_button_->setStyleSheet(
                    "QToolButton {"
                    "  border: none;"
                    "  background: transparent;" // Disables platform style on Windows.
                    "  padding: 0 0 0 0;"
                    "}"
                    "QToolButton::menu-indicator { image: none; }"
            );
        connect(bookmark_button_, SIGNAL(clicked()), this, SLOT(bookmarkClicked()));
    }

    if (!plain_) {
        clear_button_ = new StockIconToolButton(this, "x-filter-clear");
        clear_button_->setCursor(Qt::ArrowCursor);
        clear_button_->setToolTip(QString());
        clear_button_->setIconSize(QSize(14, 14));
        clear_button_->setStyleSheet(
                "QToolButton {"
                "  border: none;"
                "  background: transparent;" // Disables platform style on Windows.
                "  padding: 0 0 0 0;"
                "  margin-left: 1px;"
                "}"
                );
        connect(clear_button_, SIGNAL(clicked()), this, SLOT(clearFilter()));
    }

    connect(this, SIGNAL(textChanged(const QString&)), this, SLOT(checkFilter(const QString&)));

#if 0
    // Disable the apply button for now
    if (!plain_) {
        apply_button_ = new StockIconToolButton(this, "x-filter-apply");
        apply_button_->setCursor(Qt::ArrowCursor);
        apply_button_->setEnabled(false);
        apply_button_->setToolTip(tr("Apply this filter string to the display."));
        apply_button_->setIconSize(QSize(24, 14));
        apply_button_->setStyleSheet(
                "QToolButton {"
                "  border: none;"
                "  background: transparent;" // Disables platform style on Windows.
                "  padding: 0 0 0 0;"
                "}"
                );
        connect(apply_button_, SIGNAL(clicked()), this, SLOT(applyCaptureFilter()));
    }
#endif
    connect(this, SIGNAL(returnPressed()), this, SLOT(applyCaptureFilter()));

    int frameWidth = style()->pixelMetric(QStyle::PM_DefaultFrameWidth);
    QSize bksz;
    if (bookmark_button_) bksz = bookmark_button_->sizeHint();
    QSize cbsz;
    if (clear_button_) cbsz = clear_button_->sizeHint();
    QSize apsz;
    if (apply_button_) apsz = apply_button_->sizeHint();

    setStyleSheet(QString(
            "CaptureFilterEdit {"
            "  padding-left: %1px;"
            "  margin-left: %2px;"
            "  margin-right: %3px;"
            "}"
            )
            .arg(frameWidth + 1)
            .arg(bksz.width())
            .arg(cbsz.width() + apsz.width() + frameWidth + 1)
            );

    QComboBox *cf_combo = qobject_cast<QComboBox *>(parent);
    if (cf_combo) {
        connect(cf_combo, SIGNAL(activated(QString)), this, SIGNAL(textEdited(QString)));
    }

    QThread *syntax_thread = new QThread;
    syntax_worker_ = new CaptureFilterSyntaxWorker;
    syntax_worker_->moveToThread(syntax_thread);
    connect(wsApp, SIGNAL(appInitialized()), this, SLOT(initCaptureFilter()));
    connect(wsApp, SIGNAL(captureFilterListChanged()), this, SLOT(updateBookmarkMenu()));
    connect(syntax_thread, SIGNAL(started()), syntax_worker_, SLOT(start()));
    connect(syntax_thread, SIGNAL(started()), this, SLOT(checkFilter()));
    connect(syntax_worker_, SIGNAL(syntaxResult(QString,int,QString)),
            this, SLOT(setFilterSyntaxState(QString,int,QString)));
    connect(syntax_thread, SIGNAL(finished()), syntax_worker_, SLOT(deleteLater()));
    syntax_thread->start();
}
Beispiel #12
0
void PhasesDisplayer::SetStackTimerActivated(bool a){
	StackTimerActivated=a;
	PhaseTimer->setToolTip(a ? tr("Response Time"):tr("Phase Time"));
	setStyleSheet(StyleSheets::PhasesDisplayerCSS);
}
Beispiel #13
0
/**
 * @brief MainWindow::MainWindow
 * @param parent
 */
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    MainWindow::m_instance = this;

    qDebug() << "MediaElch version" << QApplication::applicationVersion() << "starting up";

    for (int i=WidgetMovies ; i!=WidgetCertifications ; i++) {
        QMap<MainActions, bool> actions;
        for (int n=ActionSearch ; n!=ActionExport ; n++) {
            actions.insert(static_cast<MainActions>(n), false);
        }
        if (static_cast<MainWidgets>(i) == WidgetMovies || static_cast<MainWidgets>(i) == WidgetTvShows || static_cast<MainWidgets>(i) == WidgetConcerts)
            actions[ActionFilterWidget] = true;
        m_actions.insert(static_cast<MainWidgets>(i), actions);
    }

    m_aboutDialog = new AboutDialog(ui->centralWidget);
    m_supportDialog = new SupportDialog(ui->centralWidget);
    m_settingsWindow = new SettingsWindow(ui->centralWidget);
    m_filterWidget = new FilterWidget();
    m_fileScannerDialog = new FileScannerDialog(ui->centralWidget);
    m_xbmcSync = new XbmcSync(ui->centralWidget);
    m_renamer = new Renamer(ui->centralWidget);
    m_settings = Settings::instance(this);
    m_exportDialog = new ExportDialog(this);
    setupToolbar();

    MessageBox::instance(this)->reposition(this->size());
    Manager::instance();

    if (!m_settings->mainSplitterState().isNull()) {
        ui->movieSplitter->restoreState(m_settings->mainSplitterState());
        ui->tvShowSplitter->restoreState(m_settings->mainSplitterState());
        ui->setsWidget->splitter()->restoreState(m_settings->mainSplitterState());
        ui->concertSplitter->restoreState(m_settings->mainSplitterState());
        ui->genreWidget->splitter()->restoreState(m_settings->mainSplitterState());
        ui->certificationWidget->splitter()->restoreState(m_settings->mainSplitterState());
    }

    if (m_settings->mainWindowSize().isValid() && !m_settings->mainWindowPosition().isNull()) {
        #ifdef Q_OS_MAC
            // Ugly workaround from https://bugreports.qt-project.org/browse/QTBUG-3116
            // to fix invisible toolbar on mac
            bool workaround = !isVisible();
            if (workaround) {
                // make "invisible"
                setWindowOpacity(0); // let Qt update its frameStruts
                show();
            }
            resize(m_settings->mainWindowSize());
            if (workaround) {
                move(m_settings->mainWindowPosition());
                setWindowOpacity(1);
            }
        #else
        resize(m_settings->mainWindowSize());
        move(m_settings->mainWindowPosition());
        #endif
        #ifdef Q_OS_WIN32
        if (m_settings->mainWindowMaximized())
            showMaximized();
        #endif
    }
    // Size for Screenshots
    // resize(1121, 735);

    #ifdef Q_OS_MAC
        MacFullscreen::addFullscreen(this);
    #endif

    connect(ui->filesWidget, SIGNAL(movieSelected(Movie*)), ui->movieWidget, SLOT(setMovie(Movie*)));
    connect(ui->filesWidget, SIGNAL(movieSelected(Movie*)), ui->movieWidget, SLOT(setEnabledTrue(Movie*)));
    connect(ui->filesWidget, SIGNAL(noMovieSelected()), ui->movieWidget, SLOT(clear()));
    connect(ui->filesWidget, SIGNAL(noMovieSelected()), ui->movieWidget, SLOT(setDisabledTrue()));
    connect(ui->filesWidget, SIGNAL(sigStartSearch()), this, SLOT(onActionSearch()));

    connect(ui->concertFilesWidget, SIGNAL(concertSelected(Concert*)), ui->concertWidget, SLOT(setConcert(Concert*)));
    connect(ui->concertFilesWidget, SIGNAL(concertSelected(Concert*)), ui->concertWidget, SLOT(setEnabledTrue(Concert*)));
    connect(ui->concertFilesWidget, SIGNAL(noConcertSelected()), ui->concertWidget, SLOT(clear()));
    connect(ui->concertFilesWidget, SIGNAL(noConcertSelected()), ui->concertWidget, SLOT(setDisabledTrue()));

    connect(ui->tvShowFilesWidget, SIGNAL(sigTvShowSelected(TvShow*)), ui->tvShowWidget, SLOT(onTvShowSelected(TvShow*)));
    connect(ui->tvShowFilesWidget, SIGNAL(sigSeasonSelected(TvShow*,int)), ui->tvShowWidget, SLOT(onSeasonSelected(TvShow*,int)));
    connect(ui->tvShowFilesWidget, SIGNAL(sigEpisodeSelected(TvShowEpisode*)), ui->tvShowWidget, SLOT(onEpisodeSelected(TvShowEpisode*)));
    connect(ui->tvShowFilesWidget, SIGNAL(sigTvShowSelected(TvShow*)), ui->tvShowWidget, SLOT(onSetEnabledTrue(TvShow*)));
    connect(ui->tvShowFilesWidget, SIGNAL(sigSeasonSelected(TvShow*,int)), ui->tvShowWidget, SLOT(onSetEnabledTrue(TvShow*, int)));
    connect(ui->tvShowFilesWidget, SIGNAL(sigEpisodeSelected(TvShowEpisode*)), ui->tvShowWidget, SLOT(onSetEnabledTrue(TvShowEpisode*)));
    connect(ui->tvShowFilesWidget, SIGNAL(sigNothingSelected()), ui->tvShowWidget, SLOT(onClear()));
    connect(ui->tvShowFilesWidget, SIGNAL(sigNothingSelected()), ui->tvShowWidget, SLOT(onSetDisabledTrue()));

    connect(ui->movieWidget, SIGNAL(actorDownloadProgress(int,int,int)), this, SLOT(progressProgress(int,int,int)));
    connect(ui->movieWidget, SIGNAL(actorDownloadStarted(QString,int)), this, SLOT(progressStarted(QString,int)));
    connect(ui->movieWidget, SIGNAL(actorDownloadFinished(int)), this, SLOT(progressFinished(int)));

    connect(ui->tvShowWidget, SIGNAL(sigDownloadsStarted(QString,int)), this, SLOT(progressStarted(QString,int)));
    connect(ui->tvShowWidget, SIGNAL(sigDownloadsProgress(int,int,int)), this, SLOT(progressProgress(int,int,int)));
    connect(ui->tvShowWidget, SIGNAL(sigDownloadsFinished(int)), this, SLOT(progressFinished(int)));

    connect(m_filterWidget, SIGNAL(sigFilterChanged(QList<Filter*>,QString)), this, SLOT(onFilterChanged(QList<Filter*>,QString)));

    connect(ui->movieSplitter, SIGNAL(splitterMoved(int,int)), this, SLOT(moveSplitter(int,int)));
    connect(ui->tvShowSplitter, SIGNAL(splitterMoved(int,int)), this, SLOT(moveSplitter(int,int)));
    connect(ui->setsWidget->splitter(), SIGNAL(splitterMoved(int,int)), this, SLOT(moveSplitter(int,int)));
    connect(ui->genreWidget->splitter(), SIGNAL(splitterMoved(int,int)), this, SLOT(moveSplitter(int,int)));
    connect(ui->certificationWidget->splitter(), SIGNAL(splitterMoved(int,int)), this, SLOT(moveSplitter(int,int)));
    connect(ui->concertSplitter, SIGNAL(splitterMoved(int,int)), this, SLOT(moveSplitter(int,int)));

    connect(Manager::instance()->tvShowFileSearcher(), SIGNAL(tvShowsLoaded(int)), ui->tvShowFilesWidget, SLOT(renewModel()));
    connect(m_fileScannerDialog, SIGNAL(accepted()), this, SLOT(setNewMarks()));

    connect(m_xbmcSync, SIGNAL(sigTriggerReload()), this, SLOT(onTriggerReloadAll()));
    connect(m_xbmcSync, SIGNAL(sigFinished()), this, SLOT(onXbmcSyncFinished()));

    connect(m_renamer, SIGNAL(sigFilesRenamed(Renamer::RenameType)), this, SLOT(onFilesRenamed(Renamer::RenameType)));

    connect(m_settingsWindow, SIGNAL(sigSaved()), this, SLOT(onRenewModels()), Qt::QueuedConnection);

    connect(ui->setsWidget, SIGNAL(sigJumpToMovie(Movie*)), this, SLOT(onJumpToMovie(Movie*)));
    connect(ui->certificationWidget, SIGNAL(sigJumpToMovie(Movie*)), this, SLOT(onJumpToMovie(Movie*)));
    connect(ui->genreWidget, SIGNAL(sigJumpToMovie(Movie*)), this, SLOT(onJumpToMovie(Movie*)));

    MovieSearch::instance(ui->centralWidget);
    TvShowSearch::instance(ui->centralWidget);
    ImageDialog::instance(ui->centralWidget);
    MovieListDialog::instance(ui->centralWidget);
    ImagePreviewDialog::instance(ui->centralWidget);
    ConcertSearch::instance(ui->centralWidget);
    TrailerDialog::instance(ui->centralWidget);
    TvTunesDialog::instance(ui->centralWidget);
    NameFormatter::instance(this);
    MovieMultiScrapeDialog::instance(ui->centralWidget);

#ifdef Q_OS_WIN32
    setStyleSheet(styleSheet() + " #centralWidget { border-bottom: 1px solid rgba(0, 0, 0, 100); } ");

    QFont font = ui->labelMovies->font();
    font.setPointSize(font.pointSize()-3);
    font.setBold(true);
    ui->labelMovies->setFont(font);
    ui->labelConcerts->setFont(font);
    ui->labelShows->setFont(font);
#endif

    // hack. without only the fileScannerDialog pops up and blocks until it has finished
    show();
    onMenu(WidgetMovies);

    // Start scanning for files
    QTimer::singleShot(0, m_fileScannerDialog, SLOT(exec()));
}
ATCMprogressbar::ATCMprogressbar(QWidget *parent) :
    QProgressBar(parent)
{
    m_lastVisibility = false;
    m_value = 0;
    m_variable = "";
    m_status = STATUS_ENABLED;
    m_CtIndex = -1;
    m_CtVisibilityIndex = -1;
    m_barColor = QColor(255,127,80);
    m_visibilityvar = "";
    m_viewstatus = false;

    m_bgcolor = BG_COLOR_DEF;
    m_bordercolor = BORDER_COLOR_DEF;
    m_borderwidth = BORDER_WIDTH_DEF;
    m_borderradius = BORDER_RADIUS_DEF;

    //setMinimumSize(QSize(150,50));
    setFocusPolicy(Qt::NoFocus);
    setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);

    setStyle(new ATCMStyle);
#ifdef TARGET_ARM
    setToolTip("");
#endif

    /*
     * put there a default stylesheet
     */
    setStyleSheet(
            #ifndef ENABLE_STYLESHEET
                ""
            #else
                "/*\n"
                "QProgressBar\n"
                "{\n"
                "    /*text color*/\n"
                "    color: rgb(255, 255, 255);\n"
                "    /* Horizontal() or Vertical() */\n"
                "    orientation:Horizontal();\n"
                "    /* this line set the background colour */ \n"
                "    background-color: rgb(0,0,0);\n"
                "    /* this line set the border width in px with a solid style and a desired colour */\n"
                "    border: 1px solid  rgb(160,160,160);\n"
                "    /* this line set the border radius to in px. */\n"
                "    border-radius: 5px;\n"
                "}\n"
                "/* this section set the Chunk style of the generic QProgressBar in this page */ \n"
                "QProgressBar::chunk\n"
                "{\n"
                "    /* this line set the background colour */\n"
                "    background-color: qlineargradient(spread:reflect, x1:0.528429, y1:0.535, x2:1, y2:1, stop:0.309524 rgba(47, 241, 0, 255), stop:1 rgba(194, 194, 194, 255));\n"
                "    /* this line set the border radius to in px. */\n"
                "    border-radius: 5px;\n"
                "}\n"
                "*/\n"
            #endif
                );

    m_parent = parent;
    connect(m_parent, SIGNAL(varRefresh()), this, SLOT(updateData()));
}
void LocationEditor::setActiveColor() {
    setStyleSheet(activeColor);
}
Beispiel #16
0
Home::Home(QWidget *parent) :  QBookForm(parent),
          m_category1(0)
        , m_category2(0)
        , m_category3(0)
        , memoryCategory1List(0)
        , memoryCategory2List(0)
        , memoryCategory3List(0)
        , b_isMostRecentFromSD(false)
      {
        setupUi(this);

        connect(libraryBtn,     SIGNAL(clicked()), this, SLOT(goToLibrary()));
        connect(helpBtn,        SIGNAL(clicked()), this, SLOT(goToHelp()));
        connect(searchBtn,      SIGNAL(clicked()), this, SLOT(goToSearch()));
        connect(settingsBtn,    SIGNAL(clicked()), this, SLOT(goToSettings()));
        connect(showAllBtn,     SIGNAL(clicked()), this, SLOT(viewAll()));
        connect(recommendedBtn, SIGNAL(clicked()), this, SLOT(showOptions()));

    #ifndef HACKERS_EDITION
        connect(storeBtn,       SIGNAL(clicked()), QBookApp::instance(),SLOT(goToShop()));
    #endif
        connect(readBookBtn, SIGNAL(clicked()), this, SLOT(openMostRecentBook()));

        QFile fileSpecific(":/res/home_styles.qss");
        QFile fileCommons(":/res/home_styles_generic.qss");
        fileSpecific.open(QFile::ReadOnly);
        fileCommons.open(QFile::ReadOnly);

        QString styles = QLatin1String(fileSpecific.readAll() + fileCommons.readAll());
        setStyleSheet(styles);

        if(QBook::getInstance()->getResolution() == QBook::RES600x800){
            defaultHelpBook = new BookInfo(QString(USERGUIDEPATH) + "/userGuideTouch_" + QBook::settings().value("setting/language", QVariant("es")).toString()+ ".epub");
        }else{ //We do it to preserve back compatibility
            defaultHelpBook = new BookInfo(QString(USERGUIDEPATH) + "/userGuide_" + QBook::settings().value("setting/language", QVariant("es")).toString()+ ".pdf");

        }

        defaultHelpBook->title = tr("Guia de Ayuda");
        defaultHelpBook->thumbnail = ":/res/unknow_book.png";
        defaultHelpBook->fontSize = 1; //Optimal to show images

        homeBooksListOptions = new HomeBooksListOptions(this);
        connect(homeBooksListOptions, SIGNAL(viewSelected(Home::VIEW)), this, SLOT(viewSelected(Home::VIEW)));
        connect(homeBooksListOptions, SIGNAL(hideMe()), this, SLOT(showOptions()));
        connect(homeBooksList, SIGNAL(openBook(const BookInfo*)), this, SLOT(openBook(const BookInfo*)));

#ifndef HACKERS_EDITION
        memoryCategory1List = new bqDeviceServicesCategoryObject();
        memoryCategory2List = new bqDeviceServicesCategoryObject();
        memoryCategory3List = new bqDeviceServicesCategoryObject();
        m_category1 = new bqDeviceServicesCategoryObject();
        m_category2 = new bqDeviceServicesCategoryObject();
        m_category3 = new bqDeviceServicesCategoryObject();
#endif
        bookAccessLbl->hide();
        numberAccessLbl->hide();
        subscriptionTagLbl->hide();

        currentView = Home::RECENT;
}
Beispiel #17
0
void EnrollDialog::initializeUI()
{
  grid = new QGridLayout();

  lblMsg = new QLabel(tr("Introduzca su RUT"));
  lblMsg->setAlignment(Qt::AlignCenter);
  lblMsg->setStyleSheet("font-size: 12px;"
      "color: #FFFFFF;"
      "text-align: center;"
      "font-style: normal;"
      "font-weight: bold;");

  edtRut = new QLineEdit();
  edtRut->resize(100, 50);
  edtRut->setStyleSheet("background:rgb(0,102,153);"
      "color:rgb(255,255,255);"
      "font-size:18px;"
      "padding-right: 10px;");

  btnDelete = new QPushButton();
  btnDelete->resize(50, 50);
  btnDelete->setFlat(true);
  btnDelete->setStyleSheet("background-image: url(:/img/Resources/images/borrar.bmp);"
      "background-repeat: no repeat;"
      "background-position: center center;"
      "color:rgb(255,255,255);"
      "font-size:18px");
  connect(btnDelete, SIGNAL(clicked()), this, SLOT(btnDeleteClicked()));

  btn1 = new QPushButton();
  btn1->resize(50, 50);
  btn1->setFlat(true);
  btn1->setStyleSheet("background-image: url(:/img/Resources/images/1.bmp);"
      "background-repeat: no repeat;"
      "background-position: center center;"
      "color:rgb(255,255,255);"
      "font-size:18px");
  connect(btn1, SIGNAL(clicked()), this, SLOT(btn1Clicked()));

  btn2 = new QPushButton();
  btn2->resize(50, 50);
  btn2->setFlat(true);
  btn2->setStyleSheet("background-image: url(:/img/Resources/images/2.bmp);"
      "background-repeat: no repeat;"
      "background-position: center center;"
      "color:rgb(255,255,255);"
      "font-size:18px");
  connect(btn2, SIGNAL(clicked()), this, SLOT(btn2Clicked()));

  btn3 = new QPushButton();
  btn3->resize(50, 50);
  btn3->setFlat(true);
  btn3->setStyleSheet("background-image: url(:/img/Resources/images/3.bmp);"
      "background-repeat: no repeat;"
      "background-position: center center;"
      "color:rgb(255,255,255);"
      "font-size:18px");
  connect(btn3, SIGNAL(clicked()), this, SLOT(btn3Clicked()));

  btn4 = new QPushButton();
  btn4->resize(50, 50);
  btn4->setFlat(true);
  btn4->setStyleSheet("background-image: url(:/img/Resources/images/4.bmp);"
      "background-repeat: no repeat;"
      "background-position: center center;"
      "color:rgb(255,255,255);"
      "font-size:18px");
  connect(btn4, SIGNAL(clicked()), this, SLOT(btn4Clicked()));

  btn5 = new QPushButton();
  btn5->resize(50, 50);
  btn5->setFlat(true);
  btn5->setStyleSheet("background-image: url(:/img/Resources/images/5.bmp);"
      "background-repeat: no repeat;"
      "background-position: center center;"
      "color:rgb(255,255,255);"
      "font-size:18px");
  connect(btn5, SIGNAL(clicked()), this, SLOT(btn5Clicked()));

  btn6 = new QPushButton();
  btn6->resize(50, 50);
  btn6->setFlat(true);
  btn6->setStyleSheet("background-image: url(:/img/Resources/images/6.bmp);"
      "background-repeat: no repeat;"
      "background-position: center center;"
      "color:rgb(255,255,255);"
      "font-size:18px");
  connect(btn6, SIGNAL(clicked()), this, SLOT(btn6Clicked()));

  btn7 = new QPushButton();
  btn7->resize(50, 50);
  btn7->setFlat(true);
  btn7->setStyleSheet("background-image: url(:/img/Resources/images/7.bmp);"
      "background-repeat: no repeat;"
      "background-position: center center;"
      "color:rgb(255,255,255);"
      "font-size:18px");
  connect(btn7, SIGNAL(clicked()), this, SLOT(btn7Clicked()));

  btn8 = new QPushButton();
  btn8->resize(50, 50);
  btn8->setFlat(true);
  btn8->setStyleSheet("background-image: url(:/img/Resources/images/8.bmp);"
      "background-repeat: no repeat;"
      "background-position: center center;"
      "color:rgb(255,255,255);"
      "font-size:18px");
  connect(btn8, SIGNAL(clicked()), this, SLOT(btn8Clicked()));

  btn9 = new QPushButton();
  btn9->resize(50, 50);
  btn9->setFlat(true);
  btn9->setStyleSheet("background-image: url(:/img/Resources/images/9.bmp);"
      "background-repeat: no repeat;"
      "background-position: center center;"
      "color:rgb(255,255,255);"
      "font-size:18px");
  connect(btn9, SIGNAL(clicked()), this, SLOT(btn9Clicked()));

  btn0 = new QPushButton();
  btn0->resize(50, 50);
  btn0->setFlat(true);
  btn0->setStyleSheet("background-image: url(:/img/Resources/images/0.bmp);"
      "background-repeat: no repeat;"
      "background-position: center center;"
      "color:rgb(255,255,255);"
      "font-size:18px");
  connect(btn0, SIGNAL(clicked()), this, SLOT(btn0Clicked()));

  btnHyphen = new QPushButton();
  btnHyphen->resize(50, 50);
  btnHyphen->setFlat(true);
  btnHyphen->setStyleSheet("background-image: url(:/img/Resources/images/guion.bmp);"
      "background-repeat: no repeat;"
      "background-position: center center;"
      "color:rgb(255,255,255);"
      "font-size:18px");
  connect(btnHyphen, SIGNAL(clicked()), this, SLOT(btnHyphenClicked()));

  btnK = new QPushButton();
  btnK->resize(50, 50);
  btnK->setFlat(true);
  btnK->setStyleSheet("background-image: url(:/img/Resources/images/k.bmp);"
      "background-repeat: no repeat;"
      "background-position: center center;"
      "color:rgb(255,255,255);"
      "font-size:18px");
  connect(btnK, SIGNAL(clicked()), this, SLOT(btnKClicked()));

  btnOk = new QPushButton();
  btnOk->resize(50, 50);
  btnOk->setFlat(true);
  btnOk->setStyleSheet("background-image: url(:/img/Resources/images/aceptar.bmp);"
      "background-repeat: no repeat;"
      "background-position: center center;"
      "color:rgb(255,255,255);"
      "font-size:18px");
  connect(btnOk, SIGNAL(clicked()), this, SLOT(btnOkClicked()));

  btnCancel = new QPushButton();
  btnCancel->resize(50, 50);
  btnCancel->setFlat(true);
  btnCancel->setStyleSheet("background-image: url(:/img/Resources/images/cancelar.bmp);"
      "background-repeat: no repeat;"
      "background-position: center center;"
      "color:rgb(255,255,255);"
      "font-size:18px");
  connect(btnCancel, SIGNAL(clicked()), this, SLOT(btnCancelClicked()));

  lblEmpresa = new QLabel();
  lblEmpresa->setAlignment(Qt::AlignCenter);
  lblEmpresa->setStyleSheet("font-size: 18px;"
                            "color: #FFFFFF;"
                            "font-style: normal;");

  lblName= new QLabel();
  lblName->setAlignment(Qt::AlignCenter);
  lblName->setStyleSheet("font-size: 18px;"
                         "color: #FFFFFF;"
                         "font-style: normal;");

  lblMsgScreen2= new QLabel();
  lblMsgScreen2->setAlignment(Qt::AlignCenter);
  lblMsgScreen2->setStyleSheet("font-size: 18px;"
                               "color: #FFFFFF;"
                               "font-style: normal;");

  // widget, row, col, rowSpan, colSpan
  grid->addWidget(lblMsg, 0, 0, 1, 4, Qt::AlignCenter);
  grid->addWidget(edtRut, 1, 0, 1, 3, Qt::AlignCenter);
  grid->addWidget(btnDelete, 1, 3, 1, 1, Qt::AlignCenter);

  grid->addWidget(btn1, 2, 0, 1, 1, Qt::AlignCenter);
  grid->addWidget(btn2, 2, 1, 1, 1, Qt::AlignCenter);
  grid->addWidget(btn3, 2, 2, 1, 1, Qt::AlignCenter);

  grid->addWidget(btn4, 3, 0, 1, 1, Qt::AlignCenter);
  grid->addWidget(btn5, 3, 1, 1, 1, Qt::AlignCenter);
  grid->addWidget(btn6, 3, 2, 1, 1, Qt::AlignCenter);
  grid->addWidget(btnHyphen, 3, 3, 1, 1, Qt::AlignCenter);

  grid->addWidget(btn7, 4, 0, 1, 1, Qt::AlignCenter);
  grid->addWidget(btn8, 4, 1, 1, 1, Qt::AlignCenter);
  grid->addWidget(btn9, 4, 2, 1, 1, Qt::AlignCenter);
  grid->addWidget(btnK, 4, 3, 1, 1, Qt::AlignCenter);

  grid->addWidget(btnCancel, 5, 0, 1, 1, Qt::AlignCenter);
  grid->addWidget(btn0, 5, 1, 1, 1, Qt::AlignCenter);
  grid->addWidget(btnOk, 5, 2, 1, 1, Qt::AlignCenter);

  setStyleSheet("background:rgb(0,101,153);");
  setLayout(grid);
}
StudentPersonalWindowModiyfyData::StudentPersonalWindowModiyfyData(QString studentnumber){
    this->studentnumber = studentnumber;

    init();

    query.prepare( "select * from student where studentnumber = :studentnumber" );
    query.bindValue(":studentnumber",studentnumber);
    query.exec();
    query.next();

    msg.layout()->setMargin(50);
    msg.layout()->setSpacing(20);
    QFont font;
    font.setFamily("微軟正黑體");
    font.setPixelSize(15);
    msg.setFont(font);

    setInitialValue();

    setTextEditSize(locationinput);
    setTextEditSize(nameinput);
    setTextEditSize(addressinput);
    setTextEditSize(emailinput);
    setTextEditSize(nameinput);
    setTextEditSize(telephonedayinput);
    setTextEditSize(telephonenightinput);
    setTextEditSize(mobileinput);
    setTextEditSize(companynameinput);
    setTextEditSize(companypositioninput);
    setTextEditSize(graduateschoolinput);
    setTextEditSize(graduatedepartmentinput);
    setTextEditSize(studentidentityinput);

    picturelayout->addWidget(pictureinput);
    picturewidget->setLayout(picturelayout);
    picturelayout->setAlignment(pictureinput,Qt::AlignHCenter | Qt::AlignTop);
    picturewidget->setSizePolicy(QSizePolicy::Minimum,QSizePolicy::Minimum);
    picturewidget->setMinimumHeight(300);

    formlayout1->addRow(picturewidget);
    formlayout1->addRow("通訊地址:",addressinput);
    formlayout1->addRow("電子郵件:",emailinput);
    formwidget1->setLayout(formlayout1);
    formwidget1->setSizePolicy(QSizePolicy::Maximum,QSizePolicy::Maximum);
    formlayout1->setFormAlignment(Qt::AlignHCenter);
    formlayout1->setAlignment(pictureinput,Qt::AlignHCenter);
    formlayout1->setAlignment(addressinput,Qt::AlignBottom);
    formlayout1->setAlignment(emailinput,Qt::AlignBottom);

    graduatelevelerror->setStyleSheet("color:red;font-size:15px;font-family:Microsoft JhengHei");
    graduatelevelerror->setVisible(false);
    graduatelevel->setSizePolicy(QSizePolicy::Maximum,QSizePolicy::Maximum);
    graduatelevel->setFixedHeight(36);
    studentnumberinput->setFixedHeight(36);
    ticketnumberinput->setFixedHeight(36);
    birthdayinput->setFixedHeight(36);
    birthdayinput->setStyleSheet("background-color:#ffffff;font-size:20px;font-family:Microsoft JhengHei");

    genderlayout->addWidget(malebutton);
    genderlayout->addWidget(femalebutton);
    gendergroup->setLayout(genderlayout);

    contactlayout->addRow("電話(日):",telephonedayinput);
    contactlayout->addRow("電話(夜):",telephonenightinput);
    contactlayout->addRow("手機:",mobileinput);
    contactgroup->setLayout(contactlayout);

    companylayout->addRow("公司名稱:",companynameinput);
    companylayout->addRow("職位:",companypositioninput);
    companygroup->setLayout(companylayout);

    formlayout2->addRow("準考證號碼:",ticketnumberinput);
    formlayout2->addRow("學號:",studentnumberinput);
    formlayout2->addRow("畢業級數:",graduatelevel);
    formlayout2->addRow("姓名",nameinput);
    formlayout2->addRow("性別:",gendergroup);
    formlayout2->addRow("生日:",birthdayinput);
    formlayout2->addRow("畢業學校:",graduateschoolinput);
    formlayout2->addRow("畢業科系:",graduatedepartmentinput);
    formlayout2->addRow("所在地區:",locationinput);
    formwidget2->setLayout(formlayout2);
    formwidget2->setSizePolicy(QSizePolicy::Maximum,QSizePolicy::Maximum);

    creditlayout->addWidget(credityes);
    creditlayout->addWidget(creditno);
    creditgroup->setLayout(creditlayout);

    locationinput->setMinimumWidth(120);

    formlayout3->addRow("報考身分別:",studentidentityinput);
    formlayout3->addRow("參加學分班:",creditgroup);
    formlayout3->addRow(companygroup);
    formlayout3->addRow(contactgroup);
    formwidget3->setLayout(formlayout3);
    formwidget3->setSizePolicy(QSizePolicy::Maximum,QSizePolicy::Maximum);

    uplayout->addWidget(formwidget1);
    uplayout->addWidget(formwidget2);
    uplayout->addWidget(formwidget3);
    upwidget->setLayout(uplayout);
    uplayout->setMargin(5);
    uplayout->setAlignment(formwidget1,Qt::AlignTop);
    uplayout->setAlignment(formwidget2,Qt::AlignTop);
    uplayout->setAlignment(formwidget3,Qt::AlignTop);
    upwidget->setSizePolicy(QSizePolicy::Maximum,QSizePolicy::Maximum);

    backbutton->setFixedWidth(150);
    backbutton->setFixedHeight(36);
    submitbutton->setFixedWidth(150);
    submitbutton->setFixedHeight(36);
    connect(submitbutton,SIGNAL(clicked()),this,SLOT(submitdata()));

    buttonlayout->addWidget(backbutton);
    buttonlayout->addWidget(submitbutton);
    buttonwidget->setLayout(buttonlayout);
    buttonwidget->setSizePolicy(QSizePolicy::Minimum,QSizePolicy::Maximum);

    mainlayout->addWidget(upwidget);
    mainlayout->addWidget(buttonwidget);
    mainlayout->setSpacing(20);
    setStyleSheet("background-color:#fbfbfb;font-size:20px;font-family:Microsoft JhengHei");
    //setStyleSheet("border: 1px solid black");
    setFrameShape(QFrame::Panel);
    setFrameShadow(QFrame::Raised);
    setLayout(mainlayout);
    setSizePolicy(QSizePolicy::Maximum,QSizePolicy::Maximum);
}
Beispiel #19
0
ConsoleWidget::ConsoleWidget(Framework *fw) :
    framework(fw),
    graphicsView(fw->Ui()->GraphicsView()),
    proxyWidget(0),
    commandHistoryIndex(-1),
    lineEdit(0)
{
    setStyleSheet(
        "QPlainTextEdit {"
            "border: 0px;"
            "padding: 0px;"
            "background-color: rgb(0,0,0);"
            "font-size: 12px;"
            "color: #33CC00;"
            "margin: 0px;"
        "}"
        "QLineEdit {"
            "border: 0px;"
            "border-top: 1px solid rgba(255,255,255,100);"
            "border-bottom: 1px rgba(255,255,255,100);"
            "padding: 0px;"
            "padding-left: 3px;"
            "background-color: rgb(0,0,0);"
            "font-size: 12px;"
            "color:#33CC00;"
        "}"
        "QScrollBar{"
            "background-color: rgb(0,0,0);"
        "}");

    // Console UI settings.
    /// @todo Settings for colors?
    const bool defaultInputEnabled = true;
    const float defaultHeight = 0.5f;
    const float defaultOpacity = 0.8f;
    const int defaultAnimationSpeed = 300;

    ConfigAPI &cfg = *framework->Config();
    ConfigData consoleUi(ConfigAPI::FILE_FRAMEWORK, "console_ui");
    // If we have "input_enabled" in config we very likely have all the other settings as well.
    // If not, write the default settings to config for the next time.
    if (!cfg.HasValue(consoleUi, "input_enabled"))
    {
        cfg.Set(consoleUi, "input_enabled", defaultInputEnabled);
        cfg.Set(consoleUi, "relative_height", (double)defaultHeight);
        cfg.Set(consoleUi, "opacity", (double)defaultOpacity);
        cfg.Set(consoleUi, "animation_speed", defaultAnimationSpeed);
    }

    bool inputEnabled = cfg.Get(consoleUi, "input_enabled", defaultInputEnabled).toBool();
    height = Clamp(cfg.Get(consoleUi, "relative_height", defaultHeight).toFloat(), 0.f, 1.f);
    float opacity = Clamp(cfg.Get(consoleUi, "opacity", defaultOpacity).toFloat(), 0.f, 1.f);
    int animationSpeed = cfg.Get(consoleUi, "animation_speed", defaultAnimationSpeed).toInt();

    if (fw->HasCommandLineParameter("--noconsoleguiinput"))
        inputEnabled = false; // Command line parameter authorative.

    QVBoxLayout *layout = new QVBoxLayout(this);
    layout->setContentsMargins(0, 0, 0, 0);
    layout->setSpacing(0);
    setLayout(layout);

    proxyWidget = framework->Ui()->AddWidgetToScene(this, Qt::Widget);
    proxyWidget->setMinimumHeight(0);
    proxyWidget->setGeometry(QRect(0, 0, graphicsView->width(), 0));
    proxyWidget->setOpacity(opacity);
    proxyWidget->setZValue(20000);

    connect(framework->Ui()->GraphicsScene(), SIGNAL(sceneRectChanged(const QRectF&)), SLOT(AdjustToSceneRect(const QRectF&)));

    slideAnimation = new QPropertyAnimation(this);
    slideAnimation->setTargetObject(proxyWidget);
    slideAnimation->setPropertyName("geometry");
    slideAnimation->setDuration(animationSpeed);

    textEdit = new QPlainTextEdit(this);
    textEdit->setTextInteractionFlags(Qt::TextSelectableByMouse);
    layout->addWidget(textEdit);

    if (inputEnabled)
    {
        lineEdit = new QLineEdit(this);
        connect(lineEdit, SIGNAL(returnPressed()), SLOT(HandleInput()));
        lineEdit->installEventFilter(this);
        layout->addWidget(lineEdit);
    }
}
BlockPropertiesPanel::BlockPropertiesPanel(GraphBlock *block, QWidget *parent):
    QWidget(parent),
    _ignoreChanges(true),
    _idLabel(new QLabel(this)),
    _idLineEdit(new QLineEdit(this)),
    _affinityZoneLabel(new QLabel(this)),
    _affinityZoneBox(nullptr),
    _blockErrorLabel(new QLabel(this)),
    _updateTimer(new QTimer(this)),
    _formLayout(nullptr),
    _block(block)
{
    auto blockDesc = block->getBlockDesc();

    //master layout for this widget
    auto layout = new QVBoxLayout(this);

    //create a scroller and a form layout
    auto scroll = new QScrollArea(this);
    scroll->setWidgetResizable(true);
    scroll->setWidget(new QWidget(scroll));
    _formLayout = new QFormLayout(scroll);
    scroll->widget()->setLayout(_formLayout);
    layout->addWidget(scroll);

    //title
    {
        auto label = new QLabel(QString("<h1>%1</h1>").arg(_block->getTitle().toHtmlEscaped()), this);
        label->setAlignment(Qt::AlignCenter);
        _formLayout->addRow(label);
    }

    //errors
    {
        _formLayout->addRow(_blockErrorLabel);
    }

    //id
    {
        _idOriginal = _block->getId();
        _formLayout->addRow(_idLabel, _idLineEdit);
        connect(_idLineEdit, SIGNAL(textEdited(const QString &)), this, SLOT(handleEditWidgetChanged(const QString &)));
        connect(_idLineEdit, SIGNAL(returnPressed(void)), this, SLOT(handleCommitButton(void)));
    }

    //properties
    for (const auto &prop : _block->getProperties())
    {
        _propIdToOriginal[prop.getKey()] = _block->getPropertyValue(prop.getKey());
        auto paramDesc = _block->getParamDesc(prop.getKey());
        assert(paramDesc);

        //create editable widget
        auto editWidget = new BlockPropertyEditWidget(paramDesc, this);
        connect(editWidget, SIGNAL(valueChanged(void)), this, SLOT(handleEditWidgetChanged(void)));
        connect(editWidget, SIGNAL(commitRequested(void)), this, SLOT(handleCommitButton(void)));
        _propIdToEditWidget[prop.getKey()] = editWidget;

        //create labels
        _propIdToFormLabel[prop.getKey()] = new QLabel(this);
        _propIdToErrorLabel[prop.getKey()] = new QLabel(this);
        editWidget->setToolTip(this->getParamDocString(_block->getParamDesc(prop.getKey())));

        //layout stuff
        auto editLayout = new QVBoxLayout();
        editLayout->addWidget(editWidget);
        editLayout->addWidget(_propIdToErrorLabel[prop.getKey()]);
        _formLayout->addRow(_propIdToFormLabel[prop.getKey()], editLayout);
    }

    //affinity zone
    {
        _affinityZoneOriginal = _block->getAffinityZone();
        auto dock = dynamic_cast<AffinityZonesDock *>(getObjectMap()["affinityZonesDock"]);
        assert(dock != nullptr);
        _affinityZoneBox = dock->makeComboBox(this);
        _formLayout->addRow(_affinityZoneLabel, _affinityZoneBox);
        connect(_affinityZoneBox, SIGNAL(activated(const QString &)), this, SLOT(handleEditWidgetChanged(const QString &)));
    }

    //draw the block's preview onto a mini pixmap
    //this is cool, maybe useful, but its big, where can we put it?
    /*
    {
        const auto bounds = _block->getBoundingRect();
        QPixmap pixmap(bounds.size().toSize()+QSize(2,2));
        pixmap.fill(Qt::transparent);
        QPainter painter(&pixmap);
        painter.translate(-bounds.topLeft()+QPoint(1,1));
        painter.setRenderHint(QPainter::Antialiasing);
        painter.setRenderHint(QPainter::HighQualityAntialiasing);
        painter.setRenderHint(QPainter::SmoothPixmapTransform);
        _block->render(painter);
        painter.end();
        auto label = new QLabel(this);
        label->setPixmap(pixmap);
        _formLayout->addRow(label);
        _formLayout->setAlignment(label, Qt::AlignHCenter);
    }
    */

    //block level description
    if (blockDesc->isArray("docs"))
    {
        QString output;
        output += QString("<h1>%1</h1>").arg(QString::fromStdString(blockDesc->get("name").convert<std::string>()));
        output += QString("<p>%1</p>").arg(QString::fromStdString(block->getBlockDescPath()));
        output += "<p>";
        for (const auto &lineObj : *blockDesc->getArray("docs"))
        {
            const auto line = lineObj.extract<std::string>();
            if (line.empty()) output += "<p /><p>";
            else output += QString::fromStdString(line)+"\n";
        }
        output += "</p>";

        //enumerate properties
        if (not _block->getProperties().empty())
        {
            output += QString("<h2>%1</h2>").arg(tr("Properties"));
            for (const auto &prop : _block->getProperties())
            {
                output += this->getParamDocString(_block->getParamDesc(prop.getKey()));
            }
        }

        //enumerate slots
        if (not block->getSlotPorts().empty())
        {
            output += QString("<h2>%1</h2>").arg(tr("Slots"));
            output += "<ul>";
            for (const auto &port : block->getSlotPorts())
            {
                output += QString("<li>%1(...)</li>").arg(port.getName());
            }
            output += "</ul>";
        }

        //enumerate signals
        if (not block->getSignalPorts().empty())
        {
            output += QString("<h2>%1</h2>").arg(tr("Signals"));
            output += "<ul>";
            for (const auto &port : block->getSignalPorts())
            {
                output += QString("<li>%1(...)</li>").arg(port.getName());
            }
            output += "</ul>";
        }

        auto text = new QLabel(output, this);
        text->setStyleSheet("QLabel{background:white;margin:1px;}");
        text->setWordWrap(true);
        _formLayout->addRow(text);
    }

    //buttons
    {
        auto buttonLayout = new QHBoxLayout();
        layout->addLayout(buttonLayout);
        auto commitButton = new QPushButton(makeIconFromTheme("dialog-ok-apply"), tr("Commit"), this);
        connect(commitButton, SIGNAL(pressed(void)), this, SLOT(handleCommitButton(void)));
        buttonLayout->addWidget(commitButton);
        auto cancelButton = new QPushButton(makeIconFromTheme("dialog-cancel"), tr("Cancel"), this);
        connect(cancelButton, SIGNAL(pressed(void)), this, SLOT(handleCancelButton(void)));
        buttonLayout->addWidget(cancelButton);
    }

    //update timer
    _updateTimer->setSingleShot(true);
    _updateTimer->setInterval(UPDATE_TIMER_MS);
    connect(_updateTimer, SIGNAL(timeout(void)), this, SLOT(handleUpdateTimerExpired(void)));

    //connect state change to the graph editor
    auto draw = dynamic_cast<GraphDraw *>(_block->parent());
    auto editor = draw->getGraphEditor();
    connect(this, SIGNAL(stateChanged(const GraphState &)), editor, SLOT(handleStateChange(const GraphState &)));
    connect(_block, SIGNAL(destroyed(QObject*)), this, SLOT(handleBlockDestroyed(QObject*)));

    this->updateAllForms();
    _ignoreChanges = false;
}
Beispiel #21
0
PatMainWindow::PatMainWindow(QWidget *parent) : 
  QMainWindow(parent)
{
  setMinimumSize(950,640);
  setAcceptDrops(true);

  readSettings();

  this->statusBar()->show();

#ifdef Q_OS_LINUX
  QIcon icon = QIcon(":/images/pa_16.png");
  icon.addPixmap(QPixmap(":/images/pa_32.png"));
  icon.addPixmap(QPixmap(":/images/pa_48.png"));
  icon.addPixmap(QPixmap(":/images/pa_64.png"));
  icon.addPixmap(QPixmap(":/images/pa_128.png"));
  icon.addPixmap(QPixmap(":/images/pa_256.png"));
  setWindowIcon(icon);
#endif

  setWindowTitle(QCoreApplication::applicationName());

  setObjectName("MainWindow");
  setStyleSheet("QWidget#MainWindow { background-color: #2C3233; }");

  m_mainSplitter = new QSplitter(Qt::Horizontal); 

  verticalTabWidget = new PatVerticalTabWidget();

  m_mainSplitter->addWidget(verticalTabWidget);

  m_mainRightColumnContainer = new QStackedWidget();
  m_mainRightColumnContainer->setMinimumWidth(235);
  m_mainSplitter->addWidget(m_mainRightColumnContainer);

  m_mainSplitter->setStretchFactor(0,10000);

  setCentralWidget(m_mainSplitter);  

  mainMenu = new PatMainMenu();

  this->setMenuBar(mainMenu);

  connect(mainMenu, &PatMainMenu::newClicked, this, &PatMainWindow::newClicked);

  connect(mainMenu, &PatMainMenu::loadFileClicked, this, &PatMainWindow::loadFileClicked);

  connect(mainMenu, &PatMainMenu::saveFileClicked, this, &PatMainWindow::saveFileClicked);

  connect(mainMenu, &PatMainMenu::saveAsFileClicked, this, &PatMainWindow::saveAsFileClicked);

  connect(mainMenu, &PatMainMenu::clearAllResultsClicked, this, &PatMainWindow::clearAllResultsClicked);

  connect(mainMenu, &PatMainMenu::exportXmlClicked, this, &PatMainWindow::exportXmlClicked);

  connect(mainMenu, &PatMainMenu::exportSpreadsheetClicked, this, &PatMainWindow::exportSpreadsheetClicked);

  connect(mainMenu, &PatMainMenu::scanForToolsClicked, this, &PatMainWindow::scanForToolsClicked);

  connect(mainMenu, &PatMainMenu::showToolsClicked, this, &PatMainWindow::showToolsClicked);

  connect(mainMenu, &PatMainMenu::exitClicked, this, &PatMainWindow::exitClicked);
  
  connect(mainMenu, &PatMainMenu::changeMeasuresClicked, this, &PatMainWindow::changeMeasuresClicked);

  connect(mainMenu, &PatMainMenu::openBclDlgClicked, this, &PatMainWindow::openBclDlgClicked);

  connect(mainMenu, &PatMainMenu::openCloudDlgClicked, this, &PatMainWindow::openCloudDlgClicked);

  connect(mainMenu, &PatMainMenu::openMonitorUseDlgClicked, this, &PatMainWindow::openMonitorUseDlgClicked);

  connect(mainMenu, &PatMainMenu::helpClicked, this, &PatMainWindow::helpClicked);

  connect(mainMenu, &PatMainMenu::aboutClicked, this, &PatMainWindow::aboutClicked);

  connect(mainMenu, &PatMainMenu::configureProxyClicked, this, &PatMainWindow::configureProxyClicked);

  QTimer::singleShot(0, this, SLOT(loadProxySettings()));
}
MainWindow::MainWindow(QFrame *parent)
    : QFrame(parent),isLeftNaviVisuable(true)
{
    setWindowFlags(Qt::FramelessWindowHint);

    setMouseTracking(true);
    setAttribute(Qt::WA_Hover, true);
    QString fileName("/style/system.qss");
    QFile file(fileName);
    if (!file.open(QFile::ReadOnly)) {
      file.setFileName(":/style/system.qss");
      file.open(QFile::ReadOnly);
    }
    setStyleSheet(file.readAll());
    file.close();


    ptrHeaderBar = new HeaderBar(this);//创建标题栏
    ptrStatusBar = new StatusBar(this);//创建状态栏
    QString msg = "Ready";
    ptrStatusBar->setMessage(msg);

    lft = new LeftNavi(this);
    lft->setFrameStyle(QFrame::NoFrame);

    rgt = new QStackedWidget(this);
    rgt->setObjectName("rgt");
    rgt->setFrameStyle(QFrame::NoFrame);



    NetPlanView *tpview = new NetPlanView();
    rgt->addWidget(tpview);
    NetResView *resview = new NetResView();
    rgt->addWidget(resview);
    QSplitter *mainSplitter = new QSplitter(this);
    mainSplitter->setFrameStyle(QFrame::NoFrame);
    mainSplitter->setHandleWidth(1);
    mainSplitter->setStyleSheet(
                QString("QSplitter::handle {background: qlineargradient("
                        "x1: 0, y1: 0, x2: 0, y2: 1,"
                        "stop: 0 %1, stop: 0.07 %2);}").
                arg(qApp->palette().background().color().name()).
                arg(qApp->palette().color(QPalette::Dark).name()));

    mainSplitter->setChildrenCollapsible(false);

    mainSplitter->addWidget(lft);
    mainSplitter->addWidget(rgt);
    mainSplitter->setStretchFactor(20,80);
    createToolBarNull();
    QHBoxLayout *ptrHLayout = new QHBoxLayout();
    ptrHLayout->setMargin(0);
    ptrHLayout->setSpacing(0);
    ptrHLayout->addWidget(pushButtonNull_);
    ptrHLayout->addWidget(mainSplitter);

    QVBoxLayout *ptrVLayout = new QVBoxLayout();//创建布局
    ptrVLayout->addWidget(ptrHeaderBar);//将部件加入到布局中
    ptrVLayout->addLayout(ptrHLayout);
    ptrVLayout->addWidget(ptrStatusBar);
    ptrVLayout->setSpacing(0);  //设置间距与边缘空白
    ptrVLayout->setContentsMargins(VALUE_DIS,VALUE_DIS,VALUE_DIS,VALUE_DIS);
    setLayout(ptrVLayout);
    setMinimumWidth(800);
    setMinimumHeight(600);


     createActions();


    FramelessHelper *pHelper = new FramelessHelper(this);
    pHelper->activateOn(this);  //激活当前窗体
    pHelper->setBorderWidth(VALUE_DIS);
    pHelper->setTitleHeight(HEADER_H);  //设置窗体的标题栏高度
    pHelper->setWidgetMovable(true);  //设置窗体可移动
    pHelper->setWidgetResizable(true);  //设置窗体可缩放

    connect(ptrHeaderBar, SIGNAL(signal_menu(QPoint)), this, SLOT(showMenu(QPoint)));
    connect(ptrHeaderBar, SIGNAL(signal_maxrestore()), this, SLOT(showMaxRestore()));

     //lft->setDatabase(db.db());
}
LocalLibraryView::LocalLibraryView(QWidget * parent)
  : QWidget(parent)
{
  auto mainVLayout = new QVBoxLayout();
  mainVLayout->setSpacing(0);
  mainVLayout->setContentsMargins(0,0,0,0);
  setLayout(mainVLayout);

  auto buttonGroup = new QButtonGroup();
  buttonGroup->setExclusive(true);

  mainViewSwitcher = new OSViewSwitcher();
  mainVLayout->addWidget(mainViewSwitcher);

  QString style;
  style.append("QWidget#Footer {");
  style.append("border-top: 1px solid black; ");
  style.append("background-color: qlineargradient(x1:0,y1:0,x2:0,y2:1,stop: 0 #B6B5B6, stop: 1 #737172); ");
  style.append("}");

  auto footer = new QWidget();
  footer->setObjectName("Footer");
  footer->setStyleSheet(style);
  //footer->setFixedHeight(40);
  mainVLayout->addWidget(footer);

  auto footerVLayout = new QVBoxLayout();
  footerVLayout->setContentsMargins(5,5,5,5);
  footerVLayout->setSpacing(5);
  footer->setLayout(footerVLayout);

  auto footerHLayout = new QHBoxLayout();
  footerHLayout->setContentsMargins(0,0,0,0);
  footerHLayout->setSpacing(5);
  footerVLayout->addLayout(footerHLayout);

  duplicateMeasureButton = new DuplicateButton();
  duplicateMeasureButton->setToolTip("Copy Selected Measure and Add to My Measures");
  footerHLayout->addWidget(duplicateMeasureButton);
  duplicateMeasureButton->setDisabled(true);

  addMeasureButton = new AddScriptButton();
  addMeasureButton->setToolTip("Create a Measure from Template and add to My Measures");
  footerHLayout->addWidget(addMeasureButton);
  
  footerHLayout->addStretch();

  myMeasuresFolderButton = new MyMeasuresFolderButton();
  myMeasuresFolderButton->setToolTip("Open the My Measures Directory");
  footerHLayout->addWidget(myMeasuresFolderButton);

  auto footerHLayout2 = new QHBoxLayout();
  footerHLayout2->setContentsMargins(10,0,10,0);
  footerHLayout2->setSpacing(5);
  footerVLayout->addLayout(footerHLayout2);

  addBCLMeasureButton = new BlueButton();
  addBCLMeasureButton->setText("Find Measures on BCL");
  addBCLMeasureButton->setToolTip("Connect to Online BCL to Download New Measures and Update Existing Measures to Library");
  footerHLayout2->addWidget(addBCLMeasureButton);

}
Beispiel #24
0
Expander::Expander(Kite::KComponent *Comp, QTreeWidget *Parent):
	QObject(Parent), expandable(true)
{
	chandle = Comp->getHandle();
	ctype = Comp->getType();
	QString name = Comp->getTypeName().c_str();
	if (ctype == Kite::CTypes::Logic) {
		name.append(" ");
		name.append(Comp->getName().c_str());
	}

	head = new QTreeWidgetItem(Parent);
	head->setFlags(head->flags() ^ Qt::ItemIsDropEnabled);
	head->setChildIndicatorPolicy(QTreeWidgetItem::ShowIndicator);
	head->setText(0, name);
	head->setHidden(true);

	auto headFrame = new QFrame(Parent);
	auto headLayout = new QVBoxLayout(headFrame);
	headLayout->setMargin(0);
	headLayout->addSpacing(3);

	btnExpand = new QPushButton(Parent);
	btnExpand->setObjectName("btnExpand");
	btnExpand->setIcon(QIcon(":/icons/exp"));
	btnExpand->setText(name);
	btnExpand->setFocusPolicy(Qt::NoFocus);
	btnExpand->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
	btnExpand->setStyleSheet("QPushButton { text-align: left;"
							 "color: rgb(255, 255, 255);"
							 "background-color: rgb(38, 38, 38);"
							 "border: 1px solid rgb(38, 38, 38);"
							 "border-radius: 3px;}");
	headLayout->addWidget(btnExpand);

	auto hlayout = new QHBoxLayout(btnExpand);
	hlayout->setMargin(0);
	hlayout->setSpacing(0);
	hlayout->addStretch(1);

	// dependecy label
	if (!Comp->getDependency().empty()) {
		auto lblDep = new QLabel(btnExpand);
		lblDep->setText("<img src=\":/icons/depend\" height=\"16\" width=\"16\" >");
		lblDep->setStyleSheet("QToolTip { border: 1px solid #2c2c2c; background-color: #242424; color: white;}");
		QString tooltip("<font color=\"orange\">Dependency List:</font>");
		auto depList = Comp->getDependency();
		for (auto it = depList.begin(); it != depList.end(); ++it) {
			tooltip += "\n" + QString(Kite::getCTypesName((*it)).c_str());
		}
		lblDep->setToolTip(tooltip);
		hlayout->addWidget(lblDep);
		hlayout->addSpacing(2);
	}

	// remove on zero dependency label
	if (Comp->getRemoveOnZeroDep()) {
		auto lblZeroDep = new QLabel(btnExpand);
		lblZeroDep->setText("<img src=\":/icons/remzdep\" height=\"16\" width=\"16\" >");
		lblZeroDep->setStyleSheet("QToolTip { border: 1px solid #2c2c2c; background-color: #242424; color: white;}");
		lblZeroDep->setToolTip("Will be removed automatically if there is no dependence on it");
		hlayout->addWidget(lblZeroDep);
		hlayout->addSpacing(2);
	}

	// remove button
	auto btnClose = new QToolButton(btnExpand);
	btnClose->setContentsMargins(0, 0, 0, 0); 
	btnClose->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
	btnClose->setIcon(QIcon(":/icons/close"));
	btnClose->setIconSize(QSize(8, 8));
	btnClose->setToolButtonStyle(Qt::ToolButtonIconOnly);
	btnClose->setAutoRaise(true);
	btnClose->setStyleSheet("QToolTip { border: 1px solid #2c2c2c; background-color: #242424; color: white;}");
	btnClose->setToolTip("Remove Component");
	hlayout->addWidget(btnClose);

	Parent->setItemWidget(head, 0, headFrame);

	content = new ComponentView(Comp, Parent);
	content->setStyleSheet("QFrame {background-color: rgb(58, 58, 58);\n"
						   "border: 1px solid rgb(58, 58, 58);\n"
						   "border-bottom-left-radius: 3px;\n"
						   "border-bottom-right-radius: 3px;}");
	connect(content, &ComponentView::updateResList, this, &Expander::updateResList);
	connect(content, &ComponentView::componentEdited, this, &Expander::componentEdited);
	connect(content, &ComponentView::requestRes, this, &Expander::requestRes);
	connect(content, &ComponentView::requestPropValue, this, &Expander::requestPropValue);
	
	auto child = new QTreeWidgetItem(head);
	child->setDisabled(true);
	Parent->setItemWidget(child, 0, content);

	connect(btnExpand, &QPushButton::pressed, this, &Expander::expClicked);
	connect(btnClose, &QToolButton::clicked, this, &Expander::clsClicked);
}
Beispiel #25
0
BitcoinGUI::BitcoinGUI(QWidget *parent):
    QMainWindow(parent),
    clientModel(0),
    walletModel(0),
    encryptWalletAction(0),
    changePassphraseAction(0),
    aboutQtAction(0),
    trayIcon(0),
    notificator(0),
    rpcConsole(0)
{
    setWindowOpacity(qreal(98)/100);
    setStyleSheet("selection-color: #000066;");
    resize(850, 550);

    int y = (DISPLAY_VERSION_MAJOR);
    int a = (DISPLAY_VERSION_MINOR);
    int c = (DISPLAY_VERSION_REVISION);

    QString titVersion = QString::number(y)+ "." +
                  QString::number(a) + "." +
                  QString::number(c);

    setWindowTitle(tr("YACoin ") + tr("Wallet ") + "v" + (titVersion));

#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);

    // Create status bar
    statusBar();

    // Status bar notification icons
    QFrame *frameBlocks = new QFrame();
    frameBlocks->setContentsMargins(0,0,0,0);
    frameBlocks->setMinimumWidth(56);
    frameBlocks->setMaximumWidth(56);
    QHBoxLayout *frameBlocksLayout = new QHBoxLayout(frameBlocks);
    frameBlocksLayout->setContentsMargins(3,0,3,0);
    frameBlocksLayout->setSpacing(3);
    labelEncryptionIcon = new QLabel();
    labelConnectionsIcon = new QLabel();
    labelBlocksIcon = new QLabel();
    frameBlocksLayout->addStretch();
    frameBlocksLayout->addWidget(labelEncryptionIcon);
    frameBlocksLayout->addStretch();
    frameBlocksLayout->addWidget(labelConnectionsIcon);
    frameBlocksLayout->addStretch();
    frameBlocksLayout->addWidget(labelBlocksIcon);
    frameBlocksLayout->addStretch();

    // Progress bar and label for blocks download
    progressBarLabel = new QLabel();
    progressBarLabel->setVisible(false);
    progressBar = new QProgressBar();
    progressBar->setAlignment(Qt::AlignCenter);
    progressBar->setVisible(false);

    // Override style sheet for progress bar for styles that have a segmented progress bar,
    // as they make the text unreadable (workaround for issue #1071)
    // See https://qt-project.org/doc/qt-4.8/gallery.html
    QString curStyle = qApp->style()->metaObject()->className();
    if(curStyle == "QWindowsStyle" || curStyle == "QWindowsXPStyle")
    {
        progressBar->setStyleSheet("QProgressBar { background-color: #e8e8e8; border: 1px solid grey; border-radius: 7px; padding: 1px; text-align: center; } QProgressBar::chunk { background: QLinearGradient(x1: 0, y1: 0, x2: 1, y2: 0, stop: 0 #FF8000, stop: 1 orange); border-radius: 7px; margin: 0px; }");
    }

    statusBar()->addWidget(progressBarLabel);
    statusBar()->addWidget(progressBar);
    statusBar()->addPermanentWidget(frameBlocks);

    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();
}
Beispiel #26
0
//******************************************************
//* Set the color whe the editor has a good focus
//******************************************************
void TagEditorNewTag::setActiveColor() {
    QLOG_TRACE_IN() << typeid(*this).name();
    setStyleSheet(activeColor);
    QLOG_TRACE_OUT() << typeid(*this).name();
}
Beispiel #27
0
ContentDialog::ContentDialog(SettingsWidget* settingsWidget, QWidget* parent)
    : ActivateDialog(parent, Qt::Window)
    , activeChatroomWidget(nullptr)
    , settingsWidget(settingsWidget)
    , videoSurfaceSize(QSize())
    , videoCount(0)
{
    QVBoxLayout* boxLayout = new QVBoxLayout(this);
    boxLayout->setMargin(0);
    boxLayout->setSpacing(0);

    splitter = new QSplitter(this);
    setStyleSheet(Style::getStylesheet(":/ui/contentDialog/contentDialog.css"));
    splitter->setHandleWidth(6);

    QWidget *friendWidget = new QWidget();
    friendWidget->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
    friendWidget->setAutoFillBackground(true);

    friendLayout = new FriendListLayout();
    friendLayout->setMargin(0);
    friendLayout->setSpacing(0);
    friendWidget->setLayout(friendLayout);

    onGroupchatPositionChanged(Settings::getInstance().getGroupchatPosition());

    QScrollArea *friendScroll = new QScrollArea(this);
    friendScroll->setMinimumWidth(220);
    friendScroll->setFrameStyle(QFrame::NoFrame);
    friendScroll->setLayoutDirection(Qt::RightToLeft);
    friendScroll->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    friendScroll->setStyleSheet(Style::getStylesheet(":/ui/friendList/friendList.css"));
    friendScroll->setWidgetResizable(true);
    friendScroll->setWidget(friendWidget);

    QWidget* contentWidget = new QWidget(this);
    contentWidget->setAutoFillBackground(true);
    contentLayout = new ContentLayout(contentWidget);
    contentLayout->setMargin(0);
    contentLayout->setSpacing(0);

    splitter->addWidget(friendScroll);
    splitter->addWidget(contentWidget);
    splitter->setStretchFactor(1, 1);
    splitter->setCollapsible(1, false);
    boxLayout->addWidget(splitter);

    connect(splitter, &QSplitter::splitterMoved, this, &ContentDialog::saveSplitterState);

    const Settings& s = Settings::getInstance();
    connect(&s, &Settings::groupchatPositionChanged, this, &ContentDialog::onGroupchatPositionChanged);

    setMinimumSize(500, 220);
    setAttribute(Qt::WA_DeleteOnClose);

    QByteArray geometry = Settings::getInstance().getDialogGeometry();

    if (!geometry.isNull())
        restoreGeometry(geometry);
    else
        resize(720, 400);


    QByteArray splitterState = Settings::getInstance().getDialogSplitterState();

    if (!splitterState.isNull())
        splitter->restoreState(splitterState);

    currentDialog = this;

    setAcceptDrops(true);

    new QShortcut(Qt::CTRL + Qt::Key_Q, this, SLOT(close()));
    new QShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_Tab, this, SLOT(previousContact()));
    new QShortcut(Qt::CTRL + Qt::Key_Tab, this, SLOT(nextContact()));
    new QShortcut(Qt::CTRL + Qt::Key_PageUp, this, SLOT(previousContact()));
    new QShortcut(Qt::CTRL + Qt::Key_PageDown, this, SLOT(nextContact()));

    connect(Core::getInstance(), &Core::usernameSet, this, &ContentDialog::updateTitleAndStatusIcon);

    Translator::registerHandler(std::bind(&ContentDialog::retranslateUi, this), this);
}
BitcoinGUI::BitcoinGUI(QWidget *parent) :
    QMainWindow(parent),
    clientModel(0),
    encryptWalletAction(0),
    changePassphraseAction(0),
    aboutQtAction(0),
    trayIcon(0),
    notificator(0),
    rpcConsole(0),
    prevBlocks(0)
{
    
        setStyleSheet("color: darkgrey;"
    "font: 75 bold 10pt;"
"background-image: url(:/background/res/images/abstract-background-13.png);");
    
    
    QString ss("QMenuBar::item { background-color: transparent; color: darkgrey }"); // Use background-color instead of background
     menuBar()->setStyleSheet(ss);
    
    restoreWindowGeometry();
    setWindowTitle(tr("TreasureHuntCoin") + " - " + tr("Wallet"));
#ifndef Q_OS_MAC
    QApplication::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();

    // Create status bar
    statusBar();

    // Status bar notification icons
    QFrame *frameBlocks = new QFrame();
    frameBlocks->setContentsMargins(0,0,0,0);
    frameBlocks->setMinimumWidth(56);
    frameBlocks->setMaximumWidth(56);
    QHBoxLayout *frameBlocksLayout = new QHBoxLayout(frameBlocks);
    frameBlocksLayout->setContentsMargins(3,0,3,0);
    frameBlocksLayout->setSpacing(3);
    labelEncryptionIcon = new QLabel();
    labelConnectionsIcon = new QLabel();
    labelBlocksIcon = new QLabel();
    frameBlocksLayout->addStretch();
    frameBlocksLayout->addWidget(labelEncryptionIcon);
    frameBlocksLayout->addStretch();
    frameBlocksLayout->addWidget(labelConnectionsIcon);
    frameBlocksLayout->addStretch();
    frameBlocksLayout->addWidget(labelBlocksIcon);
    frameBlocksLayout->addStretch();

    // Progress bar and label for blocks download
    progressBarLabel = new QLabel();
    progressBarLabel->setVisible(false);
    progressBar = new QProgressBar();
    progressBar->setAlignment(Qt::AlignCenter);
    progressBar->setVisible(false);

    // Override style sheet for progress bar for styles that have a segmented progress bar,
    // as they make the text unreadable (workaround for issue #1071)
    // See https://qt-project.org/doc/qt-4.8/gallery.html
    QString curStyle = QApplication::style()->metaObject()->className();
    if(curStyle == "QWindowsStyle" || curStyle == "QWindowsXPStyle")
    {
        progressBar->setStyleSheet("QProgressBar { background-color: #e8e8e8; border: 1px solid grey; border-radius: 7px; padding: 1px; text-align: center; } QProgressBar::chunk { background: QLinearGradient(x1: 0, y1: 0, x2: 1, y2: 0, stop: 0 #FF8000, stop: 1 orange); border-radius: 7px; margin: 0px; }");
    }

    statusBar()->addWidget(progressBarLabel);
    statusBar()->addWidget(progressBar);
    statusBar()->addPermanentWidget(frameBlocks);

    syncIconMovie = new QMovie(":/movies/update_spinner", "mng", 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);

    // Initially wallet actions should be disabled
    setWalletActionsEnabled(false);
}
Beispiel #29
0
void patientView::setupUI(Patient *record, Consultation *consults)
    {
        setEnabled(true);
        setGeometry(400,400,600,600);
        resize(600, 600);
        QIcon icon;
        icon.addFile(QString::fromUtf8("COMP3004/PFS.png"), QSize(), QIcon::Normal, QIcon::Off);
        setWindowIcon(icon);
        setStyleSheet(
                    QString::fromUtf8("*{font-size: 10pt;\n"
                                      "font-family: \"Times New Roman\"}\n"
                                      "QLabel {color: rgb(255, 255, 255)}\n"
                                      "QLineEdit { background: rgb(117, 171, 200);\n"
                                      "color: rgb(255,255,255)}\n"
                                      "QLineEdit:focus{background: rgb(255,255,255);\n"
                                      "color: rgb(0,0,0)}\n"
                                      "QMainWindow{background: rgb(117, 171, 200)}\n"
                                      "QTableWidget{background: rgb(132, 132, 132);\n"
                                      "selection-color: rgb(255,255,255);\n"
                                      "selection-background-color: rgb(117, 171, 200)}\n"
                                      "QPushButton {color: rgb(10,10,10);"
                                      "background-color: rgb(190,223,115)}\n"
                                      "QProgressBar::chunk {background-color: rgb(190,223,115)}\n"
                                      "QPushButton:disabled {color: rgb(80,80,80);"
                                      "}"));
        actionConfirm = new QAction(this);
        actionConfirm->setObjectName(QString::fromUtf8("actionConfirm"));
        centralwidget = new QWidget(this);
        centralwidget->setObjectName(QString::fromUtf8("centralwidget"));
        gridLayoutWidget_4 = new QWidget(centralwidget);
        gridLayoutWidget_4->setObjectName(QString::fromUtf8("gridLayoutWidget_4"));
        gridLayoutWidget_4->setGeometry(QRect(10, 10, 581, 541));
        gridLayout_4 = new QGridLayout(gridLayoutWidget_4);
        gridLayout_4->setObjectName(QString::fromUtf8("gridLayout_4"));
        gridLayout_4->setContentsMargins(0, 0, 0, 0);
        horizontalSpacer = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);

        gridLayout_4->addItem(horizontalSpacer, 0, 1, 1, 1);

        gridLayout = new QGridLayout();
        gridLayout->setObjectName(QString::fromUtf8("gridLayout"));
        label_2 = new QLabel(gridLayoutWidget_4);
        label_2->setObjectName(QString::fromUtf8("label_2"));

        gridLayout->addWidget(label_2, 1, 0, 1, 1);

        lineEdit_2 = new QLineEdit(gridLayoutWidget_4);
        lineEdit_2->setObjectName(QString::fromUtf8("lineEdit_2"));
        lineEdit_2->setEnabled(false);

        gridLayout->addWidget(lineEdit_2, 0, 2, 1, 2);

        lineEdit_3 = new QLineEdit(gridLayoutWidget_4);
        lineEdit_3->setObjectName(QString::fromUtf8("lineEdit_3"));
        lineEdit_3->setEnabled(false);

        gridLayout->addWidget(lineEdit_3, 1, 1, 1, 1);

        label_5 = new QLabel(gridLayoutWidget_4);
        label_5->setObjectName(QString::fromUtf8("label_5"));

        gridLayout->addWidget(label_5, 1, 2, 1, 1);

        label = new QLabel(gridLayoutWidget_4);
        label->setObjectName(QString::fromUtf8("label"));

        gridLayout->addWidget(label, 0, 0, 1, 1);

        lineEdit = new QLineEdit(gridLayoutWidget_4);
        lineEdit->setObjectName(QString::fromUtf8("lineEdit"));
        lineEdit->setEnabled(false);

        gridLayout->addWidget(lineEdit, 0, 1, 1, 1);

        lineEdit_5 = new QLineEdit(gridLayoutWidget_4);
        lineEdit_5->setObjectName(QString::fromUtf8("lineEdit_5"));
        lineEdit_5->setEnabled(false);

        gridLayout->addWidget(lineEdit_5, 1, 3, 1, 3);

        label_7 = new QLabel(gridLayoutWidget_4);
        label_7->setObjectName(QString::fromUtf8("label_7"));

        gridLayout->addWidget(label_7, 2, 3, 1, 1);

        label_4 = new QLabel(gridLayoutWidget_4);
        label_4->setObjectName(QString::fromUtf8("label_4"));

        gridLayout->addWidget(label_4, 2, 0, 1, 1);

        label_6 = new QLabel(gridLayoutWidget_4);
        label_6->setObjectName(QString::fromUtf8("label_6"));

        gridLayout->addWidget(label_6, 1, 3, 1, 1);

        lineEdit_4 = new QLineEdit(gridLayoutWidget_4);
        lineEdit_4->setObjectName(QString::fromUtf8("lineEdit_4"));
        lineEdit_4->setEnabled(false);

        gridLayout->addWidget(lineEdit_4, 2, 1, 1, 1);

        label_8 = new QLabel(gridLayoutWidget_4);
        label_8->setObjectName(QString::fromUtf8("label_8"));

        gridLayout->addWidget(label_8, 3, 0, 1, 1);

        label_9 = new QLabel(gridLayoutWidget_4);
        label_9->setObjectName(QString::fromUtf8("label_9"));

        gridLayout->addWidget(label_9, 3, 2, 1, 1);

        lineEdit_8 = new QLineEdit(gridLayoutWidget_4);
        lineEdit_8->setObjectName(QString::fromUtf8("lineEdit_8"));
        lineEdit_8->setEnabled(false);

        gridLayout->addWidget(lineEdit_8, 3, 1, 1, 1);

        lineEdit_9 = new QLineEdit(gridLayoutWidget_4);
        lineEdit_9->setObjectName(QString::fromUtf8("lineEdit_9"));
        lineEdit_9->setEnabled(false);

        gridLayout->addWidget(lineEdit_9, 3, 3, 1, 3);


        gridLayout_4->addLayout(gridLayout, 0, 0, 1, 1);

        gridLayout_3 = new QGridLayout();
        gridLayout_3->setObjectName(QString::fromUtf8("gridLayout_3"));
        ViewCRButton = new QPushButton(gridLayoutWidget_4);
        ViewCRButton->setObjectName(QString::fromUtf8("ViewCRButton"));
        ViewCRButton->setEnabled(false);

        gridLayout_3->addWidget(ViewCRButton, 1, 1, 1, 1);

        verticalSpacer_2 = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding);

        gridLayout_3->addItem(verticalSpacer_2, 3, 0, 1, 1);

        DeleteCRButton = new QPushButton(gridLayoutWidget_4);
        DeleteCRButton->setObjectName(QString::fromUtf8("DeleteCRButton"));
        DeleteCRButton->setEnabled(false);

        gridLayout_3->addWidget(DeleteCRButton, 2, 1, 1, 1);

        verticalSpacer = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding);

        gridLayout_3->addItem(verticalSpacer, 0, 0, 1, 1);

        CreateCRButton = new QPushButton(gridLayoutWidget_4);
        CreateCRButton->setObjectName(QString::fromUtf8("CreateCRButton"));
        CreateCRButton->setEnabled(true);
        CreateCRButton->setCheckable(false);
        CreateCRButton->setAutoDefault(false);
        CreateCRButton->setDefault(false);
        CreateCRButton->setFlat(false);

        gridLayout_3->addWidget(CreateCRButton, 1, 0, 1, 1);

        EditCRButton = new QPushButton(gridLayoutWidget_4);
        EditCRButton->setObjectName(QString::fromUtf8("EditCRButton"));

        gridLayout_3->addWidget(EditCRButton, 2, 0, 1, 1);


        connect(EditCRButton, SIGNAL(clicked()),
        this, SLOT(editCR()));
        connect(CreateCRButton, SIGNAL(clicked()),
        this, SLOT(createCR()));


        connect(this, SIGNAL(edi(int, patientView *)),
        pControl, SLOT(editCR(int, patientView *)));
        connect(this, SIGNAL(cre(int, patientView *)),
        pControl, SLOT(createCR(int, patientView *)));


        gridLayout_4->addLayout(gridLayout_3, 1, 1, 1, 1);

        gridLayout_2 = new QGridLayout();
        gridLayout_2->setObjectName(QString::fromUtf8("gridLayout_2"));
        ConsultationTable = new QTableWidget(quantity,4,gridLayoutWidget_4);
        QTableWidgetItem *__qtablewidgetitem = new QTableWidgetItem();
        ConsultationTable->setHorizontalHeaderItem(0, __qtablewidgetitem);
        QTableWidgetItem *__qtablewidgetitem1 = new QTableWidgetItem();
        ConsultationTable->setHorizontalHeaderItem(1, __qtablewidgetitem1);
        QTableWidgetItem *__qtablewidgetitem2 = new QTableWidgetItem();
        ConsultationTable->setHorizontalHeaderItem(2, __qtablewidgetitem2);
        QTableWidgetItem *__qtablewidgetitem3 = new QTableWidgetItem();
        ConsultationTable->setHorizontalHeaderItem(3, __qtablewidgetitem3);
        ConsultationTable->setObjectName(QString::fromUtf8("ConsultationTable"));
        ConsultationTable->setFrameShape(QFrame::StyledPanel);
        ConsultationTable->setFrameShadow(QFrame::Sunken);
        ConsultationTable->setMidLineWidth(1);
        ConsultationTable->setAlternatingRowColors(false);
        ConsultationTable->setSortingEnabled(false);
        ConsultationTable->verticalHeader()->setHighlightSections(true);



        gridLayout_2->addWidget(ConsultationTable, 2, 0, 1, 1);

        label_3 = new QLabel(gridLayoutWidget_4);
        label_3->setObjectName(QString::fromUtf8("label_3"));

        gridLayout_2->addWidget(label_3, 1, 0, 1, 1);

        verticalSpacer_3 = new QSpacerItem(20, 20, QSizePolicy::Minimum, QSizePolicy::Minimum);

        gridLayout_2->addItem(verticalSpacer_3, 0, 0, 1, 1);


        gridLayout_4->addLayout(gridLayout_2, 1, 0, 1, 1);

        setCentralWidget(centralwidget);
        menubar = new QMenuBar(this);
        menubar->setObjectName(QString::fromUtf8("menubar"));
        menubar->setEnabled(true);
        menubar->setGeometry(QRect(0, 0, 600, 23));
        menuLOG_OUT = new QMenu(menubar);
        menuLOG_OUT->setObjectName(QString::fromUtf8("menuLOG_OUT"));
        setMenuBar(menubar);
        statusbar = new QStatusBar(this);
        statusbar->setObjectName(QString::fromUtf8("statusbar"));
        setStatusBar(statusbar);
        QWidget::setTabOrder(ConsultationTable, lineEdit);
        QWidget::setTabOrder(lineEdit, lineEdit_2);
        QWidget::setTabOrder(lineEdit_2, lineEdit_3);
        QWidget::setTabOrder(lineEdit_3, lineEdit_4);
        QWidget::setTabOrder(lineEdit_4, lineEdit_8);
        QWidget::setTabOrder(lineEdit_8, lineEdit_5);
        QWidget::setTabOrder(lineEdit_5, lineEdit_9);
        QWidget::setTabOrder(lineEdit_9, CreateCRButton);
        QWidget::setTabOrder(CreateCRButton, EditCRButton);
        QWidget::setTabOrder(EditCRButton, ViewCRButton);
        QWidget::setTabOrder(ViewCRButton, DeleteCRButton);

        menubar->addAction(menuLOG_OUT->menuAction());
        menuLOG_OUT->addAction(actionConfirm);

        retranslateUi();

        if (record != 0) {
            QString name = QString::fromStdString(record->getname());
            int split = name.indexOf(" ");
            QString fName = name.left(split);
            QString lName = name.right(name.size() - split);
            QString ohips; ohips.setNum(record->getohip());
            QString dob = QString::fromStdString(record->getdob());
            QString addy = QString::fromStdString(record->getaddy());
            QString email = QString::fromStdString(record->getemail());
            QString qty; qty.setNum(quantity);
            QString phone = QString::fromStdString(record->getphone());
            lineEdit->setText(fName);
            lineEdit_2->setText(lName);
            lineEdit_3->setText(ohips);
            lineEdit_4->setText(dob);
            lineEdit_5->setText(addy);
            lineEdit_9->setText(email);
            lineEdit_8->setText(phone);

            lineEdit->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred);
            lineEdit_2->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred);
            lineEdit_4->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred);
            lineEdit_8->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred);
        }

        int i;
        for (i = 0; i < quantity; i++) {
            QString date = QString::fromStdString(consults[i].getdate());
            QString time = QString::fromStdString(consults[i].gettime());
            QString phys = QString::fromStdString(consults[i].getphys());
            QString diag = QString::fromStdString(consults[i].getdiag());
            QTableWidgetItem *zero = new QTableWidgetItem(date);
            QTableWidgetItem *one = new QTableWidgetItem(time);
            QTableWidgetItem *two = new QTableWidgetItem(phys);
            QTableWidgetItem *three = new QTableWidgetItem(diag);
            ConsultationTable->setItem(i,0,zero);
            ConsultationTable->setItem(i,1,one);
            ConsultationTable->setItem(i,2,two);
            ConsultationTable->setItem(i,3,three);
        }


    } // setupUi
QgsAttributeTableDialog::QgsAttributeTableDialog( QgsVectorLayer *theLayer, QWidget *parent, Qt::WindowFlags flags )
    : QDialog( parent, flags )
    , mDock( nullptr )
    , mLayer( theLayer )
    , mRubberBand( nullptr )
    , mCurrentSearchWidgetWrapper( nullptr )
{
  setupUi( this );

  Q_FOREACH ( const QgsField& field, mLayer->fields() )
  {
    mVisibleFields.append( field.name() );
  }

  // Fix selection color on loosing focus (Windows)
  setStyleSheet( QgisApp::instance()->styleSheet() );

  setAttribute( Qt::WA_DeleteOnClose );

  layout()->setMargin( 0 );
  layout()->setContentsMargins( 0, 0, 0, 0 );
  static_cast< QGridLayout* >( layout() )->setVerticalSpacing( 0 );

  QSettings settings;

  int size = settings.value( "/IconSize", 16 ).toInt();
  if ( size > 32 )
  {
    size -= 16;
  }
  else if ( size == 32 )
  {
    size = 24;
  }
  else
  {
    size = 16;
  }
  mToolbar->setIconSize( QSize( size, size ) );

  // Initialize the window geometry
  restoreGeometry( settings.value( "/Windows/BetterAttributeTable/geometry" ).toByteArray() );

  myDa = new QgsDistanceArea();

  myDa->setSourceCrs( mLayer->crs() );
  myDa->setEllipsoidalMode( QgisApp::instance()->mapCanvas()->mapSettings().hasCrsTransformEnabled() );
  myDa->setEllipsoid( QgsProject::instance()->readEntry( "Measure", "/Ellipsoid", GEO_NONE ) );

  mEditorContext.setDistanceArea( *myDa );
  mEditorContext.setVectorLayerTools( QgisApp::instance()->vectorLayerTools() );

  QgsFeatureRequest r;
  if ( mLayer->geometryType() != QgsWkbTypes::NullGeometry &&
       settings.value( "/qgis/attributeTableBehaviour", QgsAttributeTableFilterModel::ShowAll ).toInt() == QgsAttributeTableFilterModel::ShowVisible )
  {
    QgsMapCanvas *mc = QgisApp::instance()->mapCanvas();
    QgsRectangle extent( mc->mapSettings().mapToLayerCoordinates( theLayer, mc->extent() ) );
    r.setFilterRect( extent );

    mRubberBand = new QgsRubberBand( mc, QgsWkbTypes::PolygonGeometry );
    mRubberBand->setToGeometry( QgsGeometry::fromRect( extent ), theLayer );

    mActionShowAllFilter->setText( tr( "Show All Features In Initial Canvas Extent" ) );
  }

  // Initialize dual view
  mMainView->init( mLayer, QgisApp::instance()->mapCanvas(), r, mEditorContext );

  QgsAttributeTableConfig config = mLayer->attributeTableConfig();
  mMainView->setAttributeTableConfig( config );

  // Initialize filter gui elements
  mFilterActionMapper = new QSignalMapper( this );
  mFilterColumnsMenu = new QMenu( this );
  mActionFilterColumnsMenu->setMenu( mFilterColumnsMenu );
  mApplyFilterButton->setDefaultAction( mActionApplyFilter );

  // Set filter icon in a couple of places
  QIcon filterIcon = QgsApplication::getThemeIcon( "/mActionFilter2.svg" );
  mActionShowAllFilter->setIcon( filterIcon );
  mActionAdvancedFilter->setIcon( filterIcon );
  mActionSelectedFilter->setIcon( filterIcon );
  mActionVisibleFilter->setIcon( filterIcon );
  mActionEditedFilter->setIcon( filterIcon );

  // Connect filter signals
  connect( mActionAdvancedFilter, SIGNAL( triggered() ), SLOT( filterExpressionBuilder() ) );
  connect( mActionShowAllFilter, SIGNAL( triggered() ), SLOT( filterShowAll() ) );
  connect( mActionSelectedFilter, SIGNAL( triggered() ), SLOT( filterSelected() ) );
  connect( mActionVisibleFilter, SIGNAL( triggered() ), SLOT( filterVisible() ) );
  connect( mActionEditedFilter, SIGNAL( triggered() ), SLOT( filterEdited() ) );
  connect( mFilterActionMapper, SIGNAL( mapped( QObject* ) ), SLOT( filterColumnChanged( QObject* ) ) );
  connect( mFilterQuery, SIGNAL( returnPressed() ), SLOT( filterQueryAccepted() ) );
  connect( mActionApplyFilter, SIGNAL( triggered() ), SLOT( filterQueryAccepted() ) );
  connect( mActionSetStyles, SIGNAL( triggered() ), SLOT( openConditionalStyles() ) );

  // info from layer to table
  connect( mLayer, SIGNAL( editingStarted() ), this, SLOT( editingToggled() ) );
  connect( mLayer, SIGNAL( editingStopped() ), this, SLOT( editingToggled() ) );
  connect( mLayer, SIGNAL( destroyed() ), this, SLOT( close() ) );
  connect( mLayer, SIGNAL( selectionChanged() ), this, SLOT( updateTitle() ) );
  connect( mLayer, SIGNAL( featureAdded( QgsFeatureId ) ), this, SLOT( updateTitle() ) );
  connect( mLayer, SIGNAL( featuresDeleted( QgsFeatureIds ) ), this, SLOT( updateTitle() ) );
  connect( mLayer, SIGNAL( attributeAdded( int ) ), this, SLOT( columnBoxInit() ) );
  connect( mLayer, SIGNAL( attributeDeleted( int ) ), this, SLOT( columnBoxInit() ) );

  // connect table info to window
  connect( mMainView, SIGNAL( filterChanged() ), this, SLOT( updateTitle() ) );
  connect( mMainView, SIGNAL( filterExpressionSet( QString, QgsAttributeForm::FilterType ) ), this, SLOT( formFilterSet( QString, QgsAttributeForm::FilterType ) ) );
  connect( mMainView, SIGNAL( formModeChanged( QgsAttributeForm::Mode ) ), this, SLOT( viewModeChanged( QgsAttributeForm::Mode ) ) );

  // info from table to application
  connect( this, SIGNAL( saveEdits( QgsMapLayer * ) ), QgisApp::instance(), SLOT( saveEdits( QgsMapLayer * ) ) );

  bool myDockFlag = settings.value( "/qgis/dockAttributeTable", false ).toBool();
  if ( myDockFlag )
  {
    mDock = new QgsAttributeTableDock( tr( "%1 (%n Feature(s))", "feature count", mMainView->featureCount() ).arg( mLayer->name() ), QgisApp::instance() );
    mDock->setWidget( this );
    connect( this, SIGNAL( destroyed() ), mDock, SLOT( close() ) );
    QgisApp::instance()->addDockWidget( Qt::BottomDockWidgetArea, mDock );
  }

  columnBoxInit();
  updateTitle();

  mActionRemoveSelection->setIcon( QgsApplication::getThemeIcon( "/mActionDeselectAll.svg" ) );
  mActionSelectAll->setIcon( QgsApplication::getThemeIcon( "/mActionSelectAll.svg" ) );
  mActionSelectedToTop->setIcon( QgsApplication::getThemeIcon( "/mActionSelectedToTop.svg" ) );
  mActionCopySelectedRows->setIcon( QgsApplication::getThemeIcon( "/mActionEditCopy.svg" ) );
  mActionPasteFeatures->setIcon( QgsApplication::getThemeIcon( "/mActionEditPaste.svg" ) );
  mActionZoomMapToSelectedRows->setIcon( QgsApplication::getThemeIcon( "/mActionZoomToSelected.svg" ) );
  mActionPanMapToSelectedRows->setIcon( QgsApplication::getThemeIcon( "/mActionPanToSelected.svg" ) );
  mActionInvertSelection->setIcon( QgsApplication::getThemeIcon( "/mActionInvertSelection.svg" ) );
  mActionToggleEditing->setIcon( QgsApplication::getThemeIcon( "/mActionToggleEditing.svg" ) );
  mActionSaveEdits->setIcon( QgsApplication::getThemeIcon( "/mActionSaveEdits.svg" ) );
  mActionDeleteSelected->setIcon( QgsApplication::getThemeIcon( "/mActionDeleteSelected.svg" ) );
  mActionOpenFieldCalculator->setIcon( QgsApplication::getThemeIcon( "/mActionCalculateField.svg" ) );
  mActionAddAttribute->setIcon( QgsApplication::getThemeIcon( "/mActionNewAttribute.svg" ) );
  mActionRemoveAttribute->setIcon( QgsApplication::getThemeIcon( "/mActionDeleteAttribute.svg" ) );
  mTableViewButton->setIcon( QgsApplication::getThemeIcon( "/mActionOpenTable.svg" ) );
  mAttributeViewButton->setIcon( QgsApplication::getThemeIcon( "/mActionFormView.svg" ) );
  mActionExpressionSelect->setIcon( QgsApplication::getThemeIcon( "/mIconExpressionSelect.svg" ) );
  mActionAddFeature->setIcon( QgsApplication::getThemeIcon( "/mActionNewTableRow.svg" ) );

  // toggle editing
  bool canChangeAttributes = mLayer->dataProvider()->capabilities() & QgsVectorDataProvider::ChangeAttributeValues;
  bool canDeleteFeatures = mLayer->dataProvider()->capabilities() & QgsVectorDataProvider::DeleteFeatures;
  bool canAddAttributes = mLayer->dataProvider()->capabilities() & QgsVectorDataProvider::AddAttributes;
  bool canDeleteAttributes = mLayer->dataProvider()->capabilities() & QgsVectorDataProvider::DeleteAttributes;
  bool canAddFeatures = mLayer->dataProvider()->capabilities() & QgsVectorDataProvider::AddFeatures;

  mActionToggleEditing->blockSignals( true );
  mActionToggleEditing->setCheckable( true );
  mActionToggleEditing->setChecked( mLayer->isEditable() );
  mActionToggleEditing->setEnabled(( canChangeAttributes || canDeleteFeatures || canAddAttributes || canDeleteAttributes || canAddFeatures ) && !mLayer->readOnly() );
  mActionToggleEditing->blockSignals( false );

  mActionSaveEdits->setEnabled( mActionToggleEditing->isEnabled() && mLayer->isEditable() );
  mActionReload->setEnabled( ! mLayer->isEditable() );
  mActionAddAttribute->setEnabled(( canChangeAttributes || canAddAttributes ) && mLayer->isEditable() );
  mActionRemoveAttribute->setEnabled( canDeleteAttributes && mLayer->isEditable() );
  mActionDeleteSelected->setEnabled( canDeleteFeatures && mLayer->isEditable() );
  if ( !canDeleteFeatures )
    mToolbar->removeAction( mActionDeleteSelected );
  mActionAddFeature->setEnabled( canAddFeatures && mLayer->isEditable() );
  if ( !canAddFeatures )
    mToolbar->removeAction( mActionAddFeature );

  if ( canDeleteFeatures || canAddFeatures )
    mToolbar->insertSeparator( mActionExpressionSelect );

  mMainViewButtonGroup->setId( mTableViewButton, QgsDualView::AttributeTable );
  mMainViewButtonGroup->setId( mAttributeViewButton, QgsDualView::AttributeEditor );

  // Load default attribute table filter
  QgsAttributeTableFilterModel::FilterMode defaultFilterMode = ( QgsAttributeTableFilterModel::FilterMode ) settings.value( "/qgis/attributeTableBehaviour", QgsAttributeTableFilterModel::ShowAll ).toInt();

  switch ( defaultFilterMode )
  {
    case QgsAttributeTableFilterModel::ShowVisible:
      filterVisible();
      break;

    case QgsAttributeTableFilterModel::ShowSelected:
      filterSelected();
      break;

    case QgsAttributeTableFilterModel::ShowAll:
    default:
      filterShowAll();
      break;
  }

  mUpdateExpressionText->registerExpressionContextGenerator( this );
  mFieldCombo->setFilters( QgsFieldProxyModel::All | QgsFieldProxyModel::HideReadOnly );
  mFieldCombo->setLayer( mLayer );

  connect( mRunFieldCalc, SIGNAL( clicked() ), this, SLOT( updateFieldFromExpression() ) );
  connect( mRunFieldCalcSelected, SIGNAL( clicked() ), this, SLOT( updateFieldFromExpressionSelected() ) );
  // NW TODO Fix in 2.6 - Doesn't work with field model for some reason.
//  connect( mUpdateExpressionText, SIGNAL( returnPressed() ), this, SLOT( updateFieldFromExpression() ) );
  connect( mUpdateExpressionText, SIGNAL( fieldChanged( QString, bool ) ), this, SLOT( updateButtonStatus( QString, bool ) ) );
  mUpdateExpressionText->setLayer( mLayer );
  mUpdateExpressionText->setLeftHandButtonStyle( true );

  int initialView = settings.value( "/qgis/attributeTableView", -1 ).toInt();
  if ( initialView < 0 )
  {
    initialView = settings.value( "/qgis/attributeTableLastView", QgsDualView::AttributeTable ).toInt();
  }
  mMainView->setView( static_cast< QgsDualView::ViewMode >( initialView ) );
  mMainViewButtonGroup->button( initialView )->setChecked( true );

  connect( mActionToggleMultiEdit, SIGNAL( toggled( bool ) ), mMainView, SLOT( setMultiEditEnabled( bool ) ) );
  connect( mActionSearchForm, SIGNAL( toggled( bool ) ), mMainView, SLOT( toggleSearchMode( bool ) ) );
  updateMultiEditButtonState();

  if ( mLayer->editFormConfig()->layout() == QgsEditFormConfig::UiFileLayout )
  {
    //not supported with custom UI
    mActionToggleMultiEdit->setEnabled( false );
    mActionToggleMultiEdit->setToolTip( tr( "Multiedit is not supported when using custom UI forms" ) );
    mActionSearchForm->setEnabled( false );
    mActionSearchForm->setToolTip( tr( "Search is not supported when using custom UI forms" ) );
  }

  editingToggled();
}