Example #1
0
OnlineServicesPage::OnlineServicesPage(QWidget *p)
    : MultiPageWidget(p)
{
    addPage(StreamsModel::self()->name(), StreamsModel::self()->icon(), StreamsModel::self()->title(), StreamsModel::self()->descr(), new StreamsPage(this));

    JamendoService *jamendo=new JamendoService(this);
    addPage(jamendo->name(), jamendo->icon(), jamendo->title(), jamendo->descr(), new OnlineDbWidget(jamendo, this));
    connect(jamendo, SIGNAL(error(QString)), this, SIGNAL(error(QString)));

    MagnatuneService *magnatune=new MagnatuneService(this);
    addPage(magnatune->name(), magnatune->icon(), magnatune->title(), magnatune->descr(), new OnlineDbWidget(magnatune, this));
    connect(magnatune, SIGNAL(error(QString)), this, SIGNAL(error(QString)));

    SoundCloudService *soundcloud=new SoundCloudService(this);
    addPage(soundcloud->name(), soundcloud->icon(), soundcloud->title(), soundcloud->descr(), new OnlineSearchWidget(soundcloud, this));

    podcast=new PodcastService(this);
    addPage(podcast->name(), podcast->icon(), podcast->title(), podcast->descr(), new PodcastWidget(podcast, this));
    connect(podcast, SIGNAL(error(QString)), this, SIGNAL(error(QString)));

    Configuration config(metaObject()->className());
    load(config);
}
Example #2
0
void ShiptoEdit::sSearch()
{
  disconnect(this, SIGNAL(editingFinished()), this, SLOT(sParse()));

  shipToSearch* newdlg = searchFactory();
  if (newdlg)
  {
    ParameterList params;
    params.append("cust_id", _custid);
    newdlg->set(params);
    newdlg->setSearchText(text());
    int id = newdlg->exec();
    setId(id);
  }
  else
    QMessageBox::critical(this, tr("A System Error Occurred at %1::%2.")
                          .arg(__FILE__)
                          .arg(__LINE__),
                          tr("%1::sSearch() not yet defined")
                          .arg(metaObject()->className()));

  connect(this, SIGNAL(editingFinished()), this, SLOT(sParse()));
}
bool vtkDataMeshWriter::write(const QString& path)
{
  if (!this->data())
    return false;

  qDebug() << "Can write with: " << this->identifier();

  medAbstractData * medData = dynamic_cast<medAbstractData*>(this->data());

  if(medData->identifier() != "vtkDataMesh")
  {
    return false;
  }

  vtkMetaDataSet * mesh = dynamic_cast< vtkMetaDataSet*>( (vtkObject*)(this->data()->data()));
  if (!mesh)
    return false;

  addMetaDataAsFieldData(mesh);

  try
  {
      setlocale(LC_NUMERIC, "C");
      QLocale::setDefault(QLocale("C"));

      mesh->Write(path.toLocal8Bit().constData());
      clearMetaDataFieldData(mesh);
  }
  catch (...)
  {
      qDebug() << metaObject()->className() << ": error writing to " << path;
      clearMetaDataFieldData(mesh);
      return false;
  }

  return true;
}
QString MoveNodeInteraction::toHtml()
{
    QString help;
    help = (MainWindow::tr("LEFT-CLICK to select;LEFT-DRAG to move"));

    QStringList helpList = help.split(";");

    QString desc;
    desc = QString("<big><b>%1</b></big>").arg(MainWindow::tr("Move node Interaction"));

    QString S =
        "<html><head/><body>"
        "<small><i>" + QString(metaObject()->className()) + "</i></small><br/>"
        + desc;
    S += "<hr/>";
    S += "<ul style=\"margin-left: 0px; padding-left: 0px;\">";
    for (int i=0; i<helpList.size(); ++i) {
        S+= "<li>" + helpList[i] + "</li>";
    }
    S += "</ul>";
    S += "</body></html>";

    return S;
}
Example #5
0
void MythWizard::insertPage( QWidget * page, const QString & title, int index )
{
    if ( !page )
        return;
    if ( d->page( page ) ) {
        qWarning( "MythWizard::insertPage(): already added %s/%s to %s/%s",
                  page->metaObject()->className(), qPrintable(page->objectName()),
                  metaObject()->className(), qPrintable(objectName()) );
        return;
    }

    if ( index < 0  || index > d->pages.size() )
        index = d->pages.size();

    if ( index > 0 && ( index == d->pages.size() ) )
        d->pages[index - 1]->nextEnabled = true;

    MythWizardPrivate::Page * p = new MythWizardPrivate::Page( page, title );
    p->backEnabled = ( index > 0 );
    p->nextEnabled = ( index < d->pages.size() );

    d->ws->addWidget(page);
    d->pages.insert( index, p );
}
Example #6
0
bool StandardCategory::removeItself() {
  bool children_removed = true;

  // Remove all child items (feeds and categories)
  // from the database.
  foreach (RootItem *child, childItems()) {
    if (child->kind() == RootItemKind::Category) {
      children_removed &= static_cast<StandardCategory*>(child)->removeItself();
    }
    else if (child->kind() == RootItemKind::Feed) {
      children_removed &= static_cast<StandardFeed*>(child)->removeItself();
    }
  }

  if (children_removed) {
    // Children are removed, remove this standard category too.
    QSqlDatabase database = qApp->database()->connection(metaObject()->className(), DatabaseFactory::FromSettings);

    return DatabaseQueries::deleteCategory(database, id());
  }
  else {
    return false;
  }
}
void BusyIndicator::paintEvent(QPaintEvent *)
{
    QString key = QString("%1:%2:%3:%4:%5")
            .arg(metaObject()->className())
            .arg(width())
            .arg(height())
            .arg(startAngle)
            .arg(m_style);

    QPixmap pixmap;
    QPainter painter(this);
    painter.setRenderHint(QPainter::Antialiasing);

    int side = qMin(width(), height());

    if(!QPixmapCache::find(key, &pixmap)) {
        pixmap = generatePixmap(side);
        QPixmapCache::insert(key, pixmap);
    }

    painter.translate(width() / 2 - side / 2, height() / 2 - side / 2);

    painter.drawPixmap(0, 0, side, side, pixmap);
}
Example #8
0
VCWidget::VCWidget(QWidget* parent, Doc* doc)
    : QWidget(parent)
    , m_doc(doc)
    , m_allowChildren(false)
    , m_allowResize(true)
{
    Q_ASSERT(parent != NULL);
    Q_ASSERT(doc != NULL);

    /* Set the class name "VCWidget" as the object name as well */
    setObjectName(VCWidget::staticMetaObject.className());

    setMinimumSize(QSize(20, 20));

    m_hasCustomBackgroundColor = false;
    m_hasCustomForegroundColor = false;
    m_hasCustomFont = false;
    m_frameStyle = KVCFrameStyleNone;

    m_resizeMode = false;

    setBackgroundRole(QPalette::Window);
    setAutoFillBackground(true);
    setEnabled(true);

    connect(m_doc, SIGNAL(modeChanged(Doc::Mode)),
            this, SLOT(slotModeChanged(Doc::Mode)));

    /* Listen to parent's (only VCWidget-kind) key signals */
    if (parent->inherits(metaObject()->className()) == true)
    {
        connect(parent, SIGNAL(keyPressed(const QKeySequence&)),
                this, SLOT(slotKeyPressed(const QKeySequence&)));
        connect(parent,	SIGNAL(keyReleased(const QKeySequence&)),
                this, SLOT(slotKeyReleased(const QKeySequence&)));
    }
Example #9
0
void Generator::generate()
{
    if (m_classes.size() == 0) {
        ReportHandler::warning(QString("%1: no java classes, skipping")
                               .arg(metaObject()->className()));
        return;
    }


    foreach (AbstractMetaClass *cls, m_classes) {
        if (!shouldGenerate(cls))
            continue;

        QString fileName = fileNameForClass(cls);
        ReportHandler::debugSparse(QString("generating: %1").arg(fileName));

        FileOut fileOut(outputDirectory() + "/" + subDirectoryForClass(cls) + "/" + fileName);
        write(fileOut.stream, cls);

        if( fileOut.done() )
            ++m_num_generated_written;
        ++m_num_generated;
    }
}
Example #10
0
Dialog::Dialog(QWidget *parent, const QString &name, const QSize &defSize)
    : QDialog(parent)
    , defButton(0)
    , buttonTypes(0)
    , mw(0)
    , buttonBox(0)
    , shown(false) {
    if (!name.isEmpty()) {
        setObjectName(name);
        QSettings cfg;
        cfg.beginGroup(metaObject()->className());
        cfgSize = cfg.value(name + "/size", QSize()).toSize();
        if (!cfgSize.isEmpty()) {
            QDialog::resize(cfgSize);
        } else if (!defSize.isEmpty()) {
            QDialog::resize(defSize);
        }
        cfg.endGroup();
    }

    #ifdef Q_OS_MAC
    setWindowIcon(QIcon());
    #endif
}
Example #11
0
void XMainWindow::showEvent(QShowEvent *event)
{
  if(!_private->_shown)
  {
    _private->_shown = true;
//qDebug("isModal() %s", isModal()?"true":"false");

    QRect availableGeometry = QApplication::desktop()->availableGeometry();
    if(!omfgThis->showTopLevel() && !isModal())
      availableGeometry = omfgThis->workspace()->geometry();

    QString objName = objectName();
    QPoint pos = xtsettingsValue(objName + "/geometry/pos").toPoint();
    QSize lsize = xtsettingsValue(objName + "/geometry/size").toSize();

    if(lsize.isValid() && xtsettingsValue(objName + "/geometry/rememberSize", true).toBool() && (metaObject()->className() != QString("xTupleDesigner")))
      resize(lsize);

    setAttribute(Qt::WA_DeleteOnClose);
    if(omfgThis->showTopLevel() || isModal())
    {
      omfgThis->_windowList.append(this);
      statusBar()->show();
      QRect r(pos, size());
      if(!pos.isNull() && availableGeometry.contains(r) && xtsettingsValue(objName + "/geometry/rememberPos", true).toBool())
        move(pos);
    }
    else
    {
      QWidget * fw = focusWidget();
      omfgThis->workspace()->addWindow(this);
      QRect r(pos, size());
      if(!pos.isNull() && availableGeometry.contains(r) && xtsettingsValue(objName + "/geometry/rememberPos", true).toBool())
        move(pos);
      // This originally had to be after the show? Will it work here?
      if(fw)
        fw->setFocus();
    }

    loadScriptEngine();
  }

  bool blocked = _private->_action->blockSignals(true);
  _private->_action->setChecked(true);
  _private->_action->blockSignals(blocked);

  QMainWindow::showEvent(event);
}
Example #12
0
QMetaProperty BeerXMLElement::metaProperty(const char* name) const
{
   return metaObject()->property(metaObject()->indexOfProperty(name));
}
Example #13
0
QMetaProperty BeerXMLElement::metaProperty(QString const& name) const
{
   return metaObject()->property(metaObject()->indexOfProperty(name.toStdString().c_str()));
}
Example #14
0
void QDBusAdaptorConnector::connectAllSignals(QObject *obj)
{
    QMetaObject::connect(obj, -1, this, metaObject()->methodOffset(), Qt::DirectConnection);
}
Example #15
0
int BeerXMLElement::version() const { return QString(metaObject()->classInfo(metaObject()->indexOfClassInfo("version")).value()).toInt(); }
QString PointerCoordinates::getCurrentCoordinateSystemKey() const
{
	return metaObject()->enumerator(metaObject()->indexOfEnumerator("CoordinateSystem")).key(currentCoordinateSystem);
}
Example #17
0
void QDBusAdaptorConnector::disconnectAllSignals(QObject *obj)
{
    QMetaObject::disconnect(obj, -1, this, metaObject()->methodOffset());
}
Example #18
0
void ManhattanStyle::drawPrimitive(PrimitiveElement element, const QStyleOption *option,
                                   QPainter *painter, const QWidget *widget) const {
    if (!panelWidget(widget))
        return d->style->drawPrimitive(element, option, painter, widget);

    bool animating = (option->state & State_Animating);
    int state = option->state;
    QRect rect = option->rect;
    QRect oldRect;
    QRect newRect;
    if (widget && (element == PE_PanelButtonTool) && !animating) {
        QWidget *w = const_cast<QWidget *> (widget);
        int oldState = w->property("_q_stylestate").toInt();
        oldRect = w->property("_q_stylerect").toRect();
        newRect = w->rect();
        w->setProperty("_q_stylestate", (int)option->state);
        w->setProperty("_q_stylerect", w->rect());

        // Determine the animated transition
        bool doTransition = ((state & State_On)         != (oldState & State_On)     ||
                             (state & State_MouseOver)  != (oldState & State_MouseOver));
        if (oldRect != newRect) {
            doTransition = false;
            d->animator.stopAnimation(widget);
        }

        if (doTransition) {
            QImage startImage(option->rect.size(), QImage::Format_ARGB32_Premultiplied);
            QImage endImage(option->rect.size(), QImage::Format_ARGB32_Premultiplied);
            Animation *anim = d->animator.widgetAnimation(widget);
            QStyleOption opt = *option;
            opt.state = (QStyle::State)oldState;
            opt.state |= (State)State_Animating;
            startImage.fill(0);
            Transition *t = new Transition;
            t->setWidget(w);
            QPainter startPainter(&startImage);
            if (!anim) {
                drawPrimitive(element, &opt, &startPainter, widget);
            } else {
                anim->paint(&startPainter, &opt);
                d->animator.stopAnimation(widget);
            }
            QStyleOption endOpt = *option;
            endOpt.state |= (State)State_Animating;
            t->setStartImage(startImage);
            d->animator.startAnimation(t);
            endImage.fill(0);
            QPainter endPainter(&endImage);
            drawPrimitive(element, &endOpt, &endPainter, widget);
            t->setEndImage(endImage);
            t->setDuration(130);
            t->setStartTime(QTime::currentTime());
        }
    }

    switch (element) {
    case PE_PanelLineEdit: {
        painter->save();
        if (option->state & State_Enabled)
            drawCornerImage(d->lineeditImage, painter, option->rect, 2, 2, 2, 2);
        else
            drawCornerImage(d->lineeditImage_disabled, painter, option->rect, 2, 2, 2, 2);

        if (option->state & State_HasFocus || option->state & State_MouseOver) {
            QColor hover = StyleHelper::baseColor();
            if (state & State_HasFocus)
                hover.setAlpha(100);
            else
                hover.setAlpha(50);

            painter->setPen(QPen(hover, 1));
            painter->drawRect(option->rect.adjusted(1, 1, -2 ,-2));
        }
        painter->restore();
    }
    break;

    case PE_FrameStatusBarItem:
        break;

    case PE_PanelButtonTool: {
        Animation *anim = d->animator.widgetAnimation(widget);
        if (!animating && anim) {
            anim->paint(painter, option);
        } else {
            bool pressed = option->state & State_Sunken || option->state & State_On;
            QColor shadow(0, 0, 0, 30);
            painter->setPen(shadow);
            if (pressed) {
                QColor shade(0, 0, 0, 40);
                painter->fillRect(rect, shade);
                painter->drawLine(rect.topLeft() + QPoint(1, 0), rect.topRight() - QPoint(1, 0));
                painter->drawLine(rect.topLeft(), rect.bottomLeft());
                painter->drawLine(rect.topRight(), rect.bottomRight());
                // painter->drawLine(rect.bottomLeft()  + QPoint(1, 0), rect.bottomRight()  - QPoint(1, 0));
                QColor highlight(255, 255, 255, 30);
                painter->setPen(highlight);
            } else if (option->state & State_Enabled &&
                       option->state & State_MouseOver) {
                QColor lighter(255, 255, 255, 37);
                painter->fillRect(rect, lighter);
            }
        }
    }
    break;

    case PE_PanelStatusBar: {
        painter->save();
        QLinearGradient grad(option->rect.topLeft(), QPoint(rect.center().x(), rect.bottom()));
        QColor startColor = StyleHelper::shadowColor().darker(164);
        QColor endColor = StyleHelper::baseColor().darker(130);
        grad.setColorAt(0, endColor);
        grad.setColorAt(1, endColor);
        painter->fillRect(option->rect, grad);
        painter->setPen(QColor(255, 255, 255, 60));
        painter->drawLine(rect.topLeft() + QPoint(0,1),
                          rect.topRight()+ QPoint(0,1));
        painter->setPen(StyleHelper::borderColor().darker(110));
        painter->drawLine(rect.topLeft(), rect.topRight());
        painter->restore();
    }
    break;

    case PE_IndicatorToolBarSeparator: {
        QColor separatorColor = StyleHelper::borderColor();
        separatorColor.setAlpha(100);
        painter->setPen(separatorColor);
        const int margin = 3;
        if (option->state & State_Horizontal) {
            const int offset = rect.width()/2;
            painter->drawLine(rect.bottomLeft().x() + offset,
                              rect.bottomLeft().y() - margin,
                              rect.topLeft().x() + offset,
                              rect.topLeft().y() + margin);
        } else { //Draw vertical separator
            const int offset = rect.height()/2;
            painter->setPen(QPen(option->palette.background().color().darker(110)));
            painter->drawLine(rect.topLeft().x() + margin ,
                              rect.topLeft().y() + offset,
                              rect.topRight().x() - margin,
                              rect.topRight().y() + offset);
        }
    }
    break;

    case PE_IndicatorToolBarHandle: {
        bool horizontal = option->state & State_Horizontal;
        painter->save();
        QPainterPath path;
        int x = option->rect.x() + horizontal ? 2 : 6;
        int y = option->rect.y() + horizontal ? 6 : 2;
        static const int RectHeight = 2;
        if (horizontal) {
            while (y < option->rect.height() - RectHeight - 6) {
                path.moveTo(x, y);
                path.addRect(x, y, RectHeight, RectHeight);
                y += 6;
            }
        } else {
            while (x < option->rect.width() - RectHeight - 6) {
                path.moveTo(x, y);
                path.addRect(x, y, RectHeight, RectHeight);
                x += 6;
            }
        }

        painter->setPen(Qt::NoPen);
        QColor dark = StyleHelper::borderColor();
        dark.setAlphaF(0.4);

        QColor light = StyleHelper::baseColor();
        light.setAlphaF(0.4);

        painter->fillPath(path, light);
        painter->save();
        painter->translate(1, 1);
        painter->fillPath(path, dark);
        painter->restore();
        painter->translate(3, 3);
        painter->fillPath(path, light);
        painter->translate(1, 1);
        painter->fillPath(path, dark);
        painter->restore();
    }
    break;
    case PE_IndicatorArrowUp:
    case PE_IndicatorArrowDown:
    case PE_IndicatorArrowRight:
    case PE_IndicatorArrowLeft: {
        // From windowsstyle but modified to enable AA
        if (option->rect.width() <= 1 || option->rect.height() <= 1)
            break;

        QRect r = option->rect;
        int size = qMin(r.height(), r.width());
        QPixmap pixmap;
        QString pixmapName;
        pixmapName.sprintf("%s-%s-%d-%d-%d-%lld",
                           "$qt_ia", metaObject()->className(),
                           uint(option->state), element,
                           size, option->palette.cacheKey());
        if (!QPixmapCache::find(pixmapName, pixmap)) {
            int border = size/5;
            int sqsize = 2*(size/2);
            QImage image(sqsize, sqsize, QImage::Format_ARGB32);
            image.fill(Qt::transparent);
            QPainter imagePainter(&image);
            imagePainter.setRenderHint(QPainter::Antialiasing, true);
            imagePainter.translate(0.5, 0.5);
            QPolygon a;
            switch (element) {
            case PE_IndicatorArrowUp:
                a.setPoints(3, border, sqsize/2,  sqsize/2, border,  sqsize - border, sqsize/2);
                break;
            case PE_IndicatorArrowDown:
                a.setPoints(3, border, sqsize/2,  sqsize/2, sqsize - border,  sqsize - border, sqsize/2);
                break;
            case PE_IndicatorArrowRight:
                a.setPoints(3, sqsize - border, sqsize/2,  sqsize/2, border,  sqsize/2, sqsize - border);
                break;
            case PE_IndicatorArrowLeft:
                a.setPoints(3, border, sqsize/2,  sqsize/2, border,  sqsize/2, sqsize - border);
                break;
            default:
                break;
            }

            int bsx = 0;
            int bsy = 0;

            if (option->state & State_Sunken) {
                bsx = pixelMetric(PM_ButtonShiftHorizontal);
                bsy = pixelMetric(PM_ButtonShiftVertical);
            }

            QRect bounds = a.boundingRect();
            int sx = sqsize / 2 - bounds.center().x() - 1;
            int sy = sqsize / 2 - bounds.center().y() - 1;
            imagePainter.translate(sx + bsx, sy + bsy);

            if (!(option->state & State_Enabled)) {
                QColor foreGround(150, 150, 150, 150);
                imagePainter.setBrush(option->palette.mid().color());
                imagePainter.setPen(option->palette.mid().color());
            } else {
                QColor shadow(0, 0, 0, 100);
                imagePainter.translate(0, 1);
                imagePainter.setPen(shadow);
                imagePainter.setBrush(shadow);
                QColor foreGround(255, 255, 255, 210);
                imagePainter.drawPolygon(a);
                imagePainter.translate(0, -1);
                imagePainter.setPen(foreGround);
                imagePainter.setBrush(foreGround);
            }
            imagePainter.drawPolygon(a);
            imagePainter.end();
            pixmap = QPixmap::fromImage(image);
            QPixmapCache::insert(pixmapName, pixmap);
        }
        int xOffset = r.x() + (r.width() - size)/2;
        int yOffset = r.y() + (r.height() - size)/2;
        painter->drawPixmap(xOffset, yOffset, pixmap);
    }
    break;

    default:
        d->style->drawPrimitive(element, option, painter, widget);
        break;
    }
}
Example #19
0
QString Hardware::settingsGroup()
{
    return QString("Hardware/%1/").arg(metaObject()->className());
}
void RgShortestPathWidget::helpRequested()
{
  QgsContextHelp::run( metaObject()->className() );
}
void XMainWindow::showEvent(QShowEvent *event)
{
  if(!_private->_shown)
  {
    _private->_shown = true;

    QRect availableGeometry = QApplication::desktop()->availableGeometry();
    if(!omfgThis->showTopLevel() && !isModal())
      availableGeometry = omfgThis->workspace()->geometry();

    QString objName = objectName();
    QPoint pos = xtsettingsValue(objName + "/geometry/pos").toPoint();
    QSize lsize = xtsettingsValue(objName + "/geometry/size").toSize();

    setAttribute(Qt::WA_DeleteOnClose);
    if(omfgThis->showTopLevel() || isModal())
    {
      if(lsize.isValid() && xtsettingsValue(objName + "/geometry/rememberSize", true).toBool() && (metaObject()->className() != QString("xTupleDesigner")))
        resize(lsize);
      omfgThis->_windowList.append(this);
      statusBar()->show();
      QRect r(pos, size());
      if(!pos.isNull() && availableGeometry.contains(r) && xtsettingsValue(objName + "/geometry/rememberPos", true).toBool())
        move(pos);
    }
    else
    {
      QWidget * fw = focusWidget();
      QMdiSubWindow *subwin = omfgThis->workspace()->addSubWindow(this);
      omfgThis->workspace()->setActiveSubWindow(subwin);
      connect(this, SIGNAL(destroyed(QObject*)), subwin, SLOT(close()));
      if(lsize.isValid() && xtsettingsValue(objName + "/geometry/rememberSize", true).toBool())
          subwin->resize(lsize);
      QRect r(pos, lsize);
      if(!pos.isNull() && availableGeometry.contains(r) && xtsettingsValue(objName + "/geometry/rememberPos", true).toBool())
        move(pos);
      // This originally had to be after the show? Will it work here?
      if(fw)
        fw->setFocus();
    }

    _private->loadScriptEngine();

    QList<XCheckBox*> allxcb = findChildren<XCheckBox*>();
    for (int i = 0; i < allxcb.size(); ++i)
      allxcb.at(i)->init();

    shortcuts::setStandardKeys(this);
  }
Example #22
0
StreamsBrowsePage::StreamsBrowsePage(QWidget *p)
    : SinglePageWidget(p)
    , settings(0)
{
    importAction = new Action(Icon("document-import"), i18n("Import Streams Into Favorites"), this);
    exportAction = new Action(Icon("document-export"), i18n("Export Favorite Streams"), this);
    addAction = ActionCollection::get()->createAction("addstream", i18n("Add New Stream To Favorites"), Icons::self()->addRadioStreamIcon);
    editAction = new Action(Icons::self()->editIcon, i18n("Edit"), this);
    searchAction = new Action(Icons::self()->searchIcon, i18n("Seatch For Streams"), this);
    connect(searchAction, SIGNAL(triggered()), this, SIGNAL(searchForStreams()));
//     connect(view, SIGNAL(itemsSelected(bool)), addToPlaylist, SLOT(setEnabled(bool)));
    connect(view, SIGNAL(doubleClicked(const QModelIndex &)), this, SLOT(itemDoubleClicked(const QModelIndex &)));
    connect(view, SIGNAL(itemsSelected(bool)), SLOT(controlActions()));
    connect(addAction, SIGNAL(triggered()), this, SLOT(addStream()));
    connect(StreamsModel::self()->addBookmarkAct(), SIGNAL(triggered()), this, SLOT(addBookmark()));
    connect(StreamsModel::self()->configureDiAct(), SIGNAL(triggered()), this, SLOT(configureDi()));
    connect(StreamsModel::self()->reloadAct(), SIGNAL(triggered()), this, SLOT(reload()));
    connect(editAction, SIGNAL(triggered()), this, SLOT(edit()));
    connect(importAction, SIGNAL(triggered()), this, SLOT(importXml()));
    connect(exportAction, SIGNAL(triggered()), this, SLOT(exportXml()));
    connect(StreamsModel::self(), SIGNAL(error(const QString &)), this, SIGNAL(error(const QString &)));
    connect(StreamsModel::self(), SIGNAL(loading()), view, SLOT(showSpinner()));
    connect(StreamsModel::self(), SIGNAL(loaded()), view, SLOT(hideSpinner()));
    connect(StreamsModel::self(), SIGNAL(categoriesChanged()), view, SLOT(closeSearch()));
    connect(StreamsModel::self(), SIGNAL(favouritesLoaded()), SLOT(expandFavourites()));
    connect(StreamsModel::self(), SIGNAL(addedToFavourites(QString)), SLOT(addedToFavourites(QString)));
    connect(DigitallyImported::self(), SIGNAL(loginStatus(bool,QString)), SLOT(updateDiStatus()));
    connect(DigitallyImported::self(), SIGNAL(updated()), SLOT(updateDiStatus()));
    connect(view, SIGNAL(headerClicked(int)), SLOT(headerClicked(int)));
    StreamsModel::self()->configureDiAct()->setEnabled(false);

    proxy.setSourceModel(StreamsModel::self());
    view->setModel(&proxy);
    view->setDeleteAction(StdActions::self()->removeAction);
    view->setSearchResetLevel(1);
    view->alwaysShowHeader();

    Configuration config(metaObject()->className());
    view->setMode(ItemView::Mode_DetailedTree);
    view->load(config);

    MenuButton *menuButton=new MenuButton(this);
    Action *configureAction=new Action(Icons::self()->configureIcon, i18n("Configure"), this);
    connect(configureAction, SIGNAL(triggered()), SLOT(configure()));
    menuButton->addAction(createViewMenu(QList<ItemView::Mode>()  << ItemView::Mode_BasicTree << ItemView::Mode_SimpleTree
                                                                  << ItemView::Mode_DetailedTree << ItemView::Mode_List));
    menuButton->addAction(configureAction);
    menuButton->addAction(StreamsModel::self()->configureDiAct());
    menuButton->addSeparator();
    menuButton->addAction(addAction);
    menuButton->addAction(StdActions::self()->removeAction);
    menuButton->addAction(editAction);
    menuButton->addAction(StreamsModel::self()->reloadAct());
    menuButton->addSeparator();
    menuButton->addAction(importAction);
    menuButton->addAction(exportAction);

    diStatusLabel=new ServiceStatusLabel(this);
    diStatusLabel->setText("DI", i18nc("Service name", "Digitally Imported"));
    connect(diStatusLabel, SIGNAL(clicked()), SLOT(diSettings()));
    updateDiStatus();  
    ToolButton *searchButton=new ToolButton(this);
    searchButton->setDefaultAction(searchAction);
    init(ReplacePlayQueue, QList<QWidget *>() << menuButton << diStatusLabel, QList<QWidget *>() << searchButton);

    view->addAction(editAction);
    view->addAction(StdActions::self()->removeAction);
    view->addAction(StreamsModel::self()->addToFavouritesAct());
    view->addAction(StreamsModel::self()->addBookmarkAct());
    view->addAction(StreamsModel::self()->reloadAct());
}
Example #23
0
QString VotingManager::enumToString(VoteType aElement)
{
    int index = metaObject()->indexOfEnumerator("VoteType");
    QMetaEnum metaEnum = metaObject()->enumerator(index);
    return metaEnum.valueToKey(aElement);
}
Example #24
0
QByteArray TrackerClient::eventString(RequestEvent event) const
{
	return QByteArray(metaObject()->enumerator(metaObject()->indexOfEnumerator("RequestEvent")).valueToKey(event));
}
Example #25
0
const QMetaObject* AMExporterOptionGeneralAscii::getMetaObject(){
	return metaObject();
}
Example #26
0
/*!
    Constructs a bindable map with parent object \a parent.
*/
QQmlPropertyMap::QQmlPropertyMap(QObject *parent)
: QObject(*allocatePrivate(), parent)
{
    init(metaObject());
}
void QgsDecorationScaleBarDialog::on_buttonBox_helpRequested()
{
  QgsContextHelp::run( metaObject()->className() );
}
Example #28
0
bool PopupMenu::event(QEvent* event)
{
  DEBUG_PRST_ROUTES(stderr, "PopupMenu::event:%p activePopupWidget:%p this:%p class:%s event type:%d\n", 
          event, QApplication::activePopupWidget(), this, metaObject()->className(), event->type()); 
   
   switch(event->type())
   {
#ifndef POPUP_MENU_DISABLE_STAY_OPEN
   case QEvent::MouseButtonDblClick:
   {
      if(_stayOpen)
      {
         QMouseEvent* e = static_cast<QMouseEvent*>(event);
         if(e->modifiers() == Qt::NoModifier)
         {
            event->accept();
            // Convert into a return press, which selects the item and closes the menu.
            // Note that with double click, it's a press followed by release followed by double click.
            // That would toggle our item twice eg on->off->on, which is hopefully OK.
            QKeyEvent ke(QEvent::KeyPress, Qt::Key_Return, Qt::NoModifier);
            //ke.ignore();   // Pass it on
            return QMenu::event(&ke);
         }
      }
   }
   break;
   
   case QEvent::KeyPress:
   {
     QKeyEvent* e = static_cast<QKeyEvent*>(event);
     switch(e->key())
     {
        case Qt::Key_Space:
          if (!style()->styleHint(QStyle::SH_Menu_SpaceActivatesItem, 0, this))
              break;
        case Qt::Key_Select:
        case Qt::Key_Return:
        case Qt::Key_Enter:
        {
          if(QAction* act = activeAction())
          {
            const bool stay_open = _stayOpen && (MusEGlobal::config.popupsDefaultStayOpen || (e->modifiers() & Qt::ControlModifier));
            // Stay open? Or does the action have a submenu, but also a checkbox of its own?
            if(stay_open || (act->isEnabled() && act->menu() && act->isCheckable()))
            {
              act->trigger();  // Trigger the action. 
              event->accept();
              if(!stay_open)
                closeUp();
              return true;     // We handled it.
            }
            // Otherwise let ancestor QMenu handle it...
          }
        }
        break;
       
        default:
        break;
     }
   }
   break;
#endif   // POPUP_MENU_DISABLE_STAY_OPEN

#ifndef POPUP_MENU_DISABLE_AUTO_SCROLL
   case QEvent::MouseMove:
   {
      if(!MusEGlobal::config.scrollableSubMenus)
      {
        QMouseEvent* e = static_cast<QMouseEvent*>(event);
        QPoint globPos = e->globalPos();
        int dw = QApplication::desktop()->width();  // We want the whole thing if multiple monitors.
        if(x() < 0 && globPos.x() <= 0)   // If on the very first pixel (or beyond)
        {
          moveDelta = 32;
          if(!timer->isActive())
              timer->start();
          event->accept();
          return true;
        }
        else
          if(x() + width() >= dw && globPos.x() >= (dw -1))   // If on the very last pixel (or beyond)
          {
              moveDelta = -32;
              if(!timer->isActive())
                timer->start();
              event->accept();
              return true;
          }

        if(timer->isActive())
          timer->stop();
      }
   }
   break;
#endif  // POPUP_MENU_DISABLE_AUTO_SCROLL

   default:
      break;
   }

   event->ignore();
   return QMenu::event(event);
}
Example #29
0
QScriptDBusInterfaceConstructor::QScriptDBusInterfaceConstructor(QScriptEngine *engine, QScriptValue extensionObject)
{
    QScriptValue ctorValue = engine->newQObject(this);
    QScriptValue klass = engine->newQMetaObject(metaObject(), ctorValue);
    extensionObject.setProperty(QLatin1String("QDBusInterface"), klass);
}
Example #30
0
// reading, writing of .creatortheme ini file ////////////////////////////////
void Theme::writeSettings(const QString &filename) const
{
    QSettings settings(filename, QSettings::IniFormat);

    const QMetaObject &m = *metaObject();
    {
        settings.setValue(QLatin1String("ThemeName"), d->name);
        settings.setValue(QLatin1String("PreferredStyles"), d->preferredStyles);
    }
    {
        settings.beginGroup(QLatin1String("Palette"));
        for (int i = 0, total = d->colors.size(); i < total; ++i) {
            const QPair<QColor, QString> var = d->colors[i];
            if (var.second.isEmpty())
                continue;
            settings.setValue(var.second, writeColor(var.first));
        }
        settings.endGroup();
    }
    {
        settings.beginGroup(QLatin1String("Colors"));
        const QMetaEnum e = m.enumerator(m.indexOfEnumerator("Color"));
        for (int i = 0, total = e.keyCount(); i < total; ++i) {
            const QString key = QLatin1String(e.key(i));
            const QPair<QColor, QString> var = d->colors[i];
            if (!var.second.isEmpty())
                settings.setValue(key, var.second); // named color
            else
                settings.setValue(key, writeColor(var.first));
        }
        settings.endGroup();
    }
    {
        settings.beginGroup(QLatin1String("ImageFiles"));
        const QMetaEnum e = m.enumerator(m.indexOfEnumerator("ImageFile"));
        for (int i = 0, total = e.keyCount(); i < total; ++i) {
            const QString key = QLatin1String(e.key(i));
            const QString &var = d->imageFiles.at(i);
            if (!var.isEmpty())
                settings.setValue(key, var);
        }
        settings.endGroup();
    }
    {
        settings.beginGroup(QLatin1String("Gradients"));
        const QMetaEnum e = m.enumerator(m.indexOfEnumerator("Gradient"));
        for (int i = 0, total = e.keyCount(); i < total; ++i) {
            const QString key = QLatin1String(e.key(i));
            QGradientStops stops = gradient(static_cast<Theme::Gradient>(i));
            settings.beginWriteArray(key);
            int k = 0;
            foreach (const QGradientStop stop, stops) {
                settings.setArrayIndex(k);
                settings.setValue(QLatin1String("pos"), stop.first);
                settings.setValue(QLatin1String("color"), writeColor(stop.second));
                ++k;
            }
            settings.endArray();
        }
        settings.endGroup();
    }