示例#1
0
void TranscodeDialog::JobComplete(const QString& filename, bool success) {
  (*(success ? &finished_success_ : &finished_failed_))++;
  queued_--;

  UpdateStatusText();
  UpdateProgress();
}
示例#2
0
void TranscodeDialog::Start() {
  SetWorking(true);

  QAbstractItemModel* file_model = ui_->files->model();
  TranscoderPreset preset = ui_->format->itemData(ui_->format->currentIndex())
                                .value<TranscoderPreset>();

  // Add jobs to the transcoder
  for (int i = 0; i < file_model->rowCount(); ++i) {
    QString filename = file_model->index(i, 0).data(Qt::UserRole).toString();
    QString outfilename = GetOutputFileName(filename, preset);
    transcoder_->AddJob(filename, preset, outfilename);
  }

  // Set up the progressbar
  ui_->progress_bar->setValue(0);
  ui_->progress_bar->setMaximum(file_model->rowCount() * 100);

  // Reset the UI
  queued_ = file_model->rowCount();
  finished_success_ = 0;
  finished_failed_ = 0;
  UpdateStatusText();

  // Start transcoding
  transcoder_->Start();

  // Save the last output format
  QSettings s;
  s.beginGroup(kSettingsGroup);
  s.setValue("last_output_format", preset.extension_);
}
示例#3
0
BOOL CUpdateThread::CheckCancel()
{
	if (m_bCancel && !m_bChecked) 
	{
		UpdateMainProgress(100);
		UpdateSubProgress(100);
		UpdateStatusText(_T("已取消"));
		UpdateCommandButton(COMMAND_BUTTON_UPDATE);
		m_bChecked = TRUE;
		return FALSE;
	}
	return !m_bChecked;
}
示例#4
0
void AlbumCoverManager::FetchSingleCover() {
  for (QListWidgetItem* item : context_menu_items_) {
    quint64 id =
        cover_fetcher_->FetchAlbumCover(item->data(Role_ArtistName).toString(),
                                        item->data(Role_AlbumName).toString());
    cover_fetching_tasks_[id] = item;
    jobs_++;
  }

  progress_bar_->setMaximum(jobs_);
  progress_bar_->show();
  abort_progress_->show();
  UpdateStatusText();
}
示例#5
0
void AlbumCoverManager::AlbumCoverFetched(
    quint64 id, const QImage& image, const CoverSearchStatistics& statistics) {
  if (!cover_fetching_tasks_.contains(id)) return;

  QListWidgetItem* item = cover_fetching_tasks_.take(id);
  if (!image.isNull()) {
    SaveAndSetCover(item, image);
  }

  if (cover_fetching_tasks_.isEmpty()) {
    EnableCoversButtons();
  }

  fetch_statistics_ += statistics;
  UpdateStatusText();
}
示例#6
0
void AlbumCoverManager::FetchAlbumCovers() {
  for (int i = 0; i < ui_->albums->count(); ++i) {
    QListWidgetItem* item = ui_->albums->item(i);
    if (item->isHidden()) continue;
    if (item->icon().cacheKey() != no_cover_icon_.cacheKey()) continue;

    quint64 id =
        cover_fetcher_->FetchAlbumCover(item->data(Role_ArtistName).toString(),
                                        item->data(Role_AlbumName).toString());
    cover_fetching_tasks_[id] = item;
    jobs_++;
  }

  if (!cover_fetching_tasks_.isEmpty()) ui_->fetch->setEnabled(false);

  progress_bar_->setMaximum(jobs_);
  progress_bar_->show();
  abort_progress_->show();
  fetch_statistics_ = CoverSearchStatistics();
  UpdateStatusText();
}
示例#7
0
void MainFrame::SetStatusText (std::string& status_text, const std::string& pText)
{
	status_text = pText;
	UpdateStatusText();
}
示例#8
0
void CMainFrame::OnDutyOff()
{
#ifndef _DEBUG
	if (!CRightsManagement::GetInstance()->Take_IBAP_ONOFFDUTY(FALSE))
	{
		return;
	}
#endif
	
	//{ 2011/08/11-8201-gxx: 
	
	BOOL bNormal = TRUE;
	if (CIBAGlobal::NetworkStatus == CIBAGlobal::emNetworkRestore)
	{
		bNormal = FALSE;
	}
	else
	{
		CArray<CLocalConsumeInfo,CLocalConsumeInfo&> InfoArray; 
		CIBADAL::GetInstance()->GetLocalConsumes(InfoArray);
		if (InfoArray.GetCount() > 0)
		{
			bNormal = FALSE;
		}
	}

	if (theApp.GetCurCashier()->IsOnDuty() == FALSE)
	{
		bNormal = TRUE; // 能弹出上班界面
	}
	
	//}

	if (bNormal)
	{
		CDlgIBADuty dlg;

		if (theApp.GetCurCashier()->IsOnDuty())//是否在上班
		{
			if (dlg.DoModal() == IDOK)
			{
				//{ 2011/04/19-gxx: 判断在交班的时候,IBA是否有更新
				theApp.UpdateIBA();
				//}

				CJXCMainDlg::DestroyJxcMainDlg();//销毁非模态的进销存对话框

				UpdateStatusText();//更新状态栏

				CIBALoginDlg dlg2;//登入对话框
				dlg2.SetLoginType(1);//调整位置,不对原顶层窗体做要求

				if (dlg2.DoModal() == IDOK)
				{
					UpdateStatusText();//更新状态栏
				}
				else
				{
					CBCGPFrameWnd::OnClose();//退出
				}
			}
		}
		else
		{
			dlg.DoModal();
			UpdateStatusText();
		}
	}
	else
	{
		CDlgDutyLocal dlg;
		dlg.DoModal();
	}
}
示例#9
0
void CMainFrame::StartIBA()
{
	UNIT_AUTO_TRACE("CMainFrame::StartIBA()--");

	CIBALog::GetInstance()->Write(_T("StartIBA"));
	
	if (0 == CNetBarConfig::GetInstance()->GetIsShowRzxPhoto())
	{
		m_wndTaskPane.RemoveGroup(2);
		m_wndTaskPane.m_dlgUserPhoto.ShowWindow(SW_HIDE);
	}
	

	// 2011/05/17-gxx: 例如账户直充的控制配置是在Menubar创建后读取的,添加代码让菜单重新设置
	m_wndMenuBar.ResetAll();

	
	CLocalServer::GetInstance()->ConnectServer();
	CLocalServer::GetInstance()->ActiveMemberList.LoadFromDB();
	CLocalServer::GetInstance()->GetActiveMemberView()->Refresh(TRUE);
	

	CString strTmp;
	//GetWindowText(strTmp);
	// 2011/08/24-8201-gxx: 
	strTmp = LOAD_STRING(IDS_IBATITLE);

	strTmp.Insert(0, _T(" - "));
	strTmp.Insert(0, CNetBarConfig::GetInstance()->GetNetBarName());
	SetWindowText(strTmp);

	ShowWindow(SW_SHOWMAXIMIZED);
	UpdateWindow();
	UpdateStatusText();

	EmptyWorkingSet(GetCurrentProcess);

	//初始化实名系统
	if (!theApp.GetRealName()->InitRealName())
	{
		theApp.IBAMsgBox(_T("初始化实名认证失败"));
		CBCGPFrameWnd::OnClose();

	}
	else
	{
		SetTimer(1000, 1000 * 10, NULL); //10秒一次

		// 2011/05/05-gxx: 开启获取滚动文字
		m_wndFastLane.StartThread();
	}

	CJuBao* pTmp = NULL;

	// 2013-9-11-qscadd:聚宝接口初始化
	if(1 == CNetBarConfig::GetInstance()->GetEnableJuBao())
	{
		if(!m_pJuBao)
		{
			m_pJuBao = new CJuBao;
		}
		if(!m_pJuBao->RegCallBackFunc())
		{
			AfxMessageBox(_T("聚宝注册初始化失败!"));
			IBA_LOG0(_T("注册聚宝回调函数失败!"));
		}
		if(!m_pJuBao->InitInterface("testxzg001","610","sntestxzg001"))
		{
			AfxMessageBox(_T("聚宝初始化失败!"));
			IBA_LOG0(_T("聚宝初始化失败!"));
		}
		pTmp = GetJubaoInf();
	}

	if (CNetBarConfig::GetInstance()->GetEnableID2Reader())
	{
		HANDLE hMutex = ::CreateMutex(NULL, FALSE, _T("_ID2READER_ALLOW_MUTEX_"));
		if(hMutex == NULL)
			return;

		if(GetLastError() != ERROR_ALREADY_EXISTS)
		{
			WinExec(".\\IBABin\\ID2Reader.exe", SW_HIDE);
		}
		else
		{
			CloseHandle(hMutex);
		}
	}
	else
	{
		// 空白照片删除 QSC 2013-5-7 10:46:16
		//m_wndTaskPane.RemoveGroup(2);
		//m_wndTaskPane.m_dlgUserPhoto.ShowWindow(SW_HIDE);
	}
}
示例#10
0
void CUpdateThread::Update()
{
	// 读取本地配置
	UpdateCommandButton(COMMAND_BUTTON_CANCEL);
	UpdateMainProgress(0);
	UpdateSubProgress(0);

	UpdateStatusText(_T("读取站点列表……"));
	CString strIniPath = theApp.GetProfileFile();
	CString strSites;
	DWORD dwSize = 0;
	do 
	{
		dwSize += 4096;
	} while(GetPrivateProfileSection(_T("Sites"), strSites.GetBuffer(dwSize), dwSize, strIniPath.GetString()) == dwSize - 2);
	UpdateSubProgress(100);

	CArray<CString> sites;
	LPCTSTR lpszSite = strSites.GetBuffer();
	while (lpszSite[0]) 
	{
		sites.Add(lpszSite);
		lpszSite += _tcslen(lpszSite) + 1;
	}
	strSites.ReleaseBuffer();

	UpdateMainProgress(2);

	CMap<CString, LPCTSTR, AddonFile, AddonFile&> files;
	// 下载文件列表
	double step = 6.0 / sites.GetSize();
	for (int i = 0; i < sites.GetSize() && CheckCancel(); ++i) 
	{
		CString &strSite = sites.GetAt(i);
		if (!GetFileList(strSite, files))
		{
			UpdateSubProgress(100);
			UpdateMainProgress(100);
			UpdateStatusText(_T("无法下载文件列表。"));
			return;
		}
		UpdateMainProgress(2 + (int)(step * i + 0.5));
	}
	if (!CheckCancel())
		return;
	UpdateMainProgress(8);
		
	UpdateStatusText(_T("正在检测需要更新的文件……"));

	CString strWOWPath = theApp.GetWOWPath();
	CString strTempPath = theApp.GetTempPath();
	CArray <AddonFile *> aDownloadList;
	// 需要下载的文件
	CMap<CString, LPCTSTR, AddonFile, AddonFile&>::CPair *pair = files.PGetFirstAssoc();
	while (pair && CheckCancel())
	{
		CString strMD5;
		try 
		{
			CString strFilePath;
			strFilePath.Append(strWOWPath);
			strFilePath.Append(pair->value.m_strPath);
			md5_state_t md5;
			md5_init(&md5);
			md5_byte_t digest[16] = {0};
			CFile file(strFilePath, CFile::shareDenyRead | CFile::modeRead);
			char buf[4096];
			UINT nCount;
			while ((nCount = file.Read(buf, 4096)) > 0)
			{
				md5_append(&md5, buf, nCount);	
			}
			file.Close();
			md5_finish(&md5, digest);
			for (int i = 0; i < 16; ++i)
			{
				strMD5.AppendFormat(_T("%02x"), digest[i]);
			}
		}
		catch (CFileException *e)
		{
			e->Delete();
		}
		if (strMD5.Compare(pair->value.m_strMD5) != 0)
		{
			aDownloadList.Add(&pair->value);
		}

		pair = files.PGetNextAssoc(pair);
	}

	if (!CheckCancel())
		return;

	ULONG uTotalSize = 0;
	for (int i = 0; i < aDownloadList.GetSize(); ++i)
	{
		uTotalSize += aDownloadList.GetAt(i)->m_uCompressedSize;
	}

	if (!CheckCancel())
		return;

	CString strStatus;
	strStatus.AppendFormat(_T("共有%u个文件需要更新,%.2fMB。"), aDownloadList.GetSize(), uTotalSize * 1.0f / 1024 / 1024);
	UpdateStatusText(strStatus);
	UpdateMainProgress(10);

	step = 88.0 / uTotalSize;
	ULONG uDownload = 0;
	for (int i = 0; i < aDownloadList.GetSize() && CheckCancel(); ++i)
	{
		AddonFile *pAddonFile = aDownloadList.GetAt(i);
		UpdateStatusText(CString(_T("下载 ") + pAddonFile->m_strPath).GetString());
		CString strUrl = pAddonFile->m_strSite + pAddonFile->m_strPath + _T(".z");
		strUrl.Replace(_T('\\'), _T('/'));
		CString strPath = strTempPath + pAddonFile->m_strPath + _T(".z");
		CString strFolder = strPath.Mid(0, strPath.ReverseFind(_T('\\')));
		SHCreateDirectoryEx(NULL, strFolder, NULL);
		if (!Download(strUrl, strPath, pAddonFile->m_uCompressedSize))
		{
			UpdateStatusText(CString(_T("下载 ") + pAddonFile->m_strPath + _T("失败")).GetString());
			Cancel();
			CheckCancel();
			return;
		}
		UpdateSubProgress(100);
		UpdateStatusText(CString(_T("解压 ") + pAddonFile->m_strPath + _T("...")).GetString());
		CFile file(strPath, CFile::modeRead | CFile::shareDenyNone);
		unsigned char *compressed = new unsigned char[file.GetLength()];
		UINT uRead = 0;
		UINT uTotalRead = 0;
		file.Read(compressed, file.GetLength());
		ULONG uCompSize = file.GetLength();
		file.Close();
		unsigned char *uncompressed = new unsigned char[pAddonFile->m_uSize];
		DWORD uSize = pAddonFile->m_uSize;
		if (uncompress(uncompressed, &uSize, compressed, uCompSize) != Z_OK)
		{
			delete[] compressed;
			delete[] uncompressed;
			UpdateStatusText(CString(_T("解压 ") + pAddonFile->m_strPath + _T("失败")).GetString());
			Cancel();
			CheckCancel();
			return;
		}
		strPath = strWOWPath + pAddonFile->m_strPath;
		strFolder = strPath.Mid(0, strPath.ReverseFind(_T('\\')));
		SHCreateDirectoryEx(NULL, strFolder, NULL);
		if (!file.Open(strPath, CFile::modeCreate | CFile::shareExclusive | CFile::modeReadWrite))
		{
			delete[] compressed;
			delete[] uncompressed;
			UpdateStatusText(CString(_T("创建 ")) + strPath + _T("失败。"));
			Cancel();
			CheckCancel();
			return;
		}
		file.Write(uncompressed, pAddonFile->m_uSize);
		file.Close();

		delete[] compressed;
		delete[] uncompressed;
		uDownload += pAddonFile->m_uCompressedSize;
		UpdateMainProgress(8 + uDownload * step + 0.5);
	}

	if (!CheckCancel())
		return;

	// 需要删除的文件
	CArray<CString, LPCTSTR> oldFiles;
	LoadOldList(oldFiles);
	for (int i = 0; i < oldFiles.GetSize(); ++i)
	{
		CString &strPath = oldFiles.GetAt(i);
		if (!files.PLookup(strPath.MakeLower()))
		{
			CString strFilePath = strWOWPath + strPath;
			DeleteFile(strFilePath);
			RemoveFolderIfEmpty(strWOWPath, strFilePath.Mid(0, strFilePath.ReverseFind(_T('\\'))));
		}
	}

	// 保存本次更新的列表
	TiXmlDocument doc;
	TiXmlElement *root = new TiXmlElement("Files");
	pair = files.PGetFirstAssoc();
	USES_CONVERSION;
	while (pair)
	{
		TiXmlElement *file = new TiXmlElement("File");
		file->SetAttribute("Path", T2A(pair->value.m_strPath));
		root->LinkEndChild(file);
		pair = files.PGetNextAssoc(pair);
	}

	doc.LinkEndChild(root);
	doc.SaveFile(T2A(theApp.GetApplicationPath() + _T("AddonUpdater.xml")));
	UpdateStatusText(_T("更新完毕。"));
	UpdateMainProgress(100);
	UpdateCommandButton(COMMAND_BUTTON_PLAY);
}
示例#11
0
BOOL CPWFiltersDlg::OnInitDialog()
{
  std::vector<UINT> vibottombtns;
  UINT main_bns[] = {IDC_APPLY, IDOK, IDCANCEL, ID_HELP};
  UINT other_bns[] = {IDOK, IDCANCEL, ID_HELP};

  if (m_iType == DFTYPE_MAIN && m_bAllowSet)
    vibottombtns.assign(main_bns, main_bns + _countof(main_bns));
  else
    vibottombtns.assign(other_bns, other_bns + _countof(other_bns));

  AddMainCtrlID(IDC_FILTERLC);
  AddBtnsCtrlIDs(vibottombtns);

  UINT statustext[1] = {IDS_BLANK};
  SetStatusBar(&statustext[0], 1);

  CPWResizeDialog::OnInitDialog();

  SetWindowText(m_cstitle);

  m_hAccel = ::LoadAccelerators(AfxGetResourceHandle(),
                                MAKEINTRESOURCE(IDR_FILTERACCELERATOR));

  DWORD dwExStyle = m_FilterLC.GetExtendedStyle();
  dwExStyle |= LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES | LVS_EX_SUBITEMIMAGES;
  m_FilterLC.SetExtendedStyle(dwExStyle);

  m_FilterLC.Init(this, m_pfilters, m_iType, m_bCanHaveAttachments, m_psMediaTypes);
  if (m_filtername.IsEmpty() || m_pfilters->fname.empty())
    m_filtername.LoadString(IDS_FILTER_NAME);
  else
    m_filtername = m_pfilters->fname.c_str();

  CHeaderCtrl* pHCtrl;
  pHCtrl = m_FilterLC.GetHeaderCtrl();
  ASSERT(pHCtrl != NULL);
  pHCtrl->SetDlgCtrlID(IDC_FILTERLC_HEADER);
  m_FLCHeader.SubclassWindow(pHCtrl->GetSafeHwnd());
  m_FLCHeader.SetStopChangeFlag(true);

  CRect rect;
  // Move over History & Policy dialogs so as not to obscure main filter dialog
  if (m_iType != DFTYPE_MAIN) {
    GetParent()->GetWindowRect(&rect);
    SetWindowPos(NULL, rect.left + rect.Width() / 3, rect.top + rect.Width() / 3,
                 0, 0, SWP_NOSIZE | SWP_NOZORDER);
  }

  // Main window has Apply (if not called via Manage), OK, Cancel buttons
  // History/Policy/Attachment have OK, Cancel, Help buttons
  // but only one dialog definition in resource file for both in
  // order to ensure that the dialogs look exactly the same and also
  // easier to maintain
  if (m_iType != DFTYPE_MAIN) {
    GetDlgItem(IDC_FILTERNAME)->EnableWindow(FALSE);
  }

  if (!m_bAllowSet) {
    // Change buttons if called via ManageFilters or 
    // is a History/Policy dialog
    GetDlgItem(IDC_APPLY)->EnableWindow(FALSE);
    GetDlgItem(IDC_APPLY)->ShowWindow(SW_HIDE);
  }

  int itotalwidth = 0;
  for (int i = 0; i < FLC_NUM_COLUMNS; i++) {
    itotalwidth += m_FilterLC.GetColumnWidth(i);
  }

  int iMaxWidth = itotalwidth + 16;
  int iMaxHeight = 1024;
  SetMaxHeightWidth(iMaxHeight, iMaxWidth);

  // Update dialog window text
  UpdateStatusText();
  UpdateData(FALSE);

  if (m_iType == DFTYPE_MAIN)
    GetDlgItem(IDC_APPLY)->EnableWindow(m_pfilters->num_Mactive == 0 ? FALSE : TRUE);

  return TRUE;  // return TRUE unless you set the focus to a control
}