void WIZARD_3DSHAPE_LIBS_DOWNLOADER::OnUnselectAll3Dlibs( wxCommandEvent& aEvent )
{
    for( unsigned int i = 0; i < m_checkList3Dlibnames->GetCount(); ++i )
        m_checkList3Dlibnames->Check( i, false );

    enableNext( false );
}
void WIZARD_FPLIB_TABLE::OnUnselectAllGH( wxCommandEvent& aEvent )
{
    for( unsigned int i = 0; i < m_checkListGH->GetCount(); ++i )
        m_checkListGH->Check( i, false );

    enableNext( false );
}
Ejemplo n.º 3
0
void EditCardPage::checkNext()
{

    bool Ok = true;
    {
        Ok &= !docName_lineEd->text().isEmpty();
        Ok &= !executor_lineEd->text().isEmpty();

        if (pressman_lineEd->text().isEmpty()) {
            pressman_lineEd->setText(executor_lineEd->text());
            Ok &= pressman_lineEd->isModified();
        }

        if (secretCBox->currentIndex() == -1) {
            Ok &= false;
        }

        if (templatesCBox->currentIndex() == -1) {
            Ok &= false;
        }

        Ok &= !mbNumberLineEd->text().isEmpty();
        Ok &= !pagesCountLineEd->text().isEmpty();
        Ok &= !invNumber_lineEd->text().isEmpty();
        Ok &= !telephone_lineEd->text().isEmpty();
        Ok &= !dateField_dateEd->text().isEmpty();
        /// @todo Дописать проверку на поля отправителей. Проверку по БД

    }
    if (Ok) {
        emit enableNext();
        this->setCardValid(Ok);
    }

}
void WIZARD_3DSHAPE_LIBS_DOWNLOADER::OnSelectAll3Dlibs( wxCommandEvent& aEvent )
{
    for( unsigned int i = 0; i < m_checkList3Dlibnames->GetCount(); ++i )
        m_checkList3Dlibnames->Check( i, true );

    // The list might be empty, e.g. in case of download error
    wxArrayInt dummy;
    enableNext( m_checkList3Dlibnames->GetCheckedItems( dummy ) > 0 );
}
void WIZARD_FPLIB_TABLE::OnSelectAllGH( wxCommandEvent& aEvent )
{
    for( unsigned int i = 0; i < m_checkListGH->GetCount(); ++i )
        m_checkListGH->Check( i, true );

    // The list might be empty, e.g. in case of download error
    wxArrayInt dummy;
    enableNext( m_checkListGH->GetCheckedItems( dummy ) > 0 );
}
void WIZARD_FPLIB_TABLE::setupFileSelect()
{
    // Disable the button until something is selected
    enableNext( checkFiles() );

    // Clear the review list so it will be reloaded
    m_libraries.clear();
    m_listCtrlReview->DeleteAllItems();
}
void WIZARD_3DSHAPE_LIBS_DOWNLOADER::OnPageChanged( wxWizardEvent& aEvent )
{
    SetBitmap( KiBitmap( wizard_add_fplib_icon_xpm ) );
    enableNext( true );

    if( GetCurrentPage() == m_githubListDlg )
        setupGithubList();
    else if( GetCurrentPage() == m_reviewDlg )
        setupReview();
}
Ejemplo n.º 8
0
void WizardButtons::reset() {
	enableNext(true);
	enablePrevious(true);
	showFinish(false);
	showAbort(false);
	showNavigation(true);

	wxString label(wxGetApp().GetAppName());
	if (_configuration.selectedTool)
		label << wxT(" - ") << _configuration.selectedTool->getName();
	setLineLabel(label);
}
void WIZARD_FPLIB_TABLE::OnPageChanged( wxWizardEvent& aEvent )
{
    SetBitmap( KiBitmap( wizard_add_fplib_icon_xpm ) );
    enableNext( true );

#ifdef BUILD_GITHUB_PLUGIN
    if( GetCurrentPage() == m_githubListDlg )
        setupGithubList();
    else
#endif
        if( GetCurrentPage() == m_fileSelectDlg )
            setupFileSelect();
        else if( GetCurrentPage() == m_reviewDlg )
            setupReview();
}
void WIZARD_3DSHAPE_LIBS_DOWNLOADER::setupGithubList()
{
    // Enable 'Next' only if there is at least one library selected
    wxArrayInt checkedIndices;
    m_checkList3Dlibnames->GetCheckedItems( checkedIndices );
    enableNext( checkedIndices.GetCount() > 0 );

    // Update only if necessary
    if( m_githubLibs.GetCount() == 0 )
        getLibsListGithub( m_githubLibs );

    m_searchCtrl3Dlibs->Clear();

    // Clear the review list so it will be reloaded
    m_libraries.clear();
}
void WIZARD_FPLIB_TABLE::OnSelectFiles( wxCommandEvent& aEvent )
{
    int filterIdx = m_filePicker->GetFilterIndex();

    if( m_selectedFilter != filterIdx )
    {
        m_selectedFilter = filterIdx;

        // Process the event again, as in the first iteration we cannot get the list of selected items
        wxCommandEvent ev( wxEVT_DIRCTRL_SELECTIONCHANGED );
        AddPendingEvent( ev );
        return;
    }

    enableNext( checkFiles() );
}
void WIZARD_FPLIB_TABLE::setupGithubList()
{
    // Enable 'Next' only if there is at least one library selected
    wxArrayInt checkedIndices;
    m_checkListGH->GetCheckedItems( checkedIndices );
    enableNext( checkedIndices.GetCount() > 0 );

    // Update only if necessary
    if( m_githubLibs.GetCount() == 0 )
        getLibsListGithub( m_githubLibs );

    m_searchCtrlGH->Clear();

    // Clear the review list so it will be reloaded
    m_libraries.clear();
    m_listCtrlReview->DeleteAllItems();
}
void WIZARD_FPLIB_TABLE::updateGithubControls()
{
#ifndef BUILD_GITHUB_PLUGIN
    m_radioAddGithub->Enable( false );
#endif

    // Disable inputs that have no meaning for the selected source
    bool githubEnabled = ( GetLibSource() == GITHUB );
    m_textCtrlGithubURL->Enable( githubEnabled );
    m_downloadGithub->Enable( githubEnabled );
    m_downloadDir->Enable( githubEnabled && wantLocalCopy() );
    m_btnBrowse->Enable( githubEnabled && wantLocalCopy() );

    bool valid = !( githubEnabled && wantLocalCopy() ) || wxFileName::IsDirWritable( getDownloadDir() );

    // Do not allow to go further unless there is a valid directory selected
    m_invalidDir->Show( !valid );
    enableNext( valid );
}
void WIZARD_3DSHAPE_LIBS_DOWNLOADER::updateGithubControls()
{
    bool valid = wxFileName::IsDirWritable( getDownloadDir() );

    // Shows or not the warning text if the target 3d folder does not exist, or is not
    // writable.
    m_invalidDirWarningText->Show( !valid );
    m_bitmapDirWarn->Show( !valid );

    // If the dialog starts with m_invalidDirWarningText and m_bitmapDirWarn not shown
    // the size and position of the sizer containing these widgets can be incorrect,
    // until a wxSizeEvent is fired, and the widgets are not shown, or truncated,
    // at least on Windows. So fire a dummy wxSizeEvent if the size looks bad
    if( m_invalidDirWarningText->IsShown() && m_invalidDirWarningText->GetSize().x < 2 )
    {
        wxSizeEvent event( GetSize() );
        wxPostEvent( this, event );
    }

    // Allow to go further only if there is a valid target directory selected
    enableNext( valid );
}
void FDInitDatabase::createDatabase()
{
	KLDM->setHostName(m_server->text());
	KLDM->setDatabaseName("template1");
	KLDM->setUserName(m_login->text());
	KLDM->setPassword(m_passwd->text());
	if ( KLDM->open() )
	{
		if ( ! checkAccount() )
		{
			KMessageBox::error(this, i18n("Your account is invalid, you need a user which can create users and databases"));
			return;
		}
		
		QSqlQuery q;
		
		q = KLDM->exec("CREATE DATABASE "+m_dbname->text());
		if ( ! q.isActive() )
		{
			int opt = KMessageBox::questionYesNo(this, i18n("I can't create %1\n The error was %2\ntry remove it?").arg(m_dbname->text()).arg((KLDM->lastError()).text()), i18n("Error"));
			
			switch( opt )
			{
				case KMessageBox::Yes:
				{
					KLDM->dropTables();
					KLDM->exec("DROP DATABASE "+m_dbname->text());
					KLDM->exec("CREATE DATABASE "+m_dbname->text()); 
					KLDM->dropTables();
				}
				break;
				case KMessageBox::No:
				{
					m_createButton->setEnabled(false);
					KLDM->setDatabaseName(m_dbname->text());
					emit gotoFinish();
					return;
				}
				break;
			}
		}
		
		KLDM->setDatabaseName(m_dbname->text());
		
		KLDM->close();
	
		if ( ! KLDM->open() )
		{
			qDebug("I can't open database: "+m_dbname->text());
		}
		
		m_pbar->setTotalSteps(7);
		connect(KLDM, SIGNAL(progress(int)), m_pbar, SLOT(setProgress(int)));
		
		if ( ! KLDM->createTables() )
		{
			KMessageBox::error(this, i18n("I can't create (all) tables in database %1").arg(KLDM->databaseName()), i18n("Error"));
			//KLDM->dropTables();
		}
		else
		{
			KMessageBox::information(this, i18n("The database %1 was create succesfully!\n").arg(KLDM->databaseName())+	i18n("You can continue to next step"));
			m_createButton->setEnabled(false);
			emit enableNext(this, true);
		}
	}
	else
	{
		KMessageBox::error(this, i18n("I can't open the database!\n"
				"The error was %1").arg((KLDM->lastError()).text())  , i18n("Error"));
	}
	
// 	if ( KLDM->isOpen())
// 		KLDM->close();
}
Ejemplo n.º 16
0
	void PlayListWidget::clearPlayList()
	{
		play_list->clear();
		enableNext(false);
		fileSelected(MediaFileRef());
	}
void WIZARD_FPLIB_TABLE::setupReview()
{
    wxBeginBusyCursor();
    updateLibraries();

    int libTotalCount = m_libraries.size();
    int libCount = 0;
    bool validate = true;
    wxProgressDialog progressDlg( _( "Please wait..." ), _( "Validating libraries" ),
                                  libTotalCount, this,
                                  wxPD_APP_MODAL | wxPD_CAN_ABORT | wxPD_AUTO_HIDE );

    m_dvLibName->SetWidth( 280 );

    // Prepare the review list
    m_listCtrlReview->DeleteAllItems();

    for( std::vector<LIBRARY>::iterator it = m_libraries.begin(); it != m_libraries.end(); ++it )
    {
        wxVector<wxVariant> row;
        LIBRARY::STATUS status = it->GetStatus();

        // Check if the library contents is valid
        if( status == LIBRARY::NOT_CHECKED && validate )
        {
            it->Test();
            status = it->GetStatus();
        }

        row.push_back( wxVariant( it->GetDescription() ) );

        switch( it->GetStatus() )
        {
        case LIBRARY::NOT_CHECKED:
            row.push_back( wxVariant( _( "NOT CHECKED" ) ) );
            break;

        case LIBRARY::OK:
            row.push_back( wxVariant( _( "OK" ) ) );
            break;

        case LIBRARY::INVALID:
            row.push_back( wxVariant( _( "INVALID" ) ) );
            break;
        }

        row.push_back( wxVariant( it->GetPluginName() ) );

        m_listCtrlReview->AppendItem( row );

        ++libCount;
        if( !progressDlg.Update( libCount, wxString::Format( _( "Validating libraries %d/%d" ),
                                 libCount, libTotalCount ) ) )
            validate = false;
    }

    // The list should never be empty, but who knows?
    enableNext( m_listCtrlReview->GetItemCount() > 0 );

    wxEndBusyCursor();
}
void WIZARD_3DSHAPE_LIBS_DOWNLOADER::OnCheckGithubList( wxCommandEvent& aEvent )
{
    wxArrayInt dummy;

    enableNext( m_checkList3Dlibnames->GetCheckedItems( dummy ) > 0 );
}
void WIZARD_FPLIB_TABLE::OnCheckGithubList( wxCommandEvent& aEvent )
{
    wxArrayInt dummy;

    enableNext( m_checkListGH->GetCheckedItems( dummy ) > 0 );
}