Example #1
0
void
TreeviewSample::OpenSelectedProject(int selectedRow, bool copy)
{
  wxString msg;
  if (selectedRow >= 0)
  {
    const ProjectDescription& pd = m_projectView->GetProjectDescription(selectedRow);
    int      projectId    = pd.pid;
    wxString projectTitle = pd.title;

    if (copy)
    {
      projectTitle += wxString::Format(_(" (Copy of %d)"), projectId);
      projectId = InsertIntoDatabase(projectTitle);
    }
    wxMessageBox(wxString(_("The project to be opened")) + wxT(":\n") + 
      wxString::Format(wxT("%d"), projectId) + wxT(" / ") + projectTitle,
                 _("Open project"), wxOK, this );
  }
  else
  {
    msg = _("No project selected.");
    wxMessageBox(msg, _("Open project"), wxOK, this );
  }
}
Example #2
0
void
TreeviewSample::OnProjectNewClick( wxCommandEvent& event )
{
  wxUnusedVar(event);
  wxTextEntryDialog askProjectTitle(this, _("Please enter the title of the new project"), _("New Project Title"));
  int returnValue = askProjectTitle.ShowModal();
  if (returnValue == wxID_OK)
  {
    InsertIntoDatabase(askProjectTitle.GetValue());
  }
}
void Worker::run()
{
    qDebug() << "Starting Thread:" << PassFile << " Database: " << DB_File;
    QString line;

    QFile file(PassFile);
    if(!file.exists())
    {
       qDebug() <<"Error Accessing file.";
        return;
    }
    if(!file.open(QIODevice::ReadOnly)) {
        qDebug() <<"Error Accessing file.";
        return;
    }

    QTextStream input(&file);
    while(!input.atEnd())
    {
        line = input.readLine();

        mutex.lock();

        msleep(1*Speed);
       // qDebug() << "Speed is: " << Speed;
       // mutex.unlock();
        if(this->Stop == true)
        {
            qDebug() <<"[!]Thread Canceled";
            mutex.unlock();
            break;
        }
        if(this->Pause == true)
        {
            qDebug() <<"[!]Thread Paused.";
           m_waiter.wait(&mutex);

        }
        mutex.unlock();
        InsertIntoDatabase(line);
        emit UpdateMainGUI(line);
    }
    qDebug() <<"End of Word List file!";

}