Exemplo n.º 1
0
int
TestTask::goNext()
{
    switch ( m_state )
    {
        case DO_LOG:
        {
            if ( 0 == m_testnum%everylognum )
            {
                TestWorkItem *pWI = new TestWorkItem();
                pWI->setData(m_data);
                pWI->setTaskID(getID());
                g_pDispatcher->postRequest(pWI);
            }
            m_state = WAIT_WORKITEM;
            goNext();
            break;
        }
        case WAIT_WORKITEM:
            if ( 0 != m_testnum%everylognum )
            {
                m_state = FINISH;
                goNext();
            }
            break;
        case FINISH:
            TaskManager::getInstance()->recycle(getID());
            break;
        default:
            ERROR_LOG("TestTask no this state");
            return FAILED;
            break;
    }
    return SUCCESSFUL;
}
Exemplo n.º 2
0
bool parseRegion(Region & region, seqan::CharString const & regionString)
{
    seqan::Stream<seqan::CharArray<char const *> > stream(begin(regionString, seqan::Standard()),
                                                          end(regionString, seqan::Standard()));
    seqan::RecordReader<seqan::Stream<seqan::CharArray<char const *> >, seqan::SinglePass<> > reader(stream);

    // Parse out sequence name.
    seqan::CharString buffer;
    int res = readUntilChar(buffer, reader, ':');
    if (res != 0 && res != seqan::EOF_BEFORE_SUCCESS)
        return 1;  // Parse error.
    region.seqName = buffer;
    if (atEnd(reader))
        return true;  // Done after parsing the sequence name.

    goNext(reader);  // Skip ':'.

    // Parse out begin position.
    clear(buffer);
    while (!atEnd(reader) && value(reader) != '-')
    {
        if (!isdigit(value(reader)) && value(reader) != ',')
            return false;  // Error parsing.
        if (isdigit(value(reader)))
            appendValue(buffer, value(reader));
        goNext(reader);
    }
    if (empty(buffer))
        return false;
    if (!lexicalCast2(region.beginPos, buffer))
        return false;
    if (region.beginPos <= 0)
        return false;
    region.beginPos -= 1;  // Adjust to 0-based.
    if (atEnd(reader))
        return true;
    goNext(reader);  // Skip '-'.

    // Parse out end position.
    clear(buffer);
    while (!atEnd(reader))
    {
        if (!isdigit(value(reader)) && value(reader) != ',')
            return false;  // Error parsing.
        if (isdigit(value(reader)))
            appendValue(buffer, value(reader));
        goNext(reader);
    }
    if (empty(buffer))
        return false;
    if (!lexicalCast2(region.endPos, buffer))
        return false;
    if (region.endPos <= 0)
        return false;

    return atEnd(reader);
}
Exemplo n.º 3
0
void Windows::signalAndSlot()
{
    QObject::connect(ui->codeBouton, SIGNAL(clicked()), this, SLOT(openLogin()));
    QObject::connect(ui->precBouton, SIGNAL(clicked()), this, SLOT(goPrec()));
    QObject::connect(ui->suivBouton, SIGNAL(clicked()), this, SLOT(goNext()));
    QObject::connect(ui->confBouton,SIGNAL(clicked()),this,SLOT(goNext()));


}
Exemplo n.º 4
0
void MSNSearch::showEvent(QShowEvent *e)
{
    MSNSearchBase::showEvent(e);
    if (m_wizard == NULL){
        m_wizard = static_cast<QWizard*>(topLevelWidget());
        connect(this, SIGNAL(goNext()), m_wizard, SLOT(goNext()));
    }
    if (m_result == NULL){
        m_result = new MSNResult(m_wizard, m_client);
        connect(m_result, SIGNAL(search()), this, SLOT(startSearch()));
        m_wizard->addPage(m_result, i18n("MSN search results"));
    }
    textChanged("");
}
Exemplo n.º 5
0
void JabberAdd::showEvent(QShowEvent *e)
{
    JabberAddBase::showEvent(e);
    if (m_wizard == NULL){
        m_wizard = static_cast<QWizard*>(topLevelWidget());
        connect(this, SIGNAL(goNext()), m_wizard, SLOT(goNext()));
    }
    if (m_result == NULL){
        m_result = new AddResult(m_client);
        connect(m_result, SIGNAL(finished()), this, SLOT(addResultFinished()));
        connect(m_result, SIGNAL(search()), this, SLOT(startSearch()));
        m_wizard->addPage(m_result, i18n("Add Jabber contact"));
    }
    currentChanged(NULL);
}
void ManageServerDeleteOneVDTask::recvWorkItem( ThreadPoolWorkItem* pWorkItem)
{
	if(!pWorkItem)
		return ;
	SetVDInfoWorkItem *p = dynamic_cast<SetVDInfoWorkItem *>(pWorkItem);

	// ControlAgent *pAgent = dynamic_cast<ControlAgent *>(m_pAgent);
	if(p)
	{
		m_iRes = p->getRes();
		if(m_iRes != 1)	//
		{			
		    m_state = FINISHED;
		}
		if(m_pSetStatusMsg)
		{
			delete m_pSetStatusMsg;
			m_pSetStatusMsg = NULL;
		}
		
		if (pWorkItem != NULL)
	    {
	        delete pWorkItem;
	        pWorkItem = NULL;
	    }
		goNext();
	}
	else
	{
		//error
	}

	
	return;
}
Exemplo n.º 7
0
IPlayerManager::Iterator::Iterator( IPlayerManager* _mgr )
{
	mgr      = _mgr;
	numCount = (int) _mgr->getPlayerNum();
	player   = NULL;
	goNext();
}
Exemplo n.º 8
0
void ICQSearch::showEvent(QShowEvent *e)
{
    ICQSearchBase::showEvent(e);
    if (m_wizard == NULL){
        m_wizard = static_cast<QWizard*>(topLevelWidget());
        connect(this, SIGNAL(goNext()), m_wizard, SLOT(goNext()));
    }
    if (m_result == NULL){
        m_result = new ICQSearchResult(m_wizard, m_client);
        connect(m_result, SIGNAL(finished()), this, SLOT(resultFinished()));
        connect(m_result, SIGNAL(startSearch()), this, SLOT(startSearch()));
        m_wizard->addPage(m_result, i18n("ICQ search results"));
    }
    m_result->clear();
    changed();
}
Exemplo n.º 9
0
int main()
{
    // Define string and record reader types.  We will read from std::cin which
    // is of type std::istream.  We use a single-pass record reader.
    typedef seqan::RecordReader<std::istream, seqan::SinglePass<> > TRecordReader;

    int res = 0;  // Used to store I/O results.

    // Create RecordReader reading from standard input.
    TRecordReader reader(std::cin);

    // Read the file line by line.
    while (!atEnd(reader))
    {
        // Read first column: The key.
        seqan::CharString key;
        res = readUntilChar(key, reader, ',');
        if (res != 0)
            return 1;

        goNext(reader);  // Skip TAB.

        // Read second column: The value.
        seqan::CharString value;
        res = readLine(value, reader);  // EOL will not be stored in value.
        if (res != 0)
            return 1;

        // Print ${key} -> ${value}.
        std::cout << key << " -> " << value << std::endl;
    }

    return 0;
}
Exemplo n.º 10
0
void findPosition( char *str )
{
    int notFound = 1;
    for( int i = 1; i <= N && notFound; i++ )
        for( int j = 1; j <= M && notFound; j++ )
              for( int l = 0; l < 8 && notFound; l++ )
                {
                    int x = i; 
                    int y = j;
                    int count = 0;
                    while( goNext(x, y) &&  str[count] == G[x][y] )
                    {
                            
                           x = x + dx[l];
                           y = y + dy[l];
                           count++;
                           
                    }
                    if( count == strlen(str) )
                    {
                        notFound = 0;
                        printf( "%d %d\n", i, j );
                    }
                }
}
void Commentaire::signalAndSlot(){
    QObject::connect(ui->precBouton, SIGNAL(clicked()), this, SLOT(goPrec()));
    QObject::connect(ui->suivBouton,SIGNAL(clicked()),this,SLOT(goNext()));//on déclenche le thread lors du click sur le bouton pour générer les fichiers
    QObject::connect(this,SIGNAL(changeIndex(int)), this->parent(),
                     SLOT(changeIndex(int)));
    QObject::connect(this,SIGNAL(changeIndex(int)), this->parent(),
                     SLOT(changeIndex(int)));

}
Exemplo n.º 12
0
int LinkedList::getCount(string data)
{
  goToFront();
  while(current->getData().compare(data)!=0)
    {
      string temp = goNext();
    }
  return current->count;
}
Exemplo n.º 13
0
void LinkedList::addToCount(string data)
{
  goToFront();
  while(current->getData().compare(data)!=0)
    {
      string temp = goNext();
    }
  current->count++;
}
 void goNext(vector<int> &queenPos, int &currentline, const int n)
 {
     if(currentline < 0) return;
     if(queenPos[currentline] == n-1)   
     {
          currentline--;            // this line has been end, go back
          goNext(queenPos, currentline, n);
     }   
     else
         queenPos[currentline]++;
 }
Exemplo n.º 15
0
LookupPanel::LookupPanel() : QDockWidget(tr("Search"))
{
  _wordEdit = new QLineEdit(this);
  connect(_wordEdit, SIGNAL(returnPressed()), this, SLOT(editingFinished()));
  _toolBar = new QToolBar(this);
  _toolBar->setFloatable(false);
  _toolBar->setAllowedAreas(Qt::NoToolBarArea);
  _toolBar->setMovable(false);
  // remove excessive space around small buttons
  _toolBar->setStyleSheet("QToolButton{margin:0}");

  // Go Home button.
  _homeAct = new QAction(QIcon(":/images/go-home.svg"), tr("Title page"), this);
  _toolBar->addAction(_homeAct);
  connect(_homeAct, SIGNAL(triggered()), this, SLOT(goHome()));

  // Previous Entry button. Backspace added as an important
  // shortcut.
  _previousAct = new QAction(QIcon(":/images/go-previous.svg"), tr("Previous"), this);
  QList<QKeySequence> previousActShortcuts;
  previousActShortcuts.append(QKeySequence::Back);
  previousActShortcuts.append(Qt::Key_Backspace);
  _previousAct->setShortcuts(previousActShortcuts);
  connect(_previousAct, SIGNAL(triggered()), this, SLOT(goPrevious()));
  _toolBar->addAction(_previousAct);

  // Next Entry button.
  _nextAct = new QAction(QIcon(":/images/go-next.svg"), tr("Next"), this);
  _nextAct->setShortcut(QKeySequence::Forward);
  connect(_nextAct, SIGNAL(triggered()), this, SLOT(goNext()));
  _toolBar->addAction(_nextAct);

  // Update displayed entry history and register a slot catching its changes.
  historyChanged();
  connect(&_history, SIGNAL(changed()), this, SLOT(historyChanged()));

  // Vertical fixed layout without margins.
  QWidget *layoutWidget = new QWidget(this);
  QVBoxLayout *layout = new QVBoxLayout(layoutWidget);
  layout->setContentsMargins(0, 0, 0, 0);
  layout->setSpacing(0);
  layout->setSizeConstraint(QLayout::SetMaximumSize);
  layout->addWidget(_wordEdit);
  layout->addWidget(_toolBar);
  layoutWidget->setMaximumHeight(_wordEdit->height() + _toolBar->height());
  layoutWidget->setLayout(layout);
  setWidget(layoutWidget);

  // Not movable, no title bar.
  setAllowedAreas(Qt::LeftDockWidgetArea);
  setFeatures(QDockWidget::NoDockWidgetFeatures);
  setContentsMargins(0, 4, 2, 4);
  setTitleBarWidget(new QWidget(this)); // no title bar
}
  vector<vector<string> > solveNQueens(int n) 
  {
     // Start typing your C/C++ solution below
     // DO NOT write int main() function
     
     vector<int> queenPos(n, 0);
     vector<int> curPosInLines(n,0);
     int currentline = 0;
     ret.clear();
     if(n<=0) return ret;
     while(currentline >=0)
     {
         bool validQ = isValidQueen(queenPos, n, currentline);
         if(validQ)
         {
             if(currentline == n-1)
             {
                 //ret++; // record a solution
                 vector<string> solution;
                 for(int i=0; i<n; i++)
                 {
                     string s(n, '.');
                     s[queenPos[i]] = 'Q';
                     solution.push_back(s);
                 }
                 ret.push_back(solution);
                 
                 goNext(queenPos, currentline, n);
             }
             else
             {
                 queenPos[++currentline] = 0;
             }                
         }
         else
         {
             goNext(queenPos, currentline, n);
         }
     }
     return ret;
 }
Exemplo n.º 17
0
void
TestTask::recvWorkItem(ThreadPoolWorkItem *pWorkItem)
{
    if ( pWorkItem != NULL)
    {
        delete pWorkItem;
        pWorkItem = NULL;
    }

    m_state = FINISH;
    goNext();
}
Exemplo n.º 18
0
void DateNavigatorContainer::connectNavigatorView( KDateNavigator *v )
{
  connect( v, SIGNAL( datesSelected( const KCal::DateList & ) ),
           SIGNAL( datesSelected( const KCal::DateList & ) ) );
  connect( v, SIGNAL( incidenceDropped( Incidence *, const QDate & ) ),
           SIGNAL( incidenceDropped( Incidence *, const QDate & ) ) );
  connect( v, SIGNAL( incidenceDroppedMove( Incidence *, const QDate & ) ),
           SIGNAL( incidenceDroppedMove( Incidence *, const QDate & ) ) );
  connect( v, SIGNAL( weekClicked( const QDate & ) ),
           SIGNAL( weekClicked( const QDate & ) ) );

  connect( v, SIGNAL( goPrevious() ), SIGNAL( goPrevious() ) );
  connect( v, SIGNAL( goNext() ), SIGNAL( goNext() ) );

  connect( v, SIGNAL( goNextMonth() ), SIGNAL( goNextMonth() ) );
  connect( v, SIGNAL( goPrevMonth() ), SIGNAL( goPrevMonth() ) );
  connect( v, SIGNAL( goNextYear() ), SIGNAL( goNextYear() ) );
  connect( v, SIGNAL( goPrevYear() ), SIGNAL( goPrevYear() ) );

  connect( v, SIGNAL( goMonth( int ) ), SIGNAL( goMonth( int ) ) );
}
Exemplo n.º 19
0
void MsgEdit::execCommand()
{
    if (m_cmd.param == NULL)
        return;
    Message *msg = (Message*)(m_cmd.param);
    Event e(EventCommandExec, &m_cmd);
    e.process();
    delete msg;
    m_cmd.param = NULL;
    switch (m_cmd.id){
    case CmdMsgQuote:
    case CmdMsgForward:
        break;
    default:
        goNext();
    }
}
Exemplo n.º 20
0
Arquivo: main.cpp Projeto: nyhu/PCPP
static void recurse(
    std::map<char, func> &instructionHandler,
    std::vector<char> &v, std::vector<char>::iterator &it,
    std::list<char> const &instructions, std::list<char>::iterator &listIt)
{
    if (instructionHandler.count(*listIt) > 0)
        instructionHandler[*listIt](v, it);

    if ((*listIt == MO_PREV && *it != 0) || (*listIt == MO_NEXT && *it == 0))
        goNext(instructions, listIt);

    listIt++;
    if (listIt == instructions.end()) {
        std::cout << std::endl;
        return;
    }
    recurse(instructionHandler, v, it, instructions, listIt);
}
Exemplo n.º 21
0
void PhoneWidget::phoneSubmitDone(const MTPauth_SentCode &result) {
	stopCheck();
	_sentRequest = 0;

	if (result.type() != mtpc_auth_sentCode) {
		showPhoneError(&Lang::Hard::ServerError);
		return;
	}

	const auto &d = result.c_auth_sentCode();
	fillSentCodeData(d);
	getData()->phone = _sentPhone;
	getData()->phoneHash = qba(d.vphone_code_hash);
	getData()->phoneIsRegistered = d.is_phone_registered();
	if (d.has_next_type() && d.vnext_type.type() == mtpc_auth_codeTypeCall) {
		getData()->callStatus = Widget::Data::CallStatus::Waiting;
		getData()->callTimeout = d.has_timeout() ? d.vtimeout.v : 60;
	} else {
		getData()->callStatus = Widget::Data::CallStatus::Disabled;
		getData()->callTimeout = 0;
	}
	goNext(new Intro::CodeWidget(parentWidget(), getData()));
}
Exemplo n.º 22
0
int main()
{
///The metafunction @Metafunction.Iterator@ returns the iterator type for a given container type.
	seqan::String<char> str = "admn";
	seqan::Iterator<seqan::String<char> >::Type it = begin(str);
	seqan::Iterator<seqan::String<char> >::Type itEnd = end(str);
///We can use iterators to iterate over the elements of a container.
	while (it != itEnd) {
		::std::cout << *it;
		++it;
	}
	::std::cout << ::std::endl;
///Rooted iterators know their container (@Concept.RootedIteratorConcept|Rooted Iterator@).
///Hence, the functions @Function.goBegin@ and @Function.atEnd@ do
///not get $str$ as an argument.
///The following loop increments each character in $str$.
	seqan::Iterator<seqan::String<char>, seqan::Rooted >::Type it2 = begin(str);
	for (goBegin(it2); !atEnd(it2); goNext(it2)) 
	{
		++value(it2);
	}
///Some iterators support an iteration in reverse order.
///Note that @Function.goPrevious@ is called before the value of $it2$ is accessed.
///Remember that the end position of a container is always the position behind the last item in the container.
	goEnd(it2);
	while (!atBegin(it2))              
	{
		goPrevious(it2);
		::std::cout << getValue(it2);
	}
	::std::cout << ::std::endl;
///@Function.assignValue@ can be used to change the value of an iterator.
	assignValue(begin(str), 'X');
	::std::cout << str << ::std::endl;
	
	return 0;
}
Exemplo n.º 23
0
void SVImageMainWindow::SVImageMainWindowPrivate::setupActions() {
  //
  // "File"-menu
  //
  actionLoad = new QAction("&Open", mw);
  actionLoad->setIcon(QIcon(":icons/document-open.png"));
  actionLoad->setShortcut(QKeySequence::Open);
  connect(actionLoad, SIGNAL(triggered()),
          mw, SLOT(load()));

  actionReload = new QAction("&Reload", mw);
  actionReload->setIcon(QIcon(":icons/view-refresh.png"));
  actionReload->setShortcut(QKeySequence::Refresh);
  actionReload->setEnabled(false);
  connect(actionReload, SIGNAL(triggered()),
          mw, SLOT(reload()));

  actionPrint = new QAction("&Print", mw);
  actionPrint->setIcon(QIcon(":icons/document-print.png"));
  actionPrint->setShortcut(QKeySequence::Print);
  actionPrint->setEnabled(false);
  connect(actionPrint, SIGNAL(triggered()),
          mw, SLOT(print()));

  actionQuit = new QAction("&Quit", mw);
#if QT_VERSION >= 0x040600
  actionQuit->setShortcut(QKeySequence::Quit);
#else
  actionQuit->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q));
#endif
  connect(actionQuit, SIGNAL(triggered()),
          mw, SLOT(close()));

  //
  // "Plot"-menu
  //
  actionZoomFit = new QAction("Fit to Window", mw);
  actionZoomFit->setIcon(QIcon(":icons/zoom-fit-best.png"));
  actionZoomFit->setEnabled(false);
  connect(actionZoomFit, SIGNAL(triggered()),
          mw, SLOT(zoomFit()));

  actionZoom = new QAction("&Zoom", mw);
  actionZoom->setIcon(QIcon(":icons/page-zoom.png"));
  actionZoom->setCheckable(true);
  actionZoom->setEnabled(false);
  connect(actionZoom, SIGNAL(toggled(bool)),
          mw, SLOT(setZoomEnabled(bool)));

  actionMove = new QAction("&Move", mw);
  actionMove->setIcon(QIcon(":icons/input-mouse.png"));
  actionMove->setCheckable(true);
  actionMove->setChecked(false);
  actionMove->setEnabled(false);
  connect(actionMove, SIGNAL(toggled(bool)),
          mw, SLOT(setMoveEnabled(bool)));
  actionZoom->setChecked(true);

  //
  // "Go"-menu
  //
  actionGoFirst = new QAction("&First", mw);
  actionGoFirst->setShortcut(QKeySequence::MoveToStartOfLine);
  actionGoFirst->setEnabled(false);
  connect(actionGoFirst, SIGNAL(triggered()),
          mw, SLOT(goFirst()));

  actionGoPrevious = new QAction("&Previous", mw);
  actionGoPrevious->setShortcut(QKeySequence::MoveToPreviousPage);
  actionGoPrevious->setIcon(mw->style()->standardIcon(QStyle::SP_MediaSkipBackward));
  actionGoPrevious->setEnabled(false);
  connect(actionGoPrevious, SIGNAL(triggered()),
          mw, SLOT(goPrevious()));

  actionGoNext = new QAction("&Next", mw);
  actionGoNext->setShortcut(QKeySequence::MoveToNextPage);
  actionGoNext->setIcon(mw->style()->standardIcon(QStyle::SP_MediaSkipForward));
  actionGoNext->setEnabled(false);
  connect(actionGoNext, SIGNAL(triggered()),
          mw, SLOT(goNext()));

  actionGoLast = new QAction("&Last", mw);
  actionGoLast->setShortcut(QKeySequence::MoveToEndOfLine);
  actionGoLast->setEnabled(false);
  connect(actionGoLast, SIGNAL(triggered()),
          mw, SLOT(goLast()));

  actionWatchLatest = new QAction("&Watch Latest", mw);
  actionWatchLatest->setCheckable(true);
  actionWatchLatest->setChecked(false);
  actionWatchLatest->setEnabled(false);
  connect(actionWatchLatest, SIGNAL(toggled(bool)),
          mw, SLOT(setWatchLatest(bool)));

  //
  // "Tools"-menu
  //
  actionMaskNew = new QAction("&New", mw);
  actionMaskNew->setEnabled(false);
  connect(actionMaskNew, SIGNAL(triggered()),
          mw, SLOT(newMask()));

  actionMaskLoad = new QAction("&Open", mw);
  actionMaskLoad->setEnabled(false);
  connect(actionMaskLoad, SIGNAL(triggered()),
          mw, SLOT(loadMask()));

  actionMaskSaveAs = new QAction("&Save As ...", mw);
  actionMaskSaveAs->setEnabled(false);
  connect(actionMaskSaveAs, SIGNAL(triggered()),
          mw, SLOT(saveMaskAs()));

  actionMaskByThreshold = new QAction("By Threshold ...", mw);
  actionMaskByThreshold->setEnabled(false);
  connect(actionMaskByThreshold, SIGNAL(triggered()),
          mw, SLOT(setMaskByThreshold()));

  actionMaskAddPoint = new QAction("Add pixel", mw);
  actionMaskAddPoint->setCheckable(true);
  actionMaskAddPoint->setChecked(false);
  actionMaskAddPoint->setEnabled(false);
  connect(actionMaskAddPoint, SIGNAL(toggled(bool)),
          mw, SLOT(setMaskAddPointsEnabled(bool)));

  actionMaskAddPolygon = new QAction("Add polygon", mw);
  actionMaskAddPolygon->setCheckable(true);
  actionMaskAddPolygon->setChecked(false);
  actionMaskAddPolygon->setEnabled(false);
  connect(actionMaskAddPolygon, SIGNAL(toggled(bool)),
          mw, SLOT(setMaskAddPolygonEnabled(bool)));

  actionMaskRemovePoint = new QAction("Remove pixel", mw);
  actionMaskRemovePoint->setCheckable(true);
  actionMaskRemovePoint->setChecked(false);
  actionMaskRemovePoint->setEnabled(false);
  connect(actionMaskRemovePoint, SIGNAL(toggled(bool)),
          mw, SLOT(setMaskRemovePointsEnabled(bool)));

  actionMaskRemovePolygon = new QAction("Remove polygon", mw);
  actionMaskRemovePolygon->setCheckable(true);
  actionMaskRemovePolygon->setChecked(false);
  actionMaskRemovePolygon->setEnabled(false);
  connect(actionMaskRemovePolygon, SIGNAL(toggled(bool)),
          mw, SLOT(setMaskRemovePolygonEnabled(bool)));

  //
  // "Window"-menu
  //
  actionPreviousPlot = new QAction("&Previous Image", mw);
  actionPreviousPlot->setShortcut(QKeySequence::PreviousChild);
  connect(actionPreviousPlot, SIGNAL(triggered()),
          mdiArea, SLOT(activatePreviousSubWindow()));

  actionNextPlot = new QAction("&Next Image", mw);
  actionNextPlot->setShortcut(QKeySequence::NextChild);
  connect(actionNextPlot, SIGNAL(triggered()),
          mdiArea, SLOT(activateNextSubWindow()));

  actionCascadePlots = new QAction("C&ascade Images", mw);
  connect(actionCascadePlots, SIGNAL(triggered()),
          mdiArea, SLOT(cascadeSubWindows()));

  actionTilePlots =  new QAction("&Tile Images", mw);
  connect(actionTilePlots, SIGNAL(triggered()),
          mdiArea, SLOT(tileSubWindows()));

  actionClosePlot = new QAction("&Close Current Image", mw);
  actionClosePlot->setShortcut(QKeySequence::Close);
  connect(actionClosePlot, SIGNAL(triggered()),
          mdiArea, SLOT(closeActiveSubWindow()));

  actionCloseAllPlots = new QAction("Close &All Images", mw);
  connect(actionCloseAllPlots, SIGNAL(triggered()),
          mdiArea, SLOT(closeAllSubWindows()));

  //
  // "Help"-menu
  //
  actionAbout = new QAction("&About", mw);
  connect(actionAbout, SIGNAL(triggered()),
          mw, SLOT(about()));


  actionGroupPlotPicker = new QActionGroup(mw);
  actionGroupPlotPicker->addAction(actionZoom);
  actionGroupPlotPicker->addAction(actionMove);

  actionGroupPlotPicker->addAction(actionMaskAddPoint);
  actionGroupPlotPicker->addAction(actionMaskAddPolygon);
  actionGroupPlotPicker->addAction(actionMaskRemovePoint);
  actionGroupPlotPicker->addAction(actionMaskRemovePolygon);
}
Exemplo n.º 24
0
void JabberAdd::search()
{
    if ((m_wizard == NULL) || !m_wizard->nextButton()->isEnabled())
        return;
    emit goNext();
}
Exemplo n.º 25
0
BuildFontDialog::BuildFontDialog(Poppler::Document *pdf)
{

    doc = pdf;
    currentPage = 0;
    QPushButton *saveToFileButton = new QPushButton(tr("Save"));
    QPushButton *confirmButton = new QPushButton(tr("OK"));
    QPushButton *closeButton = new QPushButton(tr("Cancel"));
    connect(closeButton, SIGNAL(clicked()), this, SLOT(close()));
    connect(confirmButton, SIGNAL(clicked()), this, SLOT(testFun()));
    connect(saveToFileButton, SIGNAL(clicked()), this, SLOT(saveToFile()));

    imageLabel = new ImageLabel;
    imageLabel->setBackgroundRole(QPalette::Base);
    imageLabel->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);
    imageLabel->setScaledContents(true);
    scrollArea = new QScrollArea;
    scrollArea->setBackgroundRole(QPalette::Dark);
    scrollArea->setWidget(imageLabel);
    connect(imageLabel, SIGNAL(clicked(const QPoint & )), this, SLOT(pickLetter(const QPoint & )));
    
    QPushButton *previousButton = new QPushButton(tr("Previous"));
    QPushButton *nextButton = new QPushButton(tr("Next"));
    connect(previousButton, SIGNAL(clicked()), this, SLOT(goPrevious()));
    connect(nextButton, SIGNAL(clicked()), this, SLOT(goNext()));
    pageIndicator = new QLabel;
    QRadioButton *displayOriginal = new QRadioButton(tr("Original"));
    QRadioButton *displayBoxed = new QRadioButton(tr("Boxed"));
    isBoxedDisplay.addButton(displayOriginal);
    isBoxedDisplay.addButton(displayBoxed);
    displayOriginal->setChecked(true);
    
    selectionArbitrary = new QCheckBox();
    selectionArbitrary->setChecked(false);
    selectionArbitrary->setText("Arbitrary Rectangle");
    arbitraryLastPoint.setX(-1);
    
    connect(displayOriginal, SIGNAL(clicked()), this, SLOT(displayOriginalPage()));
    connect(displayBoxed, SIGNAL(clicked()), this, SLOT(displayBoxedPage()));

    QHBoxLayout *pageNavigationLayout = new QHBoxLayout;
    pageNavigationLayout->addStretch();
    pageNavigationLayout->addWidget(previousButton);
    pageNavigationLayout->addWidget(pageIndicator);
    pageNavigationLayout->addWidget(nextButton);
    pageNavigationLayout->addStretch();
    pageNavigationLayout->addWidget(selectionArbitrary);
    pageNavigationLayout->addStretch();
    pageNavigationLayout->addWidget(displayOriginal);
    pageNavigationLayout->addWidget(displayBoxed);
    pageNavigationLayout->addStretch();
    
    
    QHBoxLayout *lowerCases = new QHBoxLayout;
    QHBoxLayout *upperCases = new QHBoxLayout;
    buttonGroup= new QButtonGroup;
    createLetters(lowerCases, upperCases);
    connect(buttonGroup,SIGNAL(buttonClicked(QAbstractButton*)),this,SLOT(displayFontEditorFor(QAbstractButton*)));

    QVBoxLayout *lettersLayout = new QVBoxLayout;
    lettersLayout->addLayout(lowerCases);
    lettersLayout->addLayout(upperCases);
    
    QHBoxLayout *letterAdjustAndLetters = new QHBoxLayout;
    fontEditor = new NCSAFontEditor(&builtFont);
    letterAdjustAndLetters->addLayout(fontEditor);
    letterAdjustAndLetters->addLayout(lettersLayout);

    QHBoxLayout *testLayout = new QHBoxLayout;
    testInput = new QLineEdit;
    testDisplay = new QLabel;
    testLayout->addWidget(testInput);
    testLayout->addStretch();
    testLayout->addWidget(testDisplay);
    connect(testInput,SIGNAL(textChanged(QString)),this,SLOT(testInputChanged(QString)));
    
    QVBoxLayout *verticalLayout = new QVBoxLayout;
    verticalLayout->addWidget(scrollArea);
    verticalLayout->addLayout(pageNavigationLayout);
    verticalLayout->addLayout(letterAdjustAndLetters);
    verticalLayout->addLayout(testLayout);


    QHBoxLayout *buttonsLayout = new QHBoxLayout;
    buttonsLayout->addStretch(1);
    buttonsLayout->addWidget(saveToFileButton);
    buttonsLayout->addWidget(confirmButton);
    buttonsLayout->addWidget(closeButton);

    QVBoxLayout *mainLayout = new QVBoxLayout;
    mainLayout->addLayout(verticalLayout);
    //mainLayout->addStretch(1);
    //mainLayout->addSpacing(12);
    mainLayout->addLayout(buttonsLayout);
    setLayout(mainLayout);
    resize(1000, 600);
   
    setWindowTitle(tr("Font Creater"));
    
    displayPage();
}
Exemplo n.º 26
0
void WifiDialog::createLayout()
{
    // big_box_.setSizeConstraint(QLayout::SetMinimumSize);
    big_box_.setSpacing(SPACING);
    big_box_.setContentsMargins(SPACING, SPACING, SPACING, SPACING);

    // title hbox.
    big_box_.addLayout(&title_hbox_);
    title_hbox_.setContentsMargins(0, 0, 0, 0);
    title_hbox_.addWidget(&title_icon_label_, 0, Qt::AlignVCenter);
    title_hbox_.addSpacing(SPACING * 2);
    title_hbox_.addWidget(&title_text_label_, 0, Qt::AlignVCenter);
    title_hbox_.addStretch(0);
    title_hbox_.addWidget(&close_button_);
    title_icon_label_.setPixmap(QPixmap(":/images/network_connection.png"));
    title_text_label_.setAlignment(Qt::AlignVCenter);
    title_icon_label_.setFixedHeight(WIDGET_HEIGHT);
    title_text_label_.useTitleBarStyle();
    title_text_label_.setFixedHeight(WIDGET_HEIGHT);

    close_button_.setStyleSheet(BUTTON_STYLE);
    QPixmap close_pixmap(":/images/close.png");
    close_button_.setIconSize(close_pixmap.size());
    close_button_.setIcon(QIcon(close_pixmap));
    close_button_.setFocusPolicy(Qt::NoFocus);
    QObject::connect(&close_button_, SIGNAL(clicked()), this, SLOT(onCloseClicked()));

    // content layout.
    big_box_.addLayout(&content_layout_);
    content_layout_.setContentsMargins(MARGINS, MARGINS, MARGINS, MARGINS);

    // Status.
    state_widget_layout_.setContentsMargins(MARGINS, 0, MARGINS, 0);
    state_widget_layout_.addWidget(&state_widget_);
    content_layout_.addSpacing(10);
    content_layout_.addLayout(&state_widget_layout_);
    QObject::connect(&state_widget_, SIGNAL(refreshClicked()), this, SLOT(onRefreshClicked()));
    QObject::connect(&state_widget_, SIGNAL(customizedClicked()), this, SLOT(onCustomizedClicked()));
    QObject::connect(&prev_button_, SIGNAL(clicked()), &ap_view_, SLOT(goPrev()), Qt::QueuedConnection);
    QObject::connect(&next_button_, SIGNAL(clicked()), &ap_view_, SLOT(goNext()), Qt::QueuedConnection);

    // ap layout.
    ap_layout_.setContentsMargins(MARGINS, MARGINS, MARGINS, MARGINS);
    ap_layout_.setSpacing(5);
    content_layout_.addLayout(&ap_layout_);
    ap_layout_.addWidget(&ap_view_);

    QObject::connect(&ap_view_, SIGNAL(positionChanged(const int, const int)), this, SLOT(onPositionChanged(const int, const int)));
    QObject::connect(&ap_view_, SIGNAL(itemActivated(CatalogView*, ContentView*, int)), this, SLOT(onItemActivated(CatalogView*, ContentView*, int)));

    ap_view_.setPreferItemSize(QSize(-1, AP_ITEM_HEIGHT));
    ap_view_.setNeighbor(&state_widget_.dashBoard(), CatalogView::UP);
    content_layout_.addSpacing(50);

    // Buttons.
    content_layout_.addLayout(&buttons_layout_);
    buttons_layout_.setContentsMargins(MARGINS, 0, MARGINS, 0);
    prev_button_.setFocusPolicy(Qt::NoFocus);
    next_button_.setFocusPolicy(Qt::NoFocus);
    buttons_layout_.addWidget(&prev_button_);
    buttons_layout_.addStretch(0);
    buttons_layout_.addWidget(&next_button_);
    showPaginationButtons(true, true);

    // Hardware address.
    hardware_address_.setFixedHeight(WIDGET_HEIGHT);
    hardware_address_.setContentsMargins(MARGINS, 0, MARGINS, 0);
    content_layout_.addWidget(&hardware_address_);
}
Exemplo n.º 27
0
 void remCurr(void) {		// remove current entry, and move on
   if (go_node == NULL) return;
   HashNode<K_t,D_t> *curr = go_node;
   goNext();  // the next entry become the 'current'
   remove( curr->key );
 }
Exemplo n.º 28
0
void *MsgReceived::processEvent(Event *e)
{
    if (e->type() == EventCommandExec){
        CommandDef *cmd = (CommandDef*)(e->param());
        unsigned id = cmd->bar_grp;
        if (cmd->param == m_edit){
			MessageDef *mdef = NULL;
            CommandDef *msgCmd = CorePlugin::m_plugin->messageTypes.find(m_type);
            if (msgCmd)
                mdef = (MessageDef*)(msgCmd->param);
            if (mdef && mdef->cmd){
                for (const CommandDef *d = mdef->cmd; d->text; d++){
                    if (d->popup_id && (d->popup_id == cmd->menu_id)){
                        Message *msg = History::load(m_id, m_client.c_str(), m_contact);
                        if (msg){
                            CommandDef c = *cmd;
                            c.param = msg;
                            m_edit->execCommand(&c);
                        }
                        return e->param();
                    }
                }
            }

            if ((id >= MIN_INPUT_BAR_ID) && (id < MAX_INPUT_BAR_ID)){
                Message *msg = History::load(m_id, m_client.c_str(), m_contact);
                if (msg){
                    CommandDef c = *cmd;
                    c.id   -= CmdReceived;
                    c.param = msg;
                    m_edit->execCommand(&c);
                }
                return e->param();
            }
        }
    }
    if (e->type() == EventCheckState){
        CommandDef *cmd = (CommandDef*)(e->param());
        if (cmd->param == m_edit){
            unsigned id = cmd->bar_grp;
            if ((id >= 0x1000) && (id < MAX_INPUT_BAR_ID)){
                cmd->flags |= BTN_HIDE;
                switch (cmd->id - CmdReceived){
                case CmdMsgQuote:
                case CmdMsgForward:{
                        CommandDef c = *cmd;
                        Message *msg = m_msg;
                        if (msg == NULL)
                            msg = History::load(m_id, m_client.c_str(), m_contact);
                        if (msg){
                            c.id   -= CmdReceived;
                            c.param = msg;
                            Event e(EventCheckState, &c);
                            if (e.process())
                                cmd->flags &= ~BTN_HIDE;
                            if (m_msg == NULL)
                                delete msg;
                        }
                        return e->param();
                    }
                }
                MessageDef *mdef = NULL;
                    CommandDef *msgCmd = CorePlugin::m_plugin->messageTypes.find(m_type);
                    if (msgCmd)
	                    mdef = (MessageDef*)(msgCmd->param);
                if (mdef && mdef->cmd){
                    for (const CommandDef *d = mdef->cmd; d->text; d++){
                        if (d->id + CmdReceived == cmd->id){
                            if (d->flags & COMMAND_CHECK_STATE){
                                Message *msg = m_msg;
                                if (msg == NULL)
                                    msg = History::load(m_id, m_client.c_str(), m_contact);
                                if (msg){
                                    CommandDef c = *d;
                                    c.param = msg;
                                    Event e(EventCheckState, &c);
                                    if (e.process())
                                        cmd->flags &= ~BTN_HIDE;
                                    if (m_msg == NULL)
                                        delete msg;
                                }
                            }else{
                                cmd->flags &= ~BTN_HIDE;
                            }
                            return e->param();
                        }
                    }
                }
                return e->param();
            }
            if (cmd->id == CmdMsgAnswer){
                e->process(this);
                cmd->flags |= BTN_HIDE;
                if (CorePlugin::m_plugin->getContainerMode() == 0)
                    cmd->flags &= ~BTN_HIDE;
                return e->param();
            }

            if (m_bOpen){
                switch (cmd->id){
                case CmdTranslit:
                case CmdSmile:
                case CmdSend:
                case CmdSendClose:
                    e->process(this);
                    cmd->flags |= BTN_HIDE;
                    return e->param();
                case CmdNextMessage:
                    e->process(this);
                    cmd->flags |= BTN_HIDE;
                    if (CorePlugin::m_plugin->getContainerMode() == 0)
                        cmd->flags &= ~BTN_HIDE;
                    return e->param();;
                }
            }
        }
    }
    if (e->type() == EventMessageDeleted){
        Message *msg = (Message*)(e->param());
        if (msg->id() == m_id)
            QTimer::singleShot(0, m_edit, SLOT(goNext()));
    }
    return NULL;
}
Exemplo n.º 29
0
void CmCurveEx::findEdge(Point seed, CEdge &crtEdge, bool isBackWard)
{
	Point pnt = seed;

	float ornt = m_pOrnt1f.at<float>(pnt);
	if (isBackWard){
		ornt += PI_FLOAT;
		if (ornt >= PI2)
			ornt -= PI2;
	}
	else{
		crtEdge.pointNum = 1;
		m_pLabel1i.at<int>(pnt) = crtEdge.index;
	}

	int orntInd, nextInd1, nextInd2;
	while (true) { 
		/*************按照优先级寻找下一个点,方向差异较大不加入**************/
		//下一个点在DIRECTION16最佳方向上找
		orntInd = int(ornt/PI_EIGHTH + 0.5f) % 16;
		if (jumpNext(pnt, ornt, crtEdge, orntInd, isBackWard)) 
			continue;
		//下一个点在DIRECTION8最佳方向上找
		orntInd = int(ornt/PI_QUARTER + 0.5f) % 8;
		if (goNext(pnt, ornt, crtEdge, orntInd, isBackWard)) 
			continue;
		//下一个点在DIRECTION16次优方向上找
		orntInd = int(ornt/PI_EIGHTH + 0.5f) % 16;
		nextInd1 = (orntInd + 1) % 16;
		nextInd2 = (orntInd + 15) % 16;
		if (angle(DRT_ANGLE[nextInd1], ornt) < angle(DRT_ANGLE[nextInd2], ornt)) {
			if(jumpNext(pnt, ornt, crtEdge, nextInd1, isBackWard))
				continue;
			if(jumpNext(pnt, ornt, crtEdge, nextInd2, isBackWard))
				continue;
		}
		else{//下一个点在DIRECTION16另一个方向上找
			if(jumpNext(pnt, ornt, crtEdge, nextInd2, isBackWard))
				continue;
			if(jumpNext(pnt, ornt, crtEdge, nextInd1, isBackWard))
				continue;
		}
		//下一个点在DIRECTION8次优方向上找
		orntInd = int(ornt/PI_QUARTER + 0.5f) % 8;
		nextInd1 = (orntInd + 1) % 8;
		nextInd2 = (orntInd + 7) % 8;
		if (angle(DRT_ANGLE[nextInd1], ornt) < angle(DRT_ANGLE[nextInd2], ornt)) {
			if(goNext(pnt, ornt, crtEdge, nextInd1, isBackWard))
				continue;
			if(goNext(pnt, ornt, crtEdge, nextInd2, isBackWard))
				continue;
		}
		else{//下一个点在DIRECTION8另一个方向上找
			if(goNext(pnt, ornt, crtEdge, nextInd2, isBackWard))
				continue;
			if(goNext(pnt, ornt, crtEdge, nextInd1, isBackWard))
				continue;
		}


		/*************按照优先级寻找下一个点,方向差异较大也加入**************/
		//下一个点在DIRECTION16最佳方向上找
		orntInd = int(ornt/PI_EIGHTH + 0.5f) % 16;
		if (jumpNext(pnt, ornt, crtEdge, orntInd, isBackWard)) 
			continue;
		//下一个点在DIRECTION8最佳方向上找
		orntInd = int(ornt/PI_QUARTER + 0.5f) % 8;
		if (goNext(pnt, ornt, crtEdge, orntInd, isBackWard)) 
			continue;
		//下一个点在DIRECTION16次优方向上找
		orntInd = int(ornt/PI_EIGHTH + 0.5f) % 16;
		nextInd1 = (orntInd + 1) % 16;
		nextInd2 = (orntInd + 15) % 16;
		if (angle(DRT_ANGLE[nextInd1], ornt) < angle(DRT_ANGLE[nextInd2], ornt)) {
			if(jumpNext(pnt, ornt, crtEdge, nextInd1, isBackWard))
				continue;
			if(jumpNext(pnt, ornt, crtEdge, nextInd2, isBackWard))
				continue;
		}
		else{//下一个点在DIRECTION16另一个方向上找
			if(jumpNext(pnt, ornt, crtEdge, nextInd2, isBackWard))
				continue;
			if(jumpNext(pnt, ornt, crtEdge, nextInd1, isBackWard))
				continue;
		}
		//下一个点在DIRECTION8次优方向上找
		orntInd = int(ornt/PI_QUARTER + 0.5f) % 8;
		nextInd1 = (orntInd + 1) % 8;
		nextInd2 = (orntInd + 7) % 8;
		if (angle(DRT_ANGLE[nextInd1], ornt) < angle(DRT_ANGLE[nextInd2], ornt)) {
			if(goNext(pnt, ornt, crtEdge, nextInd1, isBackWard))
				continue;
			if(goNext(pnt, ornt, crtEdge, nextInd2, isBackWard))
				continue;
		}
		else{//下一个点在DIRECTION8另一个方向上找
			if(goNext(pnt, ornt, crtEdge, nextInd2, isBackWard))
				continue;
			if(goNext(pnt, ornt, crtEdge, nextInd1, isBackWard))
				continue;
		}

		break;//如果ornt附近的三个方向上都没有的话,结束寻找
	}

	if (isBackWard)
		crtEdge.start = pnt;
	else
		crtEdge.end = pnt;
}
int ManageServerDeleteOneVDTask::goNext()
{
	switch(m_state)
	{
		case DO_INIT_DB:
		{
			ManageServerDeleteVDMessage *pDeleteMsg = dynamic_cast<ManageServerDeleteVDMessage *> (m_pMsg);
			if(!pDeleteMsg)
				return -1;

			m_iVDID = pDeleteMsg->m_iVDID;

			m_pSetStatusMsg = new SetVDStatusMessage(m_iVDID, DELETE_ING); 
		    SetVDInfoWorkItem *pWI = new SetVDInfoWorkItem(m_pSetStatusMsg);
		   
		    pWI->setTaskID(getID());
		    g_pDispatcher->postRequest(pWI);

		    m_state = DO_GET_LOCATION;
		    //goNext();
		    break;
		}
		case DO_GET_LOCATION:
		{
			//get Agent* for location server.and send msg to it to get a node info where to locate the vd
			//and the msg should have a word to sign the task ID
			// cause of the heart connection, it is supporst to be a connection with every server
			// but if the connect is break? that means the heart is breaK, so i must new one connect to locateserver!!!!
			m_pAgent->SendMsgToServer(LOCATE_SERVER_NAME, new GetVDLocateNodeInfoMessage(getID(), m_iVDID));

			m_state = DO_DEL_VD;
			break;
		}
		case DO_DEL_VD:
		{
			if(!m_pMsg)
				return -1;
			GetVDLocateNodeInfoACKMessage *pMsg = dynamic_cast<GetVDLocateNodeInfoACKMessage *> (m_pMsg);
			if(!pMsg)
				return -1;

			m_pAgent->SendMsgToServer(pMsg->m_strLocateNodeName, new VirtualDiskDeleteMessage(getID(), m_iVDID));
			m_state = DO_SET_DB;

			delete m_pMsg;
			m_pMsg = NULL;

			break;
		}
		case DO_SET_DB:
		{
			if(!m_pMsg)
				return -1;
			VirtualDiskDeleteACKMessage *pMsg = dynamic_cast<VirtualDiskDeleteACKMessage *> (m_pMsg);
			if(!pMsg)
				return -1;

			m_iRes = pMsg->m_iRes;

			delete m_pMsg;
			m_pMsg = NULL;

			if(m_iRes != 0)
			{
				std::cout<<"In ManageServerDeleteOneVDTask::goNext(), delete ACK recv, but res is failed!"<<std::endl;
				m_state = FINISHED;
				goNext();
			}
			m_pSetStatusMsg = new SetVDStatusMessage(m_iVDID, DELETE_END);
			SetVDInfoWorkItem *pWI = new SetVDInfoWorkItem(m_pSetStatusMsg);
		   
		    pWI->setTaskID(getID());
		    g_pDispatcher->postRequest(pWI);

		    m_state = FINISHED;
			break;
		}
		case FINISHED:
		{
			m_pACKMsg = new ManageServerDeleteVDACKMessage(m_iVDID, m_iRes);
			m_state = DO_INIT_DB;
			(TaskManager::getInstance()->get(m_iSuperTaskID))->goNext();

			break;
		}

	}
	
    return 0;
}