コード例 #1
0
void ConfigurationDialog::OnBoatFilename( wxCommandEvent& event )
{
    wxFileDialog openDialog
        ( this, _( "Select Boat File" ), wxFileName(m_tBoat->GetValue()).GetPath(), wxT ( "" ),
          wxT ( "xml (*.xml)|*.XML;*.xml|All files (*.*)|*.*" ), wxFD_OPEN  );

    if( openDialog.ShowModal() == wxID_OK ) {
        m_tBoat->SetValue(openDialog.GetPath());
        Update();
    }
}
コード例 #2
0
ファイル: controls.cpp プロジェクト: Zefling/flacon
ProgramEdit::ProgramEdit(const QString &programName, QWidget *parent):
    QLineEdit(parent),
    mProgramName(programName)
{
    mBtn = new QToolButton(this);
    mBtn->setText("...");
    mBtn->setIcon(Project::getIcon("document-open-folder", "document-open", "folder_open", ":/icons/16/program-edit-btn"));
    mBtn->setStyleSheet("QToolButton { border: none; padding: 0px; }");
    mBtn->setCursor(Qt::ArrowCursor);

    connect(mBtn, SIGNAL(clicked()), this, SLOT(openDialog()));
}
コード例 #3
0
void QCrmlGenerator::openFile() {
    if (safeToClear()) {
        QFileDialog openDialog(this, tr("Open"), QString(), tr("QCrml (*.qcrml);;Any Files(*)"));
        openDialog.setFileMode(QFileDialog::ExistingFile);
        openDialog.setAcceptMode(QFileDialog::AcceptOpen);
        if (openDialog.exec() == QDialog::Accepted) {
            if (openDialog.selectedFiles().count() > 0) {
                m_saveFile = openDialog.selectedFiles().at(0);
                m_editorWidget->open(m_saveFile);
            }
        }
    }
}
コード例 #4
0
void TestWidget::init()
{
    static int handler = 0;
    handler++;
    QList<int> c;
    c << handler+12;
    GET_AM();
    QAction *m_openAction = new QAction(QIcon("Constants::ICON_OPENFILE_2"), tr("&Open dialog"), this);
    tkCommand *cmd = am->registerAction(m_openAction, "Constants::OPEN_DIALOG", c);
    cmd->setDefaultKeySequence(QKeySequence::Open);
    am->actionContainer(tkConstants::M_FILE)->addAction(cmd, "Constants::G_FILE_OPEN");
    connect(m_openAction, SIGNAL(triggered()), this, SLOT(openDialog()));

    // Surcharger une action d'un menu == créer une nouvelle action et lui donner le même ID, context différent
    QAction *m_newAction = new QAction(QIcon("Constants::ICON_NEWFILE"), tr("&New..."), this);
    am->registerAction(m_newAction, "tkConstants::NEW", c);
    // Connecter l'action crée
    connect(m_newAction,SIGNAL(triggered()), this, SLOT(openDialog()));

    GET_CM();
    cm->addContextObject(new TestWidgetContext(this,c));
}
コード例 #5
0
ファイル: testApp.cpp プロジェクト: atduskgreg/Brat-Pack
void testApp::openFolderDialog()
{
    dialogSettings s;
    s.canChooseFolders = true;
    s.canChooseFiles = false;
    s.allowMultipleSelection = false;
    files = openDialog(s);

    if(files.size() > 0)
    {
        generateProject();
    }
}
コード例 #6
0
ファイル: icondialog.cpp プロジェクト: KDE/plasma-framework
QString IconDialog::openDialog()
{
    auto dialog = d->dialog.instance();

    dialog->setup(KIconLoader::Desktop);
    dialog->setProperty("DoNotCloseController", true);

    KWindowSystem::setOnAllDesktops(dialog->winId(), true);

    dialog->showDialog();
    KWindowSystem::forceActiveWindow(dialog->winId());

    return dialog->openDialog();
}
コード例 #7
0
void frmNapiProjektUpload::selectDirectory()
{
    QString dir = QFileInfo(ui.leSelectDirectory->text()).path();
    dir = QDir().exists(dir) ? dir : GlobalConfig().previousDialogPath();

    QNapiOpenDialog openDialog(this, tr("Wskaż katalog do skanowania"),
                                dir, QNapiOpenDialog::None);

    if(openDialog.selectDirectory())
        dir = openDialog.selectedFiles().first();

    if(!dir.isEmpty() && QDir().exists(dir))
        ui.leSelectDirectory->setText(dir);
}
コード例 #8
0
ファイル: spectra.cpp プロジェクト: Schamnad/avogadrolibs
Spectra::Spectra(QObject *p) :
  ExtensionPlugin(p),
  m_molecule(NULL),
  m_dialog(NULL),
  m_timer(NULL),
  m_mode(0),
  m_amplitude(20)
{
  QAction *action = new QAction(this);
  action->setEnabled(false);
  action->setText(tr("Vibrational modes..."));
  connect(action, SIGNAL(triggered()), SLOT(openDialog()));
  m_actions.push_back(action);
}
コード例 #9
0
ファイル: mainwindow.cpp プロジェクト: nsuchy/vuln-scanner
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow) 
{

    ui->setupUi(this);

    setWindowFlags(Qt::Window | Qt::WindowTitleHint |
                   Qt::MSWindowsFixedSizeDialogHint |
                   Qt::WindowCloseButtonHint);


    QString path = QCoreApplication::applicationDirPath() + "/";

    QFile ini(path+"settings.ini");

   if(!ini.exists())
   {
    QMessageBox::StandardButton resposta = QMessageBox::information(this,"Settings","The web panel settings file does not exist, Should I set it up now?",
                              QMessageBox::Yes|QMessageBox::No); // This is some code related to usage of the PHP Based Web Panel. I don't plan on using or editing this yet.
     if (resposta == QMessageBox::Yes) {
        openDialog();
      }
   }



    createMenus();

    //SQLi tab
    ui->lineEdit_5->setEnabled(false);
    ui->progressBar->setValue(0);


    //xss tab
    //ui->webView->setHtml("<html>Isto é uma página em HTML<br>Teste de XSS</html>");


    ui->tableWidget->setColumnCount(5);

    QStringList header;
    header <<"Port"<<"Service"<<"Software"<<"Version"<<"Vuln";
    ui->tableWidget->setHorizontalHeaderLabels(header);
    ui->tableWidget->verticalHeader()->setVisible(false);
    ui->tableWidget->setShowGrid(false);
    ui->tableWidget->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    //ui->tableWidget->resizeColumnsToContents();
    ui->tableWidget->resizeRowsToContents();

}
コード例 #10
0
ファイル: BExtractorDoc.cpp プロジェクト: kamalsirsa/vtp
//
// TIF stuff
//
void BExtractorDoc::OnImportimage()
{
	CFileDialog openDialog(TRUE, "tif", NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,
		"Image Files (*.bmp, *.tif, *.jpg)|*.bmp;*.tif;*.jpg||");

	if (openDialog.DoModal() != IDOK)
		return;

	CString str = openDialog.GetPathName();
	const char *szPathName = str;

	if (m_pImage) delete m_pImage;

	OnImportimage2(szPathName);
}
コード例 #11
0
wxString ControlPanel::openFileDialog(const wxString& prompt, const wxString& wildcard) {
    wxString path = wxEmptyString;

    wxFileDialog openDialog(this, prompt, wxGetCwd(), "", wildcard, wxFD_OPEN | wxFD_FILE_MUST_EXIST);
    if (openDialog.ShowModal() != wxID_CANCEL) {
        wxFileInputStream playfile_stream(openDialog.GetPath());
        if (playfile_stream.IsOk()) {
            path = openDialog.GetPath();
        } else {
            wxLogError("Selected file could not be opened.");
        }
    }

    return path;
}
コード例 #12
0
ファイル: frmcorrect.cpp プロジェクト: zadziora/qnapi
void frmCorrect::selectSubtitles()
{
    QString fileName;
    QNapiOpenDialog openDialog(this, tr("Wskaż plik z napisami"),
                                GlobalConfig().previousDialogPath(), QNapiOpenDialog::Subtitles);

    if(openDialog.selectFile())
    {
        fileName = openDialog.selectedFiles().first();
        GlobalConfig().setPreviousDialogPath(openDialog.directory().path());
    }

    if(!fileName.isEmpty() && QFile::exists(fileName))
        ui.leSubtitlesSelect->setText(fileName);
}
コード例 #13
0
ファイル: mainwindow.cpp プロジェクト: nsuchy/vuln-scanner
void MainWindow::createMenus()
 {

    // configMenu = menuBar()->addMenu(tr("&Config"));
     //exitMenu = menuBar()->addMenu(tr("Sair"));

    QAction *configAction = new QAction( tr("&Config"), this );
    QAction *exitAction = new QAction( tr("&Sair"), this );

    connect( configAction, SIGNAL(triggered()), SLOT(openDialog()) );
    connect( exitAction, SIGNAL(triggered()), qApp, SLOT(closeAllWindows()) );

    ui->menuBar->addAction( configAction );
    ui->menuBar->addAction( exitAction );

}
コード例 #14
0
ファイル: consumer.cpp プロジェクト: vleo/vleo-notebook
void Consumer::startReceiving(bool on){

    if(on){
        inStream.setVersion(QDataStream::Qt_4_6);
        m_destination = new QFile(".\\data\\destination.dat");
        m_destination->open(QIODevice::WriteOnly);
        inStream.setDevice(m_destination);
		emit openDialog();
        emit initiate(on);
    }
    else{
		inStream.device()->seek(0);
        m_destination->close();
		emit closeDialog();
    }
}
コード例 #15
0
ファイル: mainframe.cpp プロジェクト: scanknipper/scanknipper
void MainFrame::OnOpenFile( wxCommandEvent& event )
{
	wxFileDialog openDialog(this, wxT("Open images(s)"), wxEmptyString, wxEmptyString, wxT("Image Files|*.jpg;*.jpeg;*.JPG;*.JPEG;*.png;*.PNG;*.BMP;*.bmp|All Files|*.*"), wxFD_OPEN | wxFD_MULTIPLE);

	if (openDialog.ShowModal() == wxID_CANCEL)
	{
		return;
	}

	wxArrayString files;

	openDialog.GetPaths(files);

	wxGetApp().SetFilenames(files);


}
コード例 #16
0
ファイル: viewer.cpp プロジェクト: poppeman/Pictus
	void Viewer::OpenFolder() {
		FilterString s(m_codecs);
		wxFileDialog openDialog(
			this,
			Win::GetStringWx(SIDOpen),
			wxEmptyString,
			wxEmptyString,
			wxString::FromUTF8(s.GetFilterString().c_str()),
			wxFD_DEFAULT_STYLE,
			wxDefaultPosition,
			wxDefaultSize,
			wxFileDialogNameStr);

		if (openDialog.ShowModal() != wxID_CANCEL)
		{
			SetImageLocation(ToAString(openDialog.GetPath()));
		}
	}
コード例 #17
0
ファイル: DataImportDlg.cpp プロジェクト: kanbang/TIDS
void DataImportDlg::OnBnClickedDataImpotObjectListBtn()
{
    CFileDialog  openDialog(
        TRUE,
        _T( "txt" ),
        NULL, OFN_HIDEREADONLY | OFN_FILEMUSTEXIST,
        _T( "txt文件(*.txt)|*.txt||" ) );

    if( IDOK == openDialog.DoModal() )
    {
        CString filePath = openDialog.GetPathName();
        GetDlgItem( IDC_DATA_INPUT_OBJECT_LIST )->SetWindowText( filePath );

        enableControl( IDC_DATA_IMPORT_INT_LIST_BTN,  _T( "请等待" ), false );
        DataInitHelper::InitDataObjectList( filePath );
        enableControl( IDC_DATA_IMPORT_INT_LIST_BTN,  _T( "导入" ), true );
        MessageBox( _T( "导入完毕!" ) );
    }
}
コード例 #18
0
EditorWindow::EditorWindow() : QMainWindow(), newmap(this), editgroup(this)
{
	ui.setupUi(this);

	// Set up input
	QObject::connect(ui.ActionNew, SIGNAL(activated()), &newmap, SLOT(exec()));
	QObject::connect(ui.ActionOpen, SIGNAL(activated()), this, SLOT(openDialog()));
	QObject::connect(ui.ActionSave, SIGNAL(activated()), this, SLOT(save()));
	QObject::connect(ui.ActionSaveAs, SIGNAL(activated()), this, SLOT(saveAs()));
	QObject::connect(ui.ActionCompile, SIGNAL(activated()), this, SLOT(compile()));
	QObject::connect(ui.ActionAbout, SIGNAL(activated()), this, SLOT(about()));
	QObject::connect(&newmap, SIGNAL(accepted()), this, SLOT(newMap()));
	QObject::connect(&openmap, SIGNAL(accepted()), this, SLOT(open()));
	QObject::connect(ui.ActionGrid, SIGNAL(toggled(bool)), ui.levelview, SLOT(showGrid(bool)));
	ui.ActionGrid->setChecked(true);
	QObject::connect(ui.ActionMiniMap, SIGNAL(toggled(bool)), ui.levelview, SLOT(showMiniMap(bool)));
	ui.ActionMiniMap->setChecked(true);
	QObject::connect(ui.resize, SIGNAL(clicked()), this, SLOT(resize()));
	QObject::connect(ui.tilelist, SIGNAL(clicked(QModelIndex)), this, SLOT(selectTile(QModelIndex)));
	QObject::connect(ui.entitylist, SIGNAL(clicked(QModelIndex)), this, SLOT(selectEntity(QModelIndex)));
	QObject::connect(ui.toolbox, SIGNAL(currentChanged(int)), this, SLOT(selectPanel(int)));
	// Create edit input group
	editgroup.addAction(ui.ActionDraw);
	editgroup.addAction(ui.ActionErase);
	editgroup.addAction(ui.ActionSelect);
	editgroup.setExclusive(true);
	ui.ActionSelect->setChecked(true);
	QObject::connect(&editgroup, SIGNAL(triggered(QAction*)), this, SLOT(setAction(QAction*)));
	// Fill tile list
	std::vector<std::string> tilenames = TileSet::getTiles();
	for (unsigned int i = 0; i < tilenames.size(); i++)
	{
		tilelist.appendRow(new QStandardItem(tilenames[i].c_str()));
	}
	ui.tilelist->setModel(&tilelist);
	// Fill entity list
	std::vector<std::string> entitynames = Game::get().getEntities();
	for (unsigned int i = 0; i < entitynames.size(); i++)
	{
		entitylist.appendRow(new QStandardItem(entitynames[i].c_str()));
	}
	ui.entitylist->setModel(&entitylist);
}
コード例 #19
0
void CSaveMovieDialog::OnButtonInsert()
{
	static char szFilter[] = "PNG File (*.png)|*.png|BMP File (*.bmp)|*.bmp|JPG File (*.jpg)|*.jpg|DIB File (*.dib)|*.dib|All Files (*.*)|*.*||";
	CFileDialog openDialog(TRUE, "png", NULL, OFN_ALLOWMULTISELECT| OFN_HIDEREADONLY , szFilter , this);

	if ( openDialog.DoModal() == IDOK )
	{
		CListBox * pListBox = (CListBox *)GetDlgItem(IDC_LIST_BITMAP_FILENAME);

		POSITION pos = openDialog.GetStartPosition();
		while(pos != NULL)
		{
			CString name = openDialog.GetNextPathName(pos);
			POSITION pos = openDialog.GetStartPosition();

			pListBox->AddString(name);
		}
	}
}
コード例 #20
0
ファイル: BaseFilter.cpp プロジェクト: eimix/trunk
int BaseFilter::performAction()
{
    //check if selected entities are good
    int check_result = checkSelected();
    if (check_result != 1)
    {
        throwError(check_result);
        return check_result;
    }

    //if dialog is needed open the dialog
	int dialog_result = openDialog();
	if (dialog_result < 1)
	{
		if (dialog_result<0)
        throwError(dialog_result);
		else
			dialog_result = 1; //the operation is canceled by the user, no need to throw an error!
		return dialog_result;
	}

    //get the parameters from the dialog
    getParametersFromDialog();

    //are the given parameters ok?
    int par_status = checkParameters();
    if (par_status != 1)
    {
        throwError(par_status);
        return par_status;
    }

    //if so go ahead with start()
    int start_status = start();
    if (start_status != 1)
    {
        throwError(start_status);
        return start_status;
    }

	return 1;
}
コード例 #21
0
ファイル: frmcorrect.cpp プロジェクト: zadziora/qnapi
void frmCorrect::selectMovie()
{
    QString fileName;
    QNapiOpenDialog openDialog(this, tr("Wskaż plik z filmem"),
                                GlobalConfig().previousDialogPath(), QNapiOpenDialog::Movies);

    if(openDialog.selectFile())
    {
        fileName = openDialog.selectedFiles().first();
        GlobalConfig().setPreviousDialogPath(openDialog.directory().path());
    }

    if(!fileName.isEmpty() && QFile::exists(fileName))
        ui.leMovieSelect->setText(fileName);

    QFileInfo fi(fileName);
    QString propSubtitleFile = fi.path() + "/" + fi.completeBaseName() + ".txt";

    if(QFile::exists(propSubtitleFile))
        ui.leSubtitlesSelect->setText(propSubtitleFile);
}
コード例 #22
0
ファイル: BExtractorDoc.cpp プロジェクト: kamalsirsa/vtp
void BExtractorDoc::OnRmfOpen()
{
	CFileDialog openDialog(TRUE, "rmf", NULL,
		OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, "RMF Files (*.rmf)|*.rmf||");

	if (openDialog.DoModal() != IDOK)
		return;

	CString str = openDialog.GetPathName();
	const char *szPathName = str;

	if (!m_Links.ReadRMF(szPathName, true, true, true))
	{
		string str = "Problem reading file: ";
		AfxMessageBox(str.c_str());
	}
	else
	{
		m_roadFileName = szPathName;
		GetView()->Invalidate();
	}
}
コード例 #23
0
ファイル: mp3taggerDlg.cpp プロジェクト: przemeklal/mp3tagger
void Cmp3taggerDlg::OnOpen()
{
	this->UpdateData();

	LPCTSTR filter = L"MPEG-1/2 Audio Layer 3 (*.mp3)|*.mp3|Windows Media Audio (*.wma)|*.wma|MPEG-4 (*.mp4)|*.mp4|MPEG-4 Audio Layer (*.m4a)|*.m4a|Wszystkie pliki (*.*)|*.*||";

	CFileDialog openDialog(TRUE, L".mp3", NULL, OFN_ALLOWMULTISELECT, filter, this);

	if (openDialog.DoModal() == IDOK)
	{

		CString path = openDialog.GetPathName();

		CString ext = openDialog.GetFileExt();

		theApp.openFile(path, ext);

		fillList(path);
	}
	else return;

	this->UpdateData(FALSE);

}
コード例 #24
0
void DialogsProvider::openCaptureDialog()
{
    openDialog( OPEN_CAPTURE_TAB );
}
コード例 #25
0
void DialogsProvider::openNetDialog()
{
    openDialog( OPEN_NETWORK_TAB );
}
コード例 #26
0
void DialogsProvider::openDiscDialog()
{
    openDialog( OPEN_DISC_TAB );
}
コード例 #27
0
void DialogsProvider::openFileDialog()
{
    openDialog( OPEN_FILE_TAB );
}
コード例 #28
0
void DialogsProvider::customEvent( QEvent *event )
{
    if( event->type() == DialogEvent::DialogEvent_Type )
    {
        DialogEvent *de = static_cast<DialogEvent*>(event);
        switch( de->i_dialog )
        {
        case INTF_DIALOG_FILE_SIMPLE:
        case INTF_DIALOG_FILE:
            openDialog(); break;
        case INTF_DIALOG_FILE_GENERIC:
            openFileGenericDialog( de->p_arg ); break;
        case INTF_DIALOG_DISC:
            openDiscDialog(); break;
        case INTF_DIALOG_NET:
            openNetDialog(); break;
        case INTF_DIALOG_SAT:
        case INTF_DIALOG_CAPTURE:
            openCaptureDialog(); break;
        case INTF_DIALOG_DIRECTORY:
            PLAppendDir(); break;
        case INTF_DIALOG_PLAYLIST:
            playlistDialog(); break;
        case INTF_DIALOG_MESSAGES:
            messagesDialog(); break;
        case INTF_DIALOG_FILEINFO:
           mediaInfoDialog(); break;
        case INTF_DIALOG_PREFS:
           prefsDialog(); break;
        case INTF_DIALOG_BOOKMARKS:
           bookmarksDialog(); break;
        case INTF_DIALOG_EXTENDED:
           extendedDialog(); break;
        case INTF_DIALOG_SENDKEY:
           sendKey( de->i_arg ); break;
#ifdef ENABLE_VLM
        case INTF_DIALOG_VLM:
           vlmDialog(); break;
#endif
        case INTF_DIALOG_POPUPMENU:
        {
           delete popupMenu; popupMenu = NULL;
           bool show = (de->i_arg != 0);
           if( show )
               popupMenu = VLCMenuBar::PopupMenu( p_intf, show );
           break;
        }
        case INTF_DIALOG_AUDIOPOPUPMENU:
        {
           delete audioPopupMenu; audioPopupMenu = NULL;
           bool show = (de->i_arg != 0);
           if( show )
               audioPopupMenu = VLCMenuBar::AudioPopupMenu( p_intf, show );
           break;
        }
        case INTF_DIALOG_VIDEOPOPUPMENU:
        {
           delete videoPopupMenu; videoPopupMenu = NULL;
           bool show = (de->i_arg != 0);
           if( show )
               videoPopupMenu = VLCMenuBar::VideoPopupMenu( p_intf, show );
           break;
        }
        case INTF_DIALOG_MISCPOPUPMENU:
        {
           delete miscPopupMenu; miscPopupMenu = NULL;
           bool show = (de->i_arg != 0);
           if( show )
               miscPopupMenu = VLCMenuBar::MiscPopupMenu( p_intf, show );
           break;
        }
        case INTF_DIALOG_WIZARD:
        case INTF_DIALOG_STREAMWIZARD:
            openAndStreamingDialogs(); break;
#ifdef UPDATE_CHECK
        case INTF_DIALOG_UPDATEVLC:
            updateDialog(); break;
#endif
        case INTF_DIALOG_EXIT:
            quit(); break;
        default:
           msg_Warn( p_intf, "unimplemented dialog" );
        }
    }
}
コード例 #29
0
ファイル: softkeys.cpp プロジェクト: cedrus/qt4
MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
{
    central = new QWidget(this);
    central->setContextMenuPolicy(Qt::NoContextMenu); // explicitly forbid usage of context menu so actions item is not shown menu
    setCentralWidget(central);

    // Create text editor and set softkeys to it
    textEditor= new QTextEdit(tr("Navigate in UI to see context sensitive softkeys in action"), this);
    QAction* clear = new QAction(tr("Clear"), this);
    clear->setSoftKeyRole(QAction::NegativeSoftKey);

    textEditor->addAction(clear);

    ok = new QAction(tr("Ok"), this);
    ok->setSoftKeyRole(QAction::PositiveSoftKey);
    connect(ok, SIGNAL(triggered()), this, SLOT(okPressed()));

    cancel = new QAction(tr("Cancel"), this);
    cancel->setSoftKeyRole(QAction::NegativeSoftKey);
    connect(cancel, SIGNAL(triggered()), this, SLOT(cancelPressed()));

    infoLabel = new QLabel(tr(""), this);
    infoLabel->setContextMenuPolicy(Qt::NoContextMenu);

    toggleButton = new QPushButton(tr("Custom"), this);
    toggleButton->setContextMenuPolicy(Qt::NoContextMenu);
    toggleButton->setCheckable(true);

    modeButton = new QPushButton(tr("Loop SK window type"), this);
    modeButton->setContextMenuPolicy(Qt::NoContextMenu);

    modeLabel = new QLabel(tr("Normal maximized"), this);
    modeLabel->setContextMenuPolicy(Qt::NoContextMenu);

    pushButton = new QPushButton(tr("File Dialog"), this);
    pushButton->setContextMenuPolicy(Qt::NoContextMenu);

    QComboBox* comboBox = new QComboBox(this);
    comboBox->setContextMenuPolicy(Qt::NoContextMenu);
    comboBox->insertItems(0, QStringList()
     << QApplication::translate("MainWindow", "Selection1", 0, QApplication::UnicodeUTF8)
     << QApplication::translate("MainWindow", "Selection2", 0, QApplication::UnicodeUTF8)
     << QApplication::translate("MainWindow", "Selection3", 0, QApplication::UnicodeUTF8)
    );

    layout = new QGridLayout;
    layout->addWidget(textEditor, 0, 0, 1, 2);
    layout->addWidget(infoLabel, 1, 0, 1, 2);
    layout->addWidget(toggleButton, 2, 0);
    layout->addWidget(pushButton, 2, 1);
    layout->addWidget(comboBox, 3, 0, 1, 2);
    layout->addWidget(modeButton, 4, 0, 1, 2);
    layout->addWidget(modeLabel, 5, 0, 1, 2);
    central->setLayout(layout);

    fileMenu = menuBar()->addMenu(tr("&File"));
    exit = new QAction(tr("&Exit"), this);
    fileMenu->addAction(exit);

    connect(clear, SIGNAL(triggered()), this, SLOT(clearTextEditor()));
    connect(pushButton, SIGNAL(clicked()), this, SLOT(openDialog()));
    connect(exit, SIGNAL(triggered()), this, SLOT(exitApplication()));
    connect(toggleButton, SIGNAL(clicked()), this, SLOT(setCustomSoftKeys()));
    connect(modeButton, SIGNAL(clicked()), this, SLOT(setMode()));
    pushButton->setFocus();
}
コード例 #30
0
void BoatDialog::OnAddPolar( wxCommandEvent& event )
{
    wxFileConfig *pConf = GetOCPNConfigObject();
    pConf->SetPath ( _T( "/PlugIns/WeatherRouting/BoatDialog" ) );

    wxString path;
    pConf->Read ( _T ( "FilePath" ), &path, *GetpSharedDataLocation()
                  + _T("plugins/weather_routing_pi/data/polars"));
    path = wxFileName(path).GetPath();

    wxFileDialog openDialog
        ( this, _( "Select Polar File" ), path, wxT ( "" ),
          wxT ( "CSV, POL, TXT (*.csv, *.pol, *.txt)|*.CSV;*.csv;*.csv.gz;*.csv.bz2;*.POL;*.pol;*.pol.gz;*.pol.bz2;*.TXT;*.txt;*.txt.gz;*.txt.bz2|All files (*.*)|*.*" ),
          wxFD_OPEN | wxFD_MULTIPLE );

    if( openDialog.ShowModal() != wxID_OK )
        return;

    pConf->Write( _T ( "FilePath" ), openDialog.GetPath());

    wxArrayString paths;
    openDialog.GetPaths(paths);

    bool generate = false, existed = true;
    for(unsigned int i=0; i<paths.GetCount(); i++) {
        wxString filename = paths[i], message;
        Polar polar;

        for(unsigned int j=0; j<m_Boat.Polars.size(); j++)
            if(m_Boat.Polars[j].FileName == filename)
                goto skip;

        existed = wxFileName::Exists(filename);

        // write dummy file
        if(!existed) {
            wxFile file;
            if(file.Open(filename, wxFile::write))
                file.Write(dummy_polar);
        }
        
        if(polar.Open(filename, message)) {
            m_Boat.Polars.push_back(polar);
            RepopulatePolars();
            m_lPolars->SetItemState(m_Boat.Polars.size()-1, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED);
            generate = true;
        } else {
            wxMessageDialog md(this, message,
                               _("OpenCPN Weather Routing Plugin"),
                               wxICON_ERROR | wxOK );
            md.ShowModal();
        }
    skip:;
    }

    if(generate)
        GenerateCrossOverChart();
            
    if(!existed)
        OnEditPolar(event);
}