/**
* Show function
* lets the instance show up in the interface, also registers the necessary buttons listeners
*/
void SearchPageArea::show() {
    if (!active)
    {

        Element::show();
        for (int i = 0; i <4; i++)
        {
            textFrames[i] = eyegui::addFloatingFrameWithBrick(pLayout, "bricks/SearchPageArea/floatingTweetBlock" + std::to_string(i + 1) + ".beyegui", 0.175f, 0.41f + 0.14125f*i, 0.65f, 0.1325f);
            buttonFrames[i] = eyegui::addFloatingFrameWithBrick(pLayout, "bricks/SearchPageArea/floatingButton" + std::to_string(i + 1) + ".beyegui", 0.175f, 0.41f + 0.14125f*i, 0.65f, 0.1325f);
            eyegui::registerButtonListener(pLayout, std::to_string(i), searchButtonListener);
        }
        textFrames[4] = eyegui::addFloatingFrameWithBrick(pLayout, "bricks/SearchPageArea/searchText.beyegui", 0.175f, 0.2875f, 0.65f, 0.11f);
        buttonFrames[4] = eyegui::addFloatingFrameWithBrick(pLayout, "bricks/SearchPageArea/searchButton.beyegui", 0.175f , 0.2875f , 0.65f, 0.11f);
        buttonFrames[5] = eyegui::addFloatingFrameWithBrick(pLayout, "bricks/SearchPageArea/tweetSearchButton.beyegui", 0.0f, 0.26f, 0.125f, 0.101f);
        buttonFrames[6] = eyegui::addFloatingFrameWithBrick(pLayout, "bricks/SearchPageArea/profileSearchButton.beyegui", 0.0f, 0.39f, 0.125f, 0.101f);
        eyegui::registerButtonListener(pLayout, "searchKeyboard", searchButtonListener);
        eyegui::registerButtonListener(pLayout, "tweetSearchButton", searchButtonListener);
        eyegui::registerButtonListener(pLayout, "profileSearchButton", searchButtonListener);
        eyegui::setContentOfTextBlock(pLayout, textboxes[0], searchWord);
        manageSearchButtons();
    }
    if (contentExists)
    {
        if (currentcontisuser)
        {
            showUsers();
        }
        else {
            showTweets();
        }
    }
}
/**
* scrollUp function
* Scroll the shown conten up on the basis of an int
* @param[in] i is the int for how much will be scrolled
*/
void SearchPageArea::scrollUp(int i) {
    selectContent("none");
    int size;
    if (currentcontisuser)
    {
        size = content.Size();
    }
    else {
        size = content["statuses"].Size();
    }
    if (index + 4 + i <size)
    {
        index += i;
    }
    else {
        index = size - 4;
    }
    if (currentcontisuser)
    {

        showUsers();
    }
    else {

        showTweets();
    }
}
/**
* scrollDown function
* Scroll the shown conten down on the basis of an int
* @param[in] i is the int for how much will be scrolled
*/
void SearchPageArea::scrollDown(int i) {
    selectContent("none");
    if (index - i >0)
    {
        index -= i;
    }
    else {
        index = 0;
    }
    if (currentcontisuser)
    {

        showUsers();
    }
    else {

        showTweets();
    }
}
/**
* search function
* functions searches after content in twitter with a searchWord
*/
void SearchPageArea::search() {
    selectContent("none");
    index = 0;
    if (searchWord=="") return;
    if (TwitterApp::getInstance()->hasConnection()) {
        if (userSearch)
        {
            content = TwitterApp::getInstance()->getTwitter()->userSearch(searchWord, "80");
            contentExists = true;
            currentcontisuser = true;
            showUsers();
        }
        else {
            content = TwitterApp::getInstance()->getTwitter()->search(searchWord, "80");
            contentExists = true;
            currentcontisuser = false;
            showTweets();
        }
    }
}
예제 #5
0
STUserProfileView::STUserProfileView(STUserPane *parent) :
    STScrolledPane(parent)
{
    m_followersView=new STUserProfileNumberView(contentsView());
    m_followersView->setLabelText(":/stella/res/FollowersText.png");
    m_followersView->setToolTip(tr("Number of Followers"));

    m_friendsView=new STUserProfileNumberView(contentsView());
    m_friendsView->setLabelText(":/stella/res/FollowingText.png");
    m_friendsView->setToolTip(tr("Number of Following Users"));

    m_tweetsView=new STUserProfileNumberView(contentsView());
    m_tweetsView->setLabelText(":/stella/res/TweetsText.png");
    m_tweetsView->setToolTip(tr("Number of Tweets"));

    m_favoritesView=new STUserProfileNumberView(contentsView());
    m_favoritesView->setLabelText(":/stella/res/FavoritesText.png");
    m_favoritesView->setToolTip(tr("Number of Favorites"));

    m_listedView=new STUserProfileNumberView(contentsView());
    m_listedView->setLabelText(":/stella/res/ListedText.png");
    m_listedView->setToolTip(tr("Number of Lists User is Added to"));

    m_bioLabel=new STLinkedLabelView(contentsView());
    m_bioLabel->setBgColor(QColor(70,70,70));
    m_bioLabel->setTextColor(QColor(140,140,140));
    m_bioLabel->setContents(STFont::defaultBoldFont(),
                            tr("BIO"));

    m_bioText=new STLinkedLabelView(contentsView());
    m_bioText->setBgColor(QColor(70,70,70));
    m_bioText->setTextColor(QColor(240,240,240));
    m_bioText->setSelectable(true);
    m_bioText->setFlag(ItemIsFocusable);

    m_urlLabel=new STLinkedLabelView(contentsView());
    m_urlLabel->setBgColor(QColor(70,70,70));
    m_urlLabel->setTextColor(QColor(140,140,140));
    m_urlLabel->setContents(STFont::defaultBoldFont(),
                            tr("URL"));

    m_urlText=new STLinkedLabelView(contentsView());
    m_urlText->setBgColor(QColor(70,70,70));
    m_urlText->setTextColor(QColor(240,240,240));
    m_urlText->setSelectable(true);
    m_urlText->setFlag(ItemIsFocusable);

    m_locLabel=new STLinkedLabelView(contentsView());
    m_locLabel->setBgColor(QColor(70,70,70));
    m_locLabel->setTextColor(QColor(140,140,140));
    m_locLabel->setContents(STFont::defaultBoldFont(),
                            tr("LOC"));

    m_locText=new STLinkedLabelView(contentsView());
    m_locText->setBgColor(QColor(70,70,70));
    m_locText->setTextColor(QColor(240,240,240));
    m_locText->setSelectable(true);
    m_locText->setFlag(ItemIsFocusable);

    m_sinceLabel=new STLinkedLabelView(contentsView());
    m_sinceLabel->setBgColor(QColor(70,70,70));
    m_sinceLabel->setTextColor(QColor(140,140,140));
    m_sinceLabel->setContents(STFont::defaultBoldFont(),
                            tr("SINCE"));

    m_sinceText=new STLinkedLabelView(contentsView());
    m_sinceText->setBgColor(QColor(70,70,70));
    m_sinceText->setTextColor(QColor(240,240,240));
    m_sinceText->setSelectable(true);
    m_sinceText->setFlag(ItemIsFocusable);

    connect(m_followersView, SIGNAL(activated()),
            this, SLOT(showFollowers()));
    connect(m_friendsView, SIGNAL(activated()),
            this, SLOT(showFriends()));
    connect(m_tweetsView, SIGNAL(activated()),
            parent, SLOT(showTweets()));
    connect(m_favoritesView, SIGNAL(activated()),
            parent, SLOT(showFavorites()));
    connect(m_listedView, SIGNAL(activated()),
            this, SLOT(showAddedLists()));

    connect(m_bioText, SIGNAL(linkActivated(STObjectManager::EntityRange*,
                                            STObjectManager::LinkActivationInfo)),
            this, SLOT(linkActivate(STObjectManager::EntityRange*,
                                    STObjectManager::LinkActivationInfo)));
    connect(m_urlText, SIGNAL(linkActivated(STObjectManager::EntityRange*,
                                            STObjectManager::LinkActivationInfo)),
            this, SLOT(linkActivate(STObjectManager::EntityRange*,
                                    STObjectManager::LinkActivationInfo)));
    connect(m_locText, SIGNAL(linkActivated(STObjectManager::EntityRange*,
                                            STObjectManager::LinkActivationInfo)),
            this, SLOT(linkActivate(STObjectManager::EntityRange*,
                                    STObjectManager::LinkActivationInfo)));
    connect(m_sinceText, SIGNAL(linkActivated(STObjectManager::EntityRange*,
                                              STObjectManager::LinkActivationInfo)),
            this, SLOT(linkActivate(STObjectManager::EntityRange*,
                                    STObjectManager::LinkActivationInfo)));


    m_lastWidth=0;

}