void DummyObject::setApplicationPage(MApplicationPage *page)
{
    Q_ASSERT(page != 0);
    Q_ASSERT(this->page == 0);

    this->page = page;
    connect(page, SIGNAL(appearing()), SLOT(onApplicationPageAppearing()));
    connect(page, SIGNAL(appeared()), SLOT(onApplicationPageAppeared()));
}
void StaticPageBenchmark::start()
{
    MApplication::activeWindow()->setOrientationAngle(targetOrientationAngle);
    MApplication::activeWindow()->setOrientationAngleLocked(true);
    if (!applicationPage->isOnDisplay()) {
        connect(applicationPage, SIGNAL(appeared()), this, SLOT(stabilizeFps()));
        applicationPage->appear(MApplication::activeWindow());
        verifyAppearanceTimer->start(5000);
    } else {
        QTimer::singleShot(0, this, SLOT(stabilizeFps()));
    }
}
LoginSheet::LoginSheet()
{
    fakeAuthenticationTimer.setSingleShot(true);
    fakeAuthenticationTimer.setInterval(2000);
    connect(&fakeAuthenticationTimer, SIGNAL(timeout()), SLOT(showLoginSuccessfulAndDismiss()));

    userNameTextEdit = 0;

    createCentralWidget();
    createHeaderWidget();

    connect(this, SIGNAL(appeared()), SLOT(setfocusOnUsernameTextEdit()));
}
Example #4
0
 string alienOrder(vector<string>& words) {
 	if (words.empty()) return "";
     vector<vector<int> > edgemap(26);
     vector<int> vis(26, 0), appeared(26, 0);
     for (int i = 0; i < words.size(); i ++) {
     	for (int j = 0; j < words[i].size(); j ++) {
     		appeared[words[i][j] - 'a'] ++;
     	}
     }
     string prev = words[0];
     for (int i = 1; i < words.size(); i ++) {
     	if (words[i] == words[i - 1]) continue;
     	int j = 0;
     	for (j = 0; j < prev.size() && j < words[i].size(); j ++) {
     		if (prev[j] != words[i][j]) break;
     	}
     	if (j == prev.size() || j == words[i].size()) continue;
     	int cur1 = prev[j] - 'a', cur2 = words[i][j] - 'a';
     	edgemap[cur1].push_back(cur2);
     	vis[cur2] ++;
     	prev = words[i];
     }
     queue<int> q;
     string res = "";
     for (int i = 0; i < 26; i ++) {
     	if (vis[i] == 0 && appeared[i] != 0) {
     		q.push(i);
     	}
     }
     while (!q.empty()) {
     	int cnt = q.front();
         char cur = cnt + 'a';
         res += cur;
         q.pop();
         for (int i = 0; i < edgemap[cnt].size(); i ++) {
         	int temp = edgemap[cnt][i];
         	if (vis[temp] > 0) {
         		vis[temp] --;
         		if (vis[temp] == 0) {
         			q.push(temp);
         		}
         	}
         }
     }
     for (int i = 0; i < 26; i ++) {
     	if (vis[i] != 0) return "";
     }
     return res;
 }
DebugPage::DebugPage() :
    GenericPage(),
    mInfo(new MLabel()),
    mBox(new MContainer()),
    vmInfo(new MLabel()),
    vmBox(new MContainer()),
    nInfo(new MLabel()),
    nBox(new MContainer()),
    cInfo(new MLabel()),
    cBox(new MContainer())
{
    m_pageType = GenericPage::PAGE_DEBUG;
    setObjectName("debugPage");
    connect(this, SIGNAL(appeared()), SLOT(refreshContent()));
}
Example #6
0
void LookAlikeMainPrivate::onMultiSelectionDone(QList<QUrl> urlList)
{
    m_facesToProcess = urlList;
    m_progress = new MProgressIndicator(0, MProgressIndicator::barType);
    m_progress->setStyleName(("CommonProgressBarInverted"));
    m_progress->setRange(0, urlList.size());
    m_progressDialog = new MDialog();
    m_progressDialog->setCentralWidget(m_progress);
    m_progressDialog->appear(MSceneWindow::DestroyWhenDone);

    connect(m_progressDialog, SIGNAL(appeared()),
            this, SLOT(processFaces()),
            Qt::QueuedConnection);
    connect(m_progress, SIGNAL(valueChanged(int)),
            this, SLOT(processFaces()),
            Qt::QueuedConnection);
    connect(m_progressDialog, SIGNAL(rejected()),
            this, SLOT(onProgressDialogRejected()));
}
bool NetworkManagementEngine::sourceRequestEvent(const QString &name)
{
    kDebug() << "Source requested:" << name << sources();
    setData(name, DataEngine::Data());
    //setData("networkStatus", "isConnected", true);
    //scheduleSourcesUpdated();

    if (name == "connections") {
        connect(d->activatables, SIGNAL(activatableAdded(RemoteActivatable*)),
                SLOT(activatableAdded(RemoteActivatable*)));
        connect(d->activatables, SIGNAL(activatableRemoved(RemoteActivatable*)),
                SLOT(activatableRemoved(RemoteActivatable*)));

        connect(d->activatables, SIGNAL(appeared()), SLOT(listAppeared()));
        connect(d->activatables, SIGNAL(disappeared()), SLOT(listDisappeared()));
        kDebug() << "connected...";
        listAppeared();
        return true;
    }
Example #8
0
int main()
{
    int a,b,i,num,tmp,k;
    int parsed[11],len,last,dg_count,before[200],bn,flag=0;
    while(scanf("%d",&num)&&num)
    {
         printf("Original number was %d\n",num);
         len=0;last=num;bn=0;
         while(1)
         {
             len++;
             tmp=last;dg_count=0;
                while(last)//parse it
         {
             parsed[dg_count++]=last%10;
             last/=10;
         }
         last=tmp;
         qsort(parsed,dg_count,sizeof(int),cmp);
         a=0;k=1;
         for(i=0;i<dg_count;i++)
         {
             a+=parsed[i]*k;
             k*=10;
         }
         printf("%d - ",a);
         b=0;k=1;
         for(i=dg_count-1;i>=0;i--)
         {
             b+=parsed[i]*k;
             k*=10;
         }
         printf("%d = %d\n",b,a-b);
         if(appeared(a-b,before,bn))
            break;
         before[bn++]=a-b;
        last=a-b;
         }
         printf("Chain length %d\n\n",len);
    }
    return 0;
}
Example #9
0
MainPage::MainPage(QGraphicsItem *parent)
	: MApplicationPage(parent),
	  m_objectMenu(NULL),
	  m_unknownObjectMenu(NULL),
	  m_longTapIndex(QModelIndex())
{
	m_bluez = new BluezSupplicant(this);
	m_reader = new TagReader(this);
	m_monitor = new NfcdMonitor(this);

	connect(this, SIGNAL(appeared()), 
		this, SLOT(pageAppeared()));

	connect(this, SIGNAL(disappearing()), 
		this, SLOT(pageDisappearing()));

	connect(m_reader, SIGNAL(messageRead(const QNdefMessage)),
		this, SLOT(messageRead(const QNdefMessage)));

	m_monitor->start();
}
Example #10
0
LookAlikeMainPrivate::LookAlikeMainPrivate(LookAlikeMain *q) :
    QObject(q),
    m_currentAction(0),
    q_ptr(q)
{
    // Less correct the problem with the DB first of all, if no other
    // application has dealt with it first.
    m_faceRecognitionResetter = new FaceRecognitionResetter();
    if (!m_faceRecognitionResetter->isDBCorrected()) {
        m_faceRecognitionResetter->dealWithDB(1);
    }

    m_galleryModel = new GalleryModel(this);
    m_galleryModel->setFaceRecognitionEnabled(true);
    QSparqlConnection *connection = m_galleryModel->sparqlConnection();
    m_trackerProvider = new TrackerContentProvider(connection, this);
    m_galleryModel->addContentProvider(m_trackerProvider);
    m_faceDatabaseProvider = new FaceDatabaseProvider(connection, this);
    m_faceTrackerProvider = new FaceTrackerProvider(connection, this);
    m_confirmedContactsListPage = new GalleryPeopleListPage(m_faceTrackerProvider->model());
    m_proposedContactsListPage = new GalleryPeopleListPage(m_faceDatabaseProvider);
    m_gridPage = new GalleryGridPage(*m_galleryModel);
    m_fullScreenPage = new GalleryFullScreenPage(*m_galleryModel);

    m_confirmedContactsListPage->setStyleName("GalleryPage");
    m_proposedContactsListPage->setStyleName("GalleryPage");
    m_gridPage->setStyleName("GalleryPage");
    m_fullScreenPage->setStyleName("GalleryPage");

    MAction* allTabAction = new MAction("icon-m-toolbar-all-content-white", "", q);
    allTabAction->setLocation(MAction::ToolBarLocation);
    allTabAction->setCheckable(true);

    MAction* confirmedContactsTabAction = new MAction("icon-m-toolbar-known-people-white", "", q);
    confirmedContactsTabAction->setLocation(MAction::ToolBarLocation);
    confirmedContactsTabAction->setCheckable(true);

    MAction* proposedContactsAction = new MAction("icon-m-toolbar-unknown-people-white", "", q);
    proposedContactsAction->setLocation(MAction::ToolBarLocation);
    proposedContactsAction->setCheckable(true);

    MAction* landscapeTabAction = new MAction("icon-m-toolbar-no-people-white", "", q);
    landscapeTabAction->setLocation(MAction::ToolBarLocation);
    landscapeTabAction->setCheckable(true);

    QList<QAction*> actions;
    actions.append(allTabAction);
    actions.append(confirmedContactsTabAction);
    actions.append(proposedContactsAction);
    actions.append(landscapeTabAction);

    MToolBar* toolbar = new MToolBar();
    toolbar->setStyleName("MToolbarTabStyleInverted");
    toolbar->setOpacity(0.9);
    toolbar->setViewType(MToolBar::tabType);
    toolbar->addActions(actions);

    m_toolbarAction = new MWidgetAction(q);
    m_toolbarAction->setLocation(MAction::ToolBarLocation);
    m_toolbarAction->setWidget(toolbar);

    m_confirmFaceAction = new MAction("Confirm faces", q);
    m_confirmFaceAction->setLocation(MAction::ApplicationMenuLocation);
    m_deleteFaceAction = new MAction("Delete faces", q);
    m_deleteFaceAction->setLocation(MAction::ApplicationMenuLocation);
    m_aboutAction = new MAction("About", q);
    m_aboutAction->setLocation(MAction::ApplicationMenuLocation);

    const QPixmap *pixmap = MTheme::pixmap("icon-m-toolbar-view-menu-dimmed-white");
    MImageWidget *menuImage = new MImageWidget();
    menuImage->setImage(pixmap->toImage());
    menuImage->setZoomFactor(1.f);
    menuImage->setMinimumWidth(88.f);
    MTheme::releasePixmap(pixmap);
    MWidgetAction* fakeAction= new MWidgetAction(q);
    fakeAction->setLocation(MAction::ToolBarLocation);
    fakeAction->setWidget(menuImage);

    m_confirmedContactsListPage->addAction(m_toolbarAction);
    m_confirmedContactsListPage->addAction(fakeAction);

    m_proposedContactsListPage->addAction(m_toolbarAction);
    m_proposedContactsListPage->addAction(fakeAction);

    connect(m_confirmedContactsListPage, SIGNAL(personSelected(QString,QString)),
            this, SLOT(onConfirmedContactSelected(QString,QString)));
    connect(m_proposedContactsListPage, SIGNAL(personSelected(QString,QString)),
            this, SLOT(onProposedContactPersonSelected(QString,QString)));
    connect(m_gridPage, SIGNAL(multiSelectionDone(QList<QUrl>)),
            this, SLOT(onMultiSelectionDone(QList<QUrl>)));
    connect(m_gridPage, SIGNAL(itemSelected(QUrl)),
            this, SLOT(onItemSelected(QUrl)));
    connect(m_fullScreenPage, SIGNAL(itemDeleted(QUrl)),
            m_faceDatabaseProvider, SLOT(update()));
    connect(m_trackerProvider, SIGNAL(dataChanged()),
            this, SLOT(onDataChanged()));
    connect(m_confirmFaceAction, SIGNAL(triggered()),
            this, SLOT(onConfirmFaceActionTriggered()));
    connect(m_deleteFaceAction, SIGNAL(triggered()),
            this, SLOT(onDeleteFaceActionTriggered()));
    connect(m_aboutAction, SIGNAL(triggered()),
            this, SLOT(onAboutActionTriggered()));
    connect(allTabAction, SIGNAL(toggled(bool)),
            this, SLOT(onAllTabActionToggled(bool)));
    connect(confirmedContactsTabAction, SIGNAL(toggled(bool)),
            this, SLOT(onConfirmedContactTabActionToggled(bool)));
    connect(proposedContactsAction, SIGNAL(toggled(bool)),
            this, SLOT(onProposedContactTabActionToggled(bool)));
    connect(landscapeTabAction, SIGNAL(toggled(bool)),
            this, SLOT(onLandscapeTabActionToggled(bool)));
    connect(m_gridPage, SIGNAL(appeared()),
            this, SLOT(onGridPageAppeared()));
    connect(m_fullScreenPage, SIGNAL(appeared()),
            this, SLOT(onFullscreenPageAppeared()));
    connect(m_fullScreenPage, SIGNAL(loadingActiveItemFailed(QString)),
            m_fullScreenPage, SLOT(disappear()));
    connect(m_galleryModel, SIGNAL(galleryItemsRemoved(int,int)),
            this, SLOT(onGalleryItemsRemoved()));

    allTabAction->toggle();
}
TextEntryVkbPage::~TextEntryVkbPage() {
    disconnect(this, SIGNAL(appeared()), this, SLOT(showVirtualKeyboard()));
}