コード例 #1
0
ファイル: AirSpaceWindow.cpp プロジェクト: Iv/FlyHigh
void AirSpaceWindow::file_update()
{
  ProgressDlg progDlg(this);
  uint airspaceNr;
  uint maxAirspaceNr;

  if(m_pDb != NULL)
  {
    m_airSpaceList.clear();
    TableWindow::setNumRows(0);

    if(m_pDb->open())
    {
      TableWindow::setCursor(QCursor(Qt::WaitCursor));
      progDlg.beginProgress("read airspaces...", m_pDb);
      m_pDb->airspaceList(m_airSpaceList);
      progDlg.endProgress();
      maxAirspaceNr = m_airSpaceList.size();
      TableWindow::setNumRows(maxAirspaceNr);

      for(airspaceNr=0; airspaceNr<maxAirspaceNr; airspaceNr++)
      {
        setAirSpaceToRow(airspaceNr, m_airSpaceList.at(airspaceNr));
      }

      TableWindow::selectRow(0);
      selectionChanged();
      m_pDb->close();
      TableWindow::unsetCursor();
    }
  }
}
コード例 #2
0
bool ResolveCommand::Execute()
{
	CResolveDlg dlg;
	dlg.m_pathList = pathList;
	INT_PTR ret = IDOK;
	if (!parser.HasKey(_T("noquestion")))
		ret = dlg.DoModal();
	if (ret == IDOK)
	{
		if (!dlg.m_pathList.IsEmpty())
		{
			if (parser.HasKey(L"silent"))
			{
				for (int i = 0; i < dlg.m_pathList.GetCount(); ++i)
				{
					CString cmd, out;
					cmd.Format(_T("git.exe add -f -- \"%s\""), dlg.m_pathList[i].GetGitPathString());
					if (g_Git.Run(cmd, &out, CP_UTF8))
					{
						CMessageBox::Show(NULL, out, _T("TortoiseGit"), MB_OK | MB_ICONERROR);
						return false;
					}

					CAppUtils::RemoveTempMergeFile((CTGitPath &)dlg.m_pathList[i]);
				}

				HWND resolveMsgWnd = parser.HasVal(L"resolvemsghwnd") ? (HWND)parser.GetLongLongVal(L"resolvemsghwnd") : 0;
				if (resolveMsgWnd)
				{
					static UINT WM_REVERTMSG = RegisterWindowMessage(_T("GITSLNM_NEEDSREFRESH"));
					::PostMessage(resolveMsgWnd, WM_REVERTMSG, NULL, NULL);
				}
				return true;
			}
			else
			{
				CGitProgressDlg progDlg(CWnd::FromHandle(hWndExplorer));
				theApp.m_pMainWnd = &progDlg;
				progDlg.SetCommand(CGitProgressList::GitProgress_Resolve);
				progDlg.SetOptions(parser.HasKey(_T("skipcheck")) ? ProgOptSkipConflictCheck : ProgOptNone);
				progDlg.SetPathList(dlg.m_pathList);
				progDlg.DoModal();
				return !progDlg.DidErrorsOccur();
			}
		}
	}
	return false;
}
コード例 #3
0
bool ResolveCommand::Execute()
{
	CResolveDlg dlg;
	dlg.m_pathList = pathList;
	INT_PTR ret = IDOK;
	if (!parser.HasKey(L"noquestion"))
		ret = dlg.DoModal();
	if (ret == IDOK)
	{
		if (!dlg.m_pathList.IsEmpty())
		{
			if (parser.HasKey(L"silent"))
			{
				for (int i = 0; i < dlg.m_pathList.GetCount(); ++i)
				{
					CString cmd, out;
					cmd.Format(L"git.exe add -f -- \"%s\"", (LPCTSTR)dlg.m_pathList[i].GetGitPathString());
					if (g_Git.Run(cmd, &out, CP_UTF8))
					{
						MessageBox(GetExplorerHWND(), out, L"TortoiseGit", MB_OK | MB_ICONERROR);
						return false;
					}

					CAppUtils::RemoveTempMergeFile((CTGitPath &)dlg.m_pathList[i]);
				}

				HWND resolveMsgWnd = parser.HasVal(L"resolvemsghwnd") ? (HWND)parser.GetLongLongVal(L"resolvemsghwnd") : 0;
				if (resolveMsgWnd && CRegDWORD(L"Software\\TortoiseGit\\RefreshFileListAfterResolvingConflict", TRUE) == TRUE)
				{
					static UINT WM_REVERTMSG = RegisterWindowMessage(L"GITSLNM_NEEDSREFRESH");
					::PostMessage(resolveMsgWnd, WM_REVERTMSG, NULL, NULL);
				}
				return true;
			}
			else
			{
				CGitProgressDlg progDlg(CWnd::FromHandle(GetExplorerHWND()));
				theApp.m_pMainWnd = &progDlg;
				ResolveProgressCommand resolveProgressCommand;
				progDlg.SetCommand(&resolveProgressCommand);
				resolveProgressCommand.SetPathList(dlg.m_pathList);
				progDlg.DoModal();
				return !progDlg.DidErrorsOccur();
			}
		}
	}
	return false;
}
コード例 #4
0
ファイル: AirSpaceWindow.cpp プロジェクト: Iv/FlyHigh
void AirSpaceWindow::file_AddToGPS()
{
  AirSpaceList airspaceList(false);
  ProgressDlg progDlg(this);

  selectionToList(airspaceList);

  if((airspaceList.size() > 0) && IGPSDevice::pInstance()->open())
  {
    TableWindow::setCursor(QCursor(Qt::WaitCursor));
    progDlg.beginProgress("add airspace...", IGPSDevice::pInstance());
    IGPSDevice::pInstance()->add(airspaceList);
    progDlg.endProgress();
    TableWindow::unsetCursor();
    IGPSDevice::pInstance()->close();
  }
}
コード例 #5
0
ファイル: AirSpaceWindow.cpp プロジェクト: Iv/FlyHigh
void AirSpaceWindow::file_delete()
{
  AirSpaceList airspaceList(false);
  ProgressDlg progDlg(this);

  selectionToList(airspaceList);

  if((airspaceList.size() > 0) && m_pDb->open())
  {
    TableWindow::setCursor(QCursor(Qt::WaitCursor));
    progDlg.beginProgress(tr("delete airspaces..."), m_pDb);
    m_pDb->delAirSpaces(airspaceList);
    progDlg.endProgress();
    TableWindow::unsetCursor();
    m_pDb->close();
  }
}
コード例 #6
0
ファイル: ResolveCommand.cpp プロジェクト: 3F/tortoisegit-mdc
bool ResolveCommand::Execute()
{
	CResolveDlg dlg;
	dlg.m_pathList = pathList;
	INT_PTR ret = IDOK;
	if (!parser.HasKey(_T("noquestion")))
		ret = dlg.DoModal();
	if (ret == IDOK)
	{
		if (dlg.m_pathList.GetCount())
		{
			if (parser.HasKey(L"silent"))
			{
				for (int i = 0; i < dlg.m_pathList.GetCount(); ++i)
				{
					CString cmd, out;
					cmd.Format(_T("git.exe add -f -- \"%s\""), dlg.m_pathList[i].GetGitPathString());
					if (g_Git.Run(cmd, &out, CP_UTF8))
					{
						CMessageBox::Show(NULL, out, _T("TortoiseGit"), MB_OK | MB_ICONERROR);
						return false;
					}

					CAppUtils::RemoveTempMergeFile((CTGitPath &)dlg.m_pathList[i]);
				}
				return true;
			}
			else
			{
				CGitProgressDlg progDlg(CWnd::FromHandle(hWndExplorer));
				theApp.m_pMainWnd = &progDlg;
				progDlg.SetCommand(CGitProgressList::GitProgress_Resolve);
				if (parser.HasVal(_T("closeonend")))
					progDlg.SetAutoClose(parser.GetLongVal(_T("closeonend")));
				progDlg.SetOptions(parser.HasKey(_T("skipcheck")) ? ProgOptSkipConflictCheck : ProgOptNone);
				progDlg.SetPathList(dlg.m_pathList);
				progDlg.DoModal();
				return !progDlg.DidErrorsOccur();
			}
		}
	}
	return false;
}
コード例 #7
0
ファイル: AccountWindow.cpp プロジェクト: Iv/FlyHigh
void AccountWindow::file_update()
{
	ProgressDlg progDlg(this);
  uint accountNr;
  uint maxAccountNr;

  m_accountList.clear();
  progDlg.beginProgress("reading accounts...", m_pDb);

  if(m_pDb->accountList(m_accountList))
	{
    maxAccountNr = m_accountList.size();
    TableWindow::setNumRows(maxAccountNr);

    for(accountNr=0; accountNr<maxAccountNr; accountNr++)
		{
      setAccountToRow(accountNr, m_accountList[accountNr]);
		}
	}

	progDlg.endProgress();
}
コード例 #8
0
void WidgetStrainVideo::load(const QString &path, const QString &filename)
{
    currentIndex = 0;
    QString fullPath = path + QDir::separator() + filename;
    QString fullMetadataPath = fullPath + "_metadata";
    currentFilename = filename;

    QProgressDialog progDlg("Loading video", QString(), 0, 500, this);
    progDlg.setWindowModality(Qt::WindowModal);
    progDlg.setMinimumDuration(100);
    VideoDataClip *loadedClip = new VideoDataClip(fullPath, fullMetadataPath, &progDlg);
    setClip(loadedClip);

    QPixmap image = UIUtils::Mat8ToQPixmap(clip->frames[0]);
    ui->widgetResult->setImage(image);

    shapes.clear();
    deserializeShapes(path);
    qDebug() << "shapes loaded";
    ui->horizontalSlider->setValue(0);
    on_horizontalSlider_valueChanged(0);
}
コード例 #9
0
ファイル: stenoteb.cpp プロジェクト: Abyss116/luaplus51-all
bool wxSTEditorNotebook::LoadFiles( wxArrayString *filePaths_,
                                    const wxString &extensions_)
{
    wxString extensions(extensions_.Length() ? extensions_ : GetOptions().GetDefaultFileExtensions());
    wxArrayString filePaths;
    wxString encoding;

    if (filePaths_)
        filePaths = *filePaths_;

    if (filePaths.GetCount() < 1u)
    {
        wxSTEditorFileDialog fileDialog( this, _("Open file(s) into new notebook page"),
                                 GetOptions().GetDefaultFilePath(),
                                 extensions,
                                 wxFD_OPEN | wxFD_FILE_MUST_EXIST | wxFD_MULTIPLE);

        fileDialog.m_encoding = encoding;
        if (fileDialog.ShowModal() == wxID_OK)
        {
            fileDialog.GetPaths(filePaths);
            encoding = fileDialog.m_encoding;
        }
        else
            return false;
    }

    if (!filePaths.GetCount())
        return false;

    size_t n, count = filePaths.GetCount();
    size_t max_filename_len = 80;
    //for (n = 0; n < count; n++) max_filename_len = wxMax(max_filename_len, filePaths[n].Length());

    wxProgressDialog progDlg(_("Loading files..."),
                             wxString(wxT('_'), max_filename_len + 10), // +10 for file count
                             (int)filePaths.GetCount(), this,
                             wxPD_CAN_ABORT|wxPD_ELAPSED_TIME|wxPD_APP_MODAL|wxPD_AUTO_HIDE);

    // block updating the pages while loading them
    if (m_editorTreeCtrl != NULL) m_editorTreeCtrl->Freeze();
    {
    wxSTERecursionGuard guard(m_rGuard_UpdatePageState);

    for (n = 0; n < count; n++)
    {
        wxString fileName(filePaths[n]);
        wxString progressFileName;
        // Ellipsize filename that are too long.
        if (fileName.Length() > max_filename_len)
            progressFileName = fileName.Mid(0, max_filename_len/2-2) + wxT(" ... ") + fileName.Mid(fileName.Length()-max_filename_len/2+2);
        else
            progressFileName = fileName;

        if (!progDlg.Update((int)n, wxString::Format(wxT("%d/%d : "), (int)n+1, (int)count) + progressFileName))
            break;

        if (fileName.IsEmpty() || !wxFileExists(fileName))
        {
            // when selecting multiple files with file selector you can easily
            // select the dir "..", throw it away
            wxString theFileName(fileName.AfterLast(wxFILE_SEP_PATH));
            if ((theFileName != wxT("..")) && (theFileName != wxT(".")))
            {
                wxSTEditorSplitter *splitter = CreateSplitter(wxID_ANY);
                wxCHECK_MSG(splitter, false, wxT("invalid splitter"));
                splitter->GetEditor()->NewFile(fileName);
                if (!InsertEditorSplitter(-1, splitter)) break; // checks overflow
            }
        }
        else
        {
            if (!LoadFile(fileName, wxEmptyString, encoding)) break;
        }
    }
    }

    UpdatePageState();
    if (m_editorTreeCtrl != NULL)
    {
        m_editorTreeCtrl->Thaw();
        m_editorTreeCtrl->UpdateFromNotebook();
    }

    return true;
}
コード例 #10
0
ファイル: MIViewBrowser.cpp プロジェクト: gbook/miview
// --------------------------------------------------------
// ---------- ReloadDB ------------------------------------
// --------------------------------------------------------
void MIViewBrowser::ReloadDB()
{
	int i;
	wxString msg;

	/* before anything, clear the tree control */
	treeFileList->DeleteAllItems();

	/* read in the database file */
	wxString line;
	wxString patient, study, series, filename;
	wxString date,time, dob;
	wxDateTime studyDateTime;
	int numLines;
	wxTextFile pdbFile("browsedb.txt");
	pdbFile.Open();

	rootID = treeFileList->AddRoot("Root");
	wxTreeItemId curPatientID, curStudyID, curSeriesID, curFileID;

	/* loop through, line by line */
	numLines = (int)pdbFile.GetLineCount();

	/* setup the progress dialog */
	wxProgressDialog progDlg(wxT("Loading Database..."), wxT(" "), numLines, this, wxPD_SMOOTH | wxPD_ELAPSED_TIME | wxPD_CAN_ABORT);
	for (i=0;i<numLines;i++) {
		if (!progDlg.Update(i,msg.Format("Reading entry %d of %d",i,numLines)))
			break;

		line = pdbFile[i];
		if (line[0] != '\t') { /* its a new patient/DOB item */
			/* add a node to the root, set current patient node ID */
			patient = line.Trim(true).Trim(false);
			dob = patient.AfterFirst('&');
			dob = ParseDate(dob);
			patient = patient.BeforeFirst('&');
			patient.Replace("^",",");
			patient += " (DOB: " + dob + ")";
			curPatientID = treeFileList->AppendItem(rootID,patient,0);
			treeFileList->SetItemBackgroundColour(curPatientID,wxColour(200,200,200));
			treeFileList->SetItemBold(curPatientID);
		}
		if ((line[0] == '\t') && (line[1] != '\t')) {
			/* add a new studyDate node, set current studyDate node ID */
			study = line.Trim(true).Trim(false);
			date = study.BeforeFirst('&');
			time = study.AfterFirst('&');
			study = ParseDateAndTime(date,time);

			curStudyID = treeFileList->AppendItem(curPatientID,study,1);

			treeFileList->SetItemBackgroundColour(curStudyID,wxColour(225,225,225));
		}
		if ((line[0] == '\t') && (line[1] == '\t') && (line[2] != '\t')) {
			/* add a new seriesNumber node, set current seriesNumber node ID */
			series = line.Trim(true).Trim(false);
			curSeriesID = treeFileList->AppendItem(curStudyID,series,2);
		}
		if ((line[0] == '\t') && (line[1] == '\t') && (line[2] == '\t')) {
			/* add a new filename node */
			filename = line.Trim(true).Trim(false);
			curFileID = treeFileList->AppendItem(curSeriesID,filename);
		}
		::wxSafeYield();
	}
	ExpandAllPatients();
}
コード例 #11
0
ファイル: MIViewBrowser.cpp プロジェクト: gbook/miview
// --------------------------------------------------------
// ---------- RecreateDB ----------------------------------
// --------------------------------------------------------
void MIViewBrowser::RecreateDB()
{
	wxArrayString files;
	wxFile outfile("browsedb.txt",wxFile::write);
	int fileCount;
	int i,j,k,m;
	int numStudies, numSeries, numFiles;
	wxArrayInt offs, lens;
	wxFile dicomfile;
	wxString str, msg;
	wxString patName, patDOB, studyDate, studyTime, seriesNum;
	wxString patientAndDOB, studyDateTimeStr, sliceNum;
	wxString studyName, seriesName, fileName;
	
	if (chkScanRecursively->GetValue())
		wxDir::GetAllFiles(txtScanDir->GetValue(),&files,"",wxDIR_DEFAULT);
	else
		wxDir::GetAllFiles(txtScanDir->GetValue(),&files,"",wxDIR_FILES);
	fileCount = (int)files.Count();

	/* setup the progress dialog */
	wxProgressDialog progDlg(wxT("Creating database..."), wxT(" "), fileCount, this, wxPD_SMOOTH | wxPD_ELAPSED_TIME | wxPD_CAN_ABORT);

	for (i=0;i<fileCount;i++) {
		wxFileName fn(files[i]);
		if ( (fn.GetExt() == "dcm") || (fn.GetExt() == "acr") || (fn.GetExt() == "") ) {
			if (!progDlg.Update(i,msg.Format("Reading file %d of %d",i,fileCount)))
				break;

			gdcm::ImageReader reader;
			/* see if the file will open */
			reader.SetFileName(files[i].c_str());
			if (reader.Read()) {
				gdcm::DataSet dataSet;
				const gdcm::File &file = reader.GetFile();
				dataSet = file.GetDataSet();

				gdcm::Attribute<0x0010,0x0010> at; /* patient name */
				if (dataSet.FindDataElement( at.GetTag() )) {
					const gdcm::DataElement &de = dataSet.GetDataElement( at.GetTag() );
					at.SetFromDataElement( de );
					patName = at.GetValue().c_str();
					patName.Replace("^",",");
				} else { patName = "";}

				gdcm::Attribute<0x0010,0x0030> at1; /* patient birthdate */
				if (dataSet.FindDataElement( at1.GetTag() )) {
					const gdcm::DataElement &de1 = dataSet.GetDataElement( at1.GetTag() );
					at1.SetFromDataElement( de1 );
					patDOB = at1.GetValue().c_str();
				} else { patDOB = "";}

				gdcm::Attribute<0x0008,0x0020> at2; /* study date */
				if (dataSet.FindDataElement( at2.GetTag() )) {
					const gdcm::DataElement &de2 = dataSet.GetDataElement( at2.GetTag() );
					at2.SetFromDataElement( de2 );
					studyDate = at2.GetValue().c_str();
				} else { studyDate = "";}

				gdcm::Attribute<0x0008,0x0030> at3; /* study time */
				if (dataSet.FindDataElement( at3.GetTag() )) {
					const gdcm::DataElement &de3 = dataSet.GetDataElement( at3.GetTag() );
					at3.SetFromDataElement( de3 );
					studyTime = at3.GetValue().c_str();
				} else { studyTime = "";}

				gdcm::Attribute<0x0020,0x0011> at4; /* series number */
				if (dataSet.FindDataElement( at4.GetTag() )) {
					const gdcm::DataElement &de4 = dataSet.GetDataElement( at4.GetTag() );
					at4.SetFromDataElement( de4 );
					seriesNum = wxString::Format("%d",at4.GetValue());
				} else { seriesNum = "";}

				gdcm::Attribute<0x0020,0x0011> at5; /* series number */
				if (dataSet.FindDataElement( at5.GetTag() )) {
					const gdcm::DataElement &de5 = dataSet.GetDataElement( at5.GetTag() );
					at5.SetFromDataElement( de5 );
					sliceNum = wxString::Format("%d",at5.GetValue());
				} else { sliceNum = "";}
				patientAndDOB = patName + "&" + patDOB;
				studyDateTimeStr = studyDate + "&" + studyTime;
				browsedb[patientAndDOB][studyDateTimeStr][seriesNum][files[i]].slicenum = atoi(sliceNum.c_str());
			}
		}
	}

	/* write out the database file */
	for (i=0;i<browsedb.GetNumPatients();i++) {
		patName = browsedb[i].patientName;
		numStudies = browsedb[i].GetNumStudies();
		str = patName + "\n";
		outfile.Write(str);
		for (j=0;j<numStudies;j++) {
			studyName = browsedb[i][j].studyName;
			numSeries = browsedb[i][j].GetNumSeries();
			str = "\t" + studyName + "\n";
			outfile.Write(str);
			for (k=0;k<numSeries;k++) {
				seriesName = browsedb[i][j][k].seriesName;
				numFiles = browsedb[i][j][k].GetNumFiles();
				str = "\t\t" + seriesName + "\n";
				outfile.Write(str);
				for (m=0;m<numFiles;m++) {
					fileName = browsedb[i][j][k][m].fileName;
					str = "\t\t\t" + fileName + "\n";
					outfile.Write(str);
				}
			}
		}
	}
}