示例#1
0
void KSPopupMenu::createSupernovaMenu(Supernova* supernova)
{
    QString name=supernova->name();
    float mag = supernova->mag();
    QString type = supernova->getType();
    initPopupMenu( supernova, name, i18n( "supernova" ), i18n("%1<sup>m</sup>, %2", mag, type) );
}
示例#2
0
void KSPopupMenu::createDeepSkyObjectMenu( DeepSkyObject *obj ) {
    QString name     = getObjectName(obj);
    QString typeName = obj->typeName();
    // FIXME: information about angular sizes should be added.
    QString info = magToStr( obj->mag() );
    initPopupMenu( obj, name, typeName, info );
    addLinksToMenu( obj );
}
示例#3
0
void KSPopupMenu::createEmptyMenu( SkyPoint *nullObj ) {
    KStars* ks = KStars::Instance();
    SkyObject o( SkyObject::TYPE_UNKNOWN, nullObj->ra(), nullObj->dec() );
    o.setAlt( nullObj->alt() );
    o.setAz( nullObj->az() );
    initPopupMenu( &o, i18n( "Empty sky" ), QString(), QString(), false, false );
    addAction( i18nc( "Sloan Digital Sky Survey", "Show SDSS Image" ), ks->map(), SLOT( slotSDSS() ) );
    addAction( i18nc( "Digitized Sky Survey", "Show DSS Image" ),      ks->map(), SLOT( slotDSS()  ) );
}
示例#4
0
bool PBase::init()
{
    if ( !WJLayer::init() )
    {
        return false;
    }

#if (COCOS2D_DEBUG)
    CCLOG("Init Scene: %s...", getGameName().c_str());
#endif

    m_winSize = Director::getInstance()->getWinSize();
    m_visibleSize = Director::getInstance()->getVisibleSize();
    m_origin = Director::getInstance()->getVisibleOrigin();
    m_visibleRect = Rect(m_origin.x, m_origin.y, m_visibleSize.width, m_visibleSize.height);

    // top layer
    m_topLayer = WJLayer::create();
    m_topLayer->saveCurrentPosition();
    this->addChild(m_topLayer, ZORDER_TOP_LAYER);

    // p001 welcome
    if (getGameNumber() == GameNumber::P000 || getGameNumber() == GameNumber::P010)
    {
        // android back key
        this->addChild(LBToolbar::createBackKey([&]()
        {
            // quit app
            WJUtils::callaction_void(ACTION_VOID_CONFIRM_QUIT);
        }));
    }
    else
    {
        initPopupMenu();
        initSnapshot();
        initAdsBanner();
    }

    return true;
}
示例#5
0
void KSPopupMenu::createStarMenu( StarObject *star ) {
    KStars* ks = KStars::Instance();
    //Add name, rise/set time, center/track, and detail-window items
    QString name;
    if( star->name() != "star" ) {
        name = star->translatedLongName();
    } else {
        if( star->getHDIndex() ) {
            name = QString( "HD%1" ).arg( QString::number( star->getHDIndex() ) );
        } else {
            // FIXME: this should be some catalog name too
            name = "Star";
        }
    }
    initPopupMenu( star, name, i18n( "star" ), i18n("%1<sup>m</sup>, %2", star->mag(), star->sptype()) );
    //If the star is named, add custom items to popup menu based on object's ImageList and InfoList
    if ( star->name() != "star" ) {
        addLinksToMenu( star );
    } else {
        addAction( i18nc( "Sloan Digital Sky Survey", "Show SDSS Image" ), ks->map(), SLOT( slotSDSS() ) );
        addAction( i18nc( "Digitized Sky Survey", "Show DSS Image" ), ks->map(), SLOT( slotDSS() ) );
    }
}
示例#6
0
void KSPopupMenu::createMoonMenu( KSMoon *moon ) {
    QString info = QString("%1, %2").arg( magToStr(moon->mag()), moon->phaseName() );
    initPopupMenu( moon, moon->translatedName(), QString(), info);
    addLinksToMenu( moon, false ); //don't offer DSS images for planets
}
示例#7
0
void KSPopupMenu::createPlanetMenu( SkyObject *p ) {
    QString info = magToStr( p->mag() );
    QString type = i18n("Solar system object");;
    initPopupMenu( p, p->translatedName(), type, info);
    addLinksToMenu( p, false ); //don't offer DSS images for planets
}
示例#8
0
KonqFrameTabs::KonqFrameTabs(QWidget *parent, KonqFrameContainerBase *parentContainer,
                             KonqViewManager *viewManager)
    : KTabWidget(parent),
      m_pPopupMenu(0),
      m_pSubPopupMenuTab(0),
      m_rightWidget(0), m_leftWidget(0), m_alwaysTabBar(false)
{
    // Set an object name so the widget style can identify this widget.
    setObjectName(QStringLiteral("kde_konq_tabwidget"));
    setDocumentMode(true);

    KAcceleratorManager::setNoAccel(this);

    tabBar()->setWhatsThis(i18n("This bar contains the list of currently open tabs. Click on a tab to make it "
                                "active. You can also use keyboard shortcuts to "
                                "navigate through tabs. The text on the tab shows the content "
                                "currently open in it; place your mouse over the tab to see the full title, in "
                                "case it has been shortened to fit the tab width."));
    //qDebug() << "KonqFrameTabs::KonqFrameTabs()";

    m_pParentContainer = parentContainer;
    m_pActiveChild = 0L;
    m_pViewManager = viewManager;

    m_permanentCloseButtons = KonqSettings::permanentCloseButton();
    if (m_permanentCloseButtons) {
        setTabsClosable(true);
    }
    tabBar()->setSelectionBehaviorOnRemove(
        KonqSettings::tabCloseActivatePrevious() ? QTabBar::SelectPreviousTab : QTabBar::SelectRightTab);

    if (KonqSettings::tabPosition() == QLatin1String("Bottom")) {
        setTabPosition(QTabWidget::South);
    }
    connect(this, SIGNAL(closeRequest(QWidget*)), SLOT(slotCloseRequest(QWidget*)));
    connect(this, SIGNAL(removeTabPopup()),
            m_pViewManager->mainWindow(), SLOT(slotRemoveTabPopup()));

    if (KonqSettings::addTabButton()) {
        m_leftWidget = new NewTabToolButton(this);
        connect(m_leftWidget, SIGNAL(clicked()),
                m_pViewManager->mainWindow(), SLOT(slotAddTab()));
        connect(m_leftWidget, SIGNAL(testCanDecode(const QDragMoveEvent*,bool&)),
                SLOT(slotTestCanDecode(const QDragMoveEvent*,bool&)));
        connect(m_leftWidget, SIGNAL(receivedDropEvent(QDropEvent*)),
                SLOT(slotReceivedDropEvent(QDropEvent*)));
        m_leftWidget->setIcon(QIcon::fromTheme(QStringLiteral("tab-new")));
        m_leftWidget->adjustSize();
        m_leftWidget->setToolTip(i18n("Open a new tab"));
        setCornerWidget(m_leftWidget, Qt::TopLeftCorner);
    }
    if (KonqSettings::closeTabButton()) {
        m_rightWidget = new QToolButton(this);
        connect(m_rightWidget, SIGNAL(clicked()),
                m_pViewManager->mainWindow(), SLOT(slotRemoveTab()));
        m_rightWidget->setIcon(QIcon::fromTheme(QStringLiteral("tab-close")));
        m_rightWidget->adjustSize();
        m_rightWidget->setToolTip(i18n("Close the current tab"));
        setCornerWidget(m_rightWidget, Qt::TopRightCorner);
    }

    setAutomaticResizeTabs(true);
    setMovable(true);

    connect(tabBar(), SIGNAL(tabMoved(int,int)),
            SLOT(slotMovedTab(int,int)));
    connect(this, SIGNAL(movedTab(int,int)),
            SLOT(slotMovedTab(int,int)));
    connect(this, SIGNAL(mouseMiddleClick()),
            SLOT(slotMouseMiddleClick()));
    connect(this, SIGNAL(mouseMiddleClick(QWidget*)),
            SLOT(slotMouseMiddleClick(QWidget*)));
    connect(this, SIGNAL(mouseDoubleClick()),
            m_pViewManager->mainWindow(), SLOT(slotAddTab()));

    connect(this, SIGNAL(testCanDecode(const QDragMoveEvent*,bool&)),
            SLOT(slotTestCanDecode(const QDragMoveEvent*,bool&)));
    connect(this, SIGNAL(receivedDropEvent(QDropEvent*)),
            SLOT(slotReceivedDropEvent(QDropEvent*)));
    connect(this, SIGNAL(receivedDropEvent(QWidget*,QDropEvent*)),
            SLOT(slotReceivedDropEvent(QWidget*,QDropEvent*)));
    connect(this, SIGNAL(initiateDrag(QWidget*)),
            SLOT(slotInitiateDrag(QWidget*)));

#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
#pragma message("KF5: revert the commit that introduced this line")
#endif
    tabBar()->installEventFilter(this);
    initPopupMenu();
}