Пример #1
0
void CAboutDlg::OnCrystalDewWorld()
{
	if(GetUserDefaultLCID() == 0x0411)// Japanese
	{
		OpenUrl(URL_CRYSTAL_DEW_WORLD_JA);
	}
	else // Other Language
	{
		OpenUrl(URL_CRYSTAL_DEW_WORLD_EN);
	}
}
Пример #2
0
INT_PTR CALLBACK AboutPageDialogProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) {
  if (msg == WM_COMMAND) {
    if (wParam == IDC_DONATE) {
      OpenUrl(L"https://stefansundin.github.io/altdrag/");
    }
  }
  else if (msg == WM_NOTIFY) {
    LPNMHDR pnmh = (LPNMHDR)lParam;
    if (pnmh->code == PSN_SETACTIVE) {
      // Update text
      SetDlgItemText(hwnd, IDC_ABOUT_BOX,        l10n->about_box);
      SetDlgItemText(hwnd, IDC_VERSION,          l10n->about_version);
      SetDlgItemText(hwnd, IDC_AUTHOR,           l10n->about_author);
      SetDlgItemText(hwnd, IDC_LICENSE,          l10n->about_license);
      SetDlgItemText(hwnd, IDC_DONATE,           l10n->about_donate);
      SetDlgItemText(hwnd, IDC_TRANSLATIONS_BOX, l10n->about_translation_credit);

      wchar_t txt[1024] = L"";
      int i;
      for (i=0; i < ARRAY_SIZE(languages); i++) {
        wcscat(txt, languages[i]->lang_english);
        wcscat(txt, L": ");
        wcscat(txt, languages[i]->author);
        if (i+1 != ARRAY_SIZE(languages)) {
          wcscat(txt, L"\r\n");
        }
      }
      SetDlgItemText(hwnd, IDC_TRANSLATIONS, txt);
    }
  }

  LinkProc(hwnd, msg, wParam, lParam);
  return FALSE;
}
Пример #3
0
void Login::Qrcode_Layout_init()
{
    Head_label = new QLabel();
    qcode_label = new QLabel();
    Head_label->setFixedHeight(30);
    Head_label->setAlignment(Qt::AlignCenter);
    Head_label->setText(tr("using wechar scanning safe login.") + "<a href = http://blog.csdn.net/ongoingcre>" + tr("missing?") + "</a>");
//    qcode_label->setFixedSize(400,125);
    qcode_label->setPixmap(QPixmap(":/qcode/qrcode"));
//    qcode_label->setStyleSheet("background-color:red");
//    Head_label->setStyleSheet("background-color:red");
    Head_label->setAlignment(Qt::AlignCenter);
    qcode_Layout = new QHBoxLayout();
    qcode_Layout->addStretch(0);
    qcode_Layout->addWidget(qcode_label);
    qcode_Layout->addStretch(0);
    qcode_Layout->setMargin(0);
    qcode_Layout->setSpacing(0);
   // qcode_Layout->setContentsMargins(85,0,85,15);

    //free(layout);
    /*main layout*/
    layout_page_2 = new QVBoxLayout();
    layout_page_2->addWidget(Head_label);
    layout_page_2->addLayout(qcode_Layout);
    //layout->addStretch(0);
    layout_page_2->setMargin(0);
    layout_page_2->setSpacing(0);
    layout_page_2->setContentsMargins(0,25,0,0);
    page_2_qrcode = new QWidget(this);
    page_2_qrcode->setStyleSheet("background-color:white");
    page_2_qrcode->setLayout(layout_page_2);
    connect(Head_label,SIGNAL(linkActivated(QString)),this,SLOT(OpenUrl(QString )));

}
Пример #4
0
void LinkProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) {
  if (msg == WM_NOTIFY) {
    NMLINK *link = (NMLINK*)lParam;
    if (link->hdr.code == NM_CLICK || link->hdr.code == NM_RETURN) {
      OpenUrl(link->item.szUrl);
    }
  }
}
Пример #5
0
LRESULT CALLBACK PopupProc(HWND wnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
	POPUP_DATA_HEADER *ppdh = (POPUP_DATA_HEADER*)PUGetPluginData(wnd);
	LPCSTR acc;

	if (EVENT_DELETED_MSG == msg) {
		if ((MEVENT)lParam == ppdh->hDbEvent)
			ppdh->hDbEvent = NULL;
		return 0;
	}

	if (MESSAGE_CLOSEPOPUP == msg) {
		ppdh->MarkRead = TRUE;
		PUDeletePopup(wnd);
	}

	switch (msg) {
	case UM_INITPOPUP:
		SetProp(wnd, PLUGIN_DATA_PROP_NAME, (HANDLE)ppdh);
		SetProp(wnd, EVT_DELETED_HOOK_PROP_NAME,
			HookEventParam(ME_DB_EVENT_DELETED, OnEventDeleted, (LPARAM)wnd));
		return 0;

	case UM_FREEPLUGINDATA:
		{
			HANDLE hHook = GetProp(wnd, EVT_DELETED_HOOK_PROP_NAME);
			RemoveProp(wnd, EVT_DELETED_HOOK_PROP_NAME);
			UnhookEvent(hHook);
		}

		if (ppdh->MarkRead && ppdh->hDbEvent && (acc = GetJidAcc(ppdh->jid))) {
			ReadNotificationSettings(acc);
			MarkEventRead(ppdh->hContact, ppdh->hDbEvent);
			CallService(MS_CLIST_REMOVEEVENT, (WPARAM)ppdh->hContact, (LPARAM)ppdh->hDbEvent);
		}
		RemoveProp(wnd, PLUGIN_DATA_PROP_NAME);
		free(ppdh);
		return 0;

	case WM_LBUTTONUP:
		acc = NULL;
		__try {
			if (!(acc = GetJidAcc(ppdh->jid))) return 0;

			ReadNotificationSettings(acc);
			OpenUrl(acc, ppdh->jid, ppdh->url);
		}
		__finally {
			CloseNotifications(acc, ppdh->url, ppdh->jid, TRUE);
		}
		return 0;

	case WM_RBUTTONUP:
		SendMessage(wnd, MESSAGE_CLOSEPOPUP, 0, 0);
		return 0;
	}
	return DefWindowProc(wnd, msg, wParam, lParam);
}
Пример #6
0
BOOL CAmHttpSocket::DownLoadFile(const char *szFilePath,const char *url,bool Post, const char *PostData, int PostDataLength){

	OutputDebugString(_T("DownLoad File Starting.\r\n"));
	char szDir[MAX_PATH+1] = "\0";
	memcpy_s(szDir,MAX_PATH,szFilePath,strlen(szFilePath));
	if(!CreateFileDir(szDir))return FALSE;
	HANDLE hFile = CreateFileA(
		szFilePath,
		GENERIC_READ|GENERIC_WRITE,
		FILE_SHARE_READ|FILE_SHARE_WRITE,
		NULL,
		CREATE_ALWAYS,
		FILE_ATTRIBUTE_NORMAL,//FILE_ATTRIBUTE_HIDDEN
		NULL
		);
	if(hFile == INVALID_HANDLE_VALUE)return false;



	//did we get an url?
	if (url == NULL)
	{
		LastError = -1;
		return NULL;
	}
	//get the page and store it in ReceivedData...
	if (Post)
	{
		//use http post...
		if (!PostUrl(url, PostData, PostDataLength)) return NULL;
	}
	else
	{
		//use http get
		if (!OpenUrl(url)) return NULL;
	}
	DWORD dwPos = 0,dwWrited = 1;
	BOOL bReturn = FALSE;
	while(dwWrited > 0)
	{
		InternetReadFile(hIS, ReceivedData, SIZE_STEP_DEFAULT, &dwWrited);
		if(!(bReturn = WriteFile(hFile, ReceivedData, dwWrited, &dwPos, NULL))) break;
		Out(Dbg,_T("DownLoading Files .\r\n"));
	}

//	TCHAR *httpHeader=GetHeaders(url);
	CloseHandle(hFile);
	if(!bReturn)
	{
		OutputDebugString(_T("DownLoad File Failed.\r\n"));
		return false;
	}
	OutputDebugString(_T("DownLoad File Successful.\r\n"));
	return TRUE;
}
Пример #7
0
UINT CSubtitleDlDlg::RunThread(LPVOID pParam) {
	PTHREADSTRUCT pTA = reinterpret_cast<PTHREADSTRUCT>(pParam);

	if (!OpenUrl(pTA->is, CString(pTA->url), pTA->raw_list)) {
		::PostMessage(pTA->hWND, UWM_FAILED, (WPARAM)0, (LPARAM)0);
		AfxEndThread(1, TRUE);
	}

	::PostMessage(pTA->hWND, UWM_PARSE, (WPARAM)0, (LPARAM)0);

	return 0;
};
Пример #8
0
LRESULT HyperLink::OnReflectCommand(WPARAM wParam, LPARAM lParam)
{

	if (HIWORD(wParam) == STN_CLICKED)
	{
		if( !url.empty()){
			OpenUrl(url.c_str());
		}
		//if (url != NULL) { OpenUrl(url); }
	}

	return 0;
}
Пример #9
0
void CHyperLink::OnLButtonUp(UINT nFlags, CPoint point)
{
	if (!m_bDisabled)
	{
		ShowCursor(FALSE);
		m_hReg = ::SetCursor(m_hHand);
		ShowCursor(TRUE);
	}

	m_bMouseDown = FALSE;

	POINT cPt;

	GetCursorPos(&cPt);

	if (cPt.x >= m_rcCapture.left &&
		cPt.x <= m_rcCapture.right &&
		cPt.y >= m_rcCapture.top &&
		cPt.y <= m_rcCapture.bottom)
	{
		m_bMouseIn = TRUE;
	}
	else
	{
		m_bMouseIn = FALSE;
	}

	ReleaseCapture();

	Invalidate();

	if (!m_bDisabled && m_bMouseIn)
	{
		OpenUrl();

		if (!m_bIsLink || (GetStyle() & SS_NOTIFY))
		{
			CWnd* pParent = GetParent();

			if (pParent != NULL)
			{
				WORD wID = GetDlgCtrlID();

				if (wID)
				{
					pParent->SendMessage(WM_COMMAND, MAKEWPARAM(wID,STN_CLICKED),(LPARAM)m_hWnd);
				}
			}
		}
	}
}
Пример #10
0
void CSubtitleDlDlg::OnOK()
{
	SetStatus(ResStr(IDS_SUBDL_DLG_DOWNLOADING));

	for (int i = 0; i < m_list.GetItemCount(); ++i) {
		if (m_list.GetCheck(i)) {
			m_selsubs.AddTail(*reinterpret_cast<isdb_subtitle*>(m_list.GetItemData(i)));
		}
	}

	m_fReplaceSubs = IsDlgButtonChecked(IDC_CHECK1) == BST_CHECKED;

	CMainFrame* pMF = static_cast<CMainFrame*>(GetParentFrame());

	if (m_fReplaceSubs) {
		pMF->m_pSubStreams.RemoveAll();
	}

	CComPtr<ISubStream> pSubStreamToSet;

	POSITION pos = m_selsubs.GetHeadPosition();

	while (pos) {
		const isdb_subtitle& sub = m_selsubs.GetNext(pos);
		AppSettings& s = AfxGetAppSettings();
		CInternetSession is;
		CStringA url = "http://" + s.strISDb + "/dl.php?";
		CStringA args, ticket, str;
		args.Format("id=%d&ticket=%s", sub.id, UrlEncode(ticket), true);
		url.Append(args);

		if (OpenUrl(is, CString(url), str)) {
			CAutoPtr<CRenderedTextSubtitle> pRTS(DNew CRenderedTextSubtitle(&pMF->m_csSubLock, &s.subdefstyle, s.fUseDefaultSubtitlesStyle));
			if (pRTS && pRTS->Open((BYTE*)(LPCSTR)str, str.GetLength(), DEFAULT_CHARSET, CString(sub.name)) && pRTS->GetStreamCount() > 0) {
				CComPtr<ISubStream> pSubStream = pRTS.Detach();
				pMF->m_pSubStreams.AddTail(pSubStream);

				if (!pSubStreamToSet) {
					pSubStreamToSet = pSubStream;
				}
			}
		}
	}

	if (pSubStreamToSet) {
		pMF->SetSubtitle(pSubStreamToSet);
	}

	__super::OnOK();
}
Пример #11
0
bool UMediaPlayer::Reopen()
{
	if (Playlist != nullptr)
	{
		return OpenPlaylistIndex(Playlist, PlaylistIndex);
	}

	if (!CurrentUrl.IsEmpty())
	{
		OpenUrl(CurrentUrl);
	}

	return false;
}
Пример #12
0
INT_PTR FacebookProto::VisitNotifications(WPARAM, LPARAM)
{
	/*bool useChatRoom = getBool(FACEBOOK_KEY_NOTIFICATIONS_CHATROOM, DEFAULT_NOTIFICATIONS_CHATROOM);

	if (useChatRoom) {
	GCDEST gcd = { m_szModuleName, _T(FACEBOOK_NOTIFICATIONS_CHATROOM), GC_EVENT_CONTROL };
	GCEVENT gce = { sizeof(gce), &gcd };
	CallServiceSync(MS_GC_EVENT, WINDOW_VISIBLE, reinterpret_cast<LPARAM>(&gce));
	}
	else {*/
	OpenUrl(FACEBOOK_URL_NOTIFICATIONS);
	/*}*/

	return 0;
}
Пример #13
0
INT_PTR FacebookProto::VisitFriendship(WPARAM wParam,LPARAM lParam)
{
	MCONTACT hContact = MCONTACT(wParam);

	if (wParam == 0 || !IsMyContact(hContact))
		return 1;

	ptrA id(getStringA(hContact, FACEBOOK_KEY_ID));

	std::string url = FACEBOOK_URL_PROFILE;
	url += facy.self_.user_id;
	url += "&and=" + std::string(id);

	OpenUrl(url);
	return 0;
}
Пример #14
0
void CHyperlink::OnLButtonUp(LPARAM lParam)
{
	ReleaseCapture();
	if(m_IsClicked)
	{
		m_IsClicked = FALSE;
		CPoint pt;
		pt.x = (short)LOWORD(lParam);
		pt.y = (short)HIWORD(lParam);
		ClientToScreen(pt);
		CRect rc = GetWindowRect(); 

		if (rc.PtInRect(pt)) 
			OpenUrl();
	}
}
Пример #15
0
// read complete forecast
// wParam = current contact
INT_PTR LoadForecast(WPARAM wParam, LPARAM lParam) 
{
	TCHAR id[256], loc2[256];
	GetStationID(wParam, id, SIZEOF(id));
	if (id[0] != 0) {
		// check if the complte forecast URL is set. If it is not, display warning and quit
		if (DBGetStaticString(wParam, WEATHERPROTONAME, "InfoURL", loc2, SIZEOF(loc2)) || loc2[0] == 0) {
			MessageBox(NULL, TranslateT("The URL for complete forecast have not been set. You can set it from the Edit Settings dialog."), 
				TranslateT("Weather Protocol"), MB_ICONINFORMATION);
			return 1;
		}
		// set the url and open the webpage
		OpenUrl(loc2, id );
	}
	return 0;
}
Пример #16
0
bool UMediaPlayer::OpenFile(const FString& FilePath)
{
	FString FullPath;
	
	if (FPaths::IsRelative(FilePath))
	{
		FullPath = FPaths::ConvertRelativePathToFull(FilePath);
	}
	else
	{
		FullPath = FilePath;
		FPaths::NormalizeFilename(FullPath);
	}

	return OpenUrl(FString(TEXT("file://")) + FullPath);
}
Пример #17
0
INT_PTR FacebookProto::VisitConversation(WPARAM wParam, LPARAM)
{
	MCONTACT hContact = MCONTACT(wParam);

	if (wParam == 0 || !IsMyContact(hContact, true))
		return 1;

	bool isChat = isChatRoom(hContact);
	ptrA id(getStringA(hContact, isChat ? FACEBOOK_KEY_TID : FACEBOOK_KEY_ID));
	if (id == NULL)
		return 1;

	std::string url = FACEBOOK_URL_CONVERSATION + std::string(isChat ? "conversation-" : "") + std::string(id);

	OpenUrl(url);
	return 0;
}
Пример #18
0
void OpenContactInbox(LPCSTR szModuleName)
{
	ptrT tszJid(db_get_tsa(0, szModuleName, "jid"));
	if (tszJid == NULL)
		return;

	LPTSTR host = _tcschr(tszJid, '@');
	if (!host)
		return;
	*host++ = 0;

	TCHAR buf[1024];
	if (mir_tstrcmpi(host, COMMON_GMAIL_HOST1) && mir_tstrcmpi(host, COMMON_GMAIL_HOST2))
		mir_sntprintf(buf, INBOX_URL_FORMAT, _T("a/"), host);   // hosted
	else
		mir_sntprintf(buf, INBOX_URL_FORMAT, _T(""), _T("mail")); // common
	OpenUrl(szModuleName, tszJid, buf);
}
Пример #19
0
INT_PTR FacebookProto::VisitConversation(WPARAM wParam, LPARAM lParam)
{
	MCONTACT hContact = MCONTACT(wParam);

	if (wParam == 0 || !IsMyContact(hContact, true))
		return 1;

	std::string url = FACEBOOK_URL_CONVERSATION;

	if (isChatRoom(hContact)) {
		url += "conversation-";
		url += ptrA(getStringA(hContact, FACEBOOK_KEY_TID));
	} else {
		url += ptrA(getStringA(hContact, FACEBOOK_KEY_ID));
	}

	OpenUrl(url);
	return 0;
}
Пример #20
0
TCHAR* CAmHttpSocket::GetHeaders(const char *url)
{
	//did we get an url?
	if (url == NULL)
	{
		LastError = -1;
		return NULL;
	}
	//open the url...
	OpenUrl(url);
	//delete old headers...
	if (Headers != NULL) free(Headers);
	Headers = (TCHAR*)calloc(1, sizeof(TCHAR));
	//get the size headers
	DWORD d = 1, d2 = 0;
	int i = HttpQueryInfo(hIS, HTTP_QUERY_RAW_HEADERS, Headers, &d, &d2);
	//alloc some space for the headers
	Headers = (TCHAR*)realloc(Headers, d * sizeof(TCHAR));
	if (!HttpQueryInfo(hIS, HTTP_QUERY_RAW_HEADERS, Headers, &d, &d2)) return NULL;
	return Headers;
}
Пример #21
0
char* CAmHttpSocket::GetPage(const char *url, bool Post, const char *PostData, int PostDataLength)
{
	//did we get an url?
	if (url == NULL)
	{
		LastError = -1;
		return NULL;
	}
	//get the page and store it in ReceivedData...
	if (Post)
	{
		//use http post...
		if (!PostUrl(url, PostData, PostDataLength)) return NULL;
	}
	else
	{
		//use http get
		if (!OpenUrl(url)) return NULL;
	}
	DWORD rd, dwPos = 0;
	while(InternetReadFile(hIS, ReceivedData + dwPos, SIZE_STEP_DEFAULT, &rd))
	{
		if(rd == 0)break;
		if(rd < SIZE_STEP_DEFAULT)
		{
			m_dwLength = dwPos + rd;
			ReceivedData[m_dwLength] = NULL;
			break;
		}
		else
		{
			dwPos += rd;
			m_dwSize = dwPos + SIZE_STEP_DEFAULT;
			ReceivedData = (char*)realloc(ReceivedData, m_dwSize + 1);
			ReceivedData[m_dwSize + 1] = NULL;
		}
	}

	return ReceivedData;
}
Пример #22
0
INT_PTR FacebookProto::VisitProfile(WPARAM wParam,LPARAM lParam)
{
	MCONTACT hContact = MCONTACT(wParam);

	std::string url = FACEBOOK_URL_PROFILE;

	ptrA val(getStringA(hContact, "Homepage"));
	if (val != NULL) {
		// Homepage link already present, get it
		url = val;
	} else {
		// No homepage link, create and save it
		val = getStringA(hContact, FACEBOOK_KEY_ID);
		if (val != NULL) {
			url += val;
			setString(hContact, "Homepage", url.c_str());
		}
	}

	OpenUrl(url);
	return 0;
}
Пример #23
0
	void AboutWindow::documentLabel_ActiveHyperlinkExecuted(::vl::presentation::compositions::GuiGraphicsComposition* sender, ::vl::presentation::compositions::GuiEventArgs* arguments)
	{
		OpenUrl(documentLabel->GetActiveHyperlinkReference());
	}
Пример #24
0
void Login::Login_layout_init()
{
    /*top*/
    Close_Btn = new Push_Btn();
    Min_Btn = new Push_Btn();
    Title_label = new QLabel();
    top_lable = new QLabel();
    top_img = new QMovie();  //Keep
    QFont TitleFont("楷体", 12, QFont::Bold);
    Title_label->setFixedSize(400,35);
    Title_label->setStyleSheet("background-color:rgb(23, 197, 104); color:white;");
    Min_Btn->Load_Pixmap_keven(":/SysButton/min");
    Close_Btn->Load_Pixmap_keven(":/SysButton/close");
    Title_label->setText(tr("Smart L"));
    Title_label->setFont(TitleFont);
    Title_label->setAlignment(Qt::AlignCenter);
    top_layout = new QHBoxLayout();
    top_layout->addWidget(Title_label);
    top_layout->addWidget(Min_Btn);
    top_layout->addWidget(Close_Btn);
    top_layout->setMargin(0);
    top_layout->setSpacing(0);

    /*middle*/
    User_Name = new QLineEdit();
    Passwd = new QLineEdit();
    Regiser_account = new QLabel();
    Forget_Passwd = new  QLabel();
    Auto_login = new QCheckBox();
    Remind_passwd = new QCheckBox();

    User_Name->setPlaceholderText(tr("Account"));
    User_Name->setFixedSize(150, 30);
    Passwd->setPlaceholderText(tr("Passwd"));
    Passwd->setEchoMode(QLineEdit::Password);
    Passwd->setFixedSize(150, 30);
    Regiser_account->setText("<a href = http://blog.csdn.net/ongoingcre>" + tr("Register") + "</a>");
    Regiser_account->setFixedSize(50,30);
    Forget_Passwd->setText("<a href = http://blog.csdn.net/ongoingcre>" + tr("Forget") + "</a>");
    Forget_Passwd->setFixedSize(50,30);
    Auto_login->setText(tr("Auto Login"));
    Auto_login->setFixedSize(100,30);
    Remind_passwd->setText(tr("Remind Passwd"));
    Remind_passwd->setFixedSize(100,30);
    //Regiser_account->setStyleSheet("background-color:red");

    middle_layout = new QGridLayout();
    middle_layout->addWidget(User_Name,0,0,Qt::AlignCenter);
    middle_layout->addWidget(Regiser_account,0,1,Qt::AlignRight);
    middle_layout->addWidget(Passwd,1,0,Qt::AlignCenter);
    middle_layout->addWidget(Forget_Passwd,1,1,Qt::AlignRight);
    middle_layout->addWidget(Auto_login,2,0,Qt::AlignCenter);
    middle_layout->addWidget(Remind_passwd,2,1,Qt::AlignCenter);
    //middle_layout->setMargin(0);
    middle_layout->setSpacing(25);
    middle_layout->setContentsMargins(100,75,80,15);
    middle_layout->setColumnStretch(6,1);


    /*bottom*/
    Login_Btn = new Bottom_Btn();
    Qrcode_Btn = new QPushButton();
    Qrcode_Btn->setFixedSize(35,25);
    Qrcode_Btn->setCursor(QCursor(Qt::PointingHandCursor));
    //Login_Btn->setFixedSize(200,35);
    Qrcode = new QLabel();
    Qrcode->setFixedSize(65,35);

    Login_Btn->Load_Beside_img("",tr("Login"),200,35,25);
    Login_Btn->setShortcut(Qt::Key_Enter);  //设置快捷键为Enter
    Login_Btn->setShortcut(QKeySequence::InsertParagraphSeparator); //回车快捷键
    Login_Btn->setFocus();
    QFont BottomFont("楷体", 10.5, QFont::Bold);
    Login_Btn->setFont(BottomFont);
    Qrcode_Btn->setIcon(QIcon(":/Mainmenu/qrcode"));
    Qrcode_Btn->setFlat(true);

    bottom_layout = new QHBoxLayout();
    //bottom_layout->addStretch(0);
    bottom_layout->addWidget(Login_Btn);
    bottom_layout->addWidget(Qrcode);
    bottom_layout->addWidget(Qrcode_Btn);
    bottom_layout->setMargin(0);
    bottom_layout->setSpacing(0);
    bottom_layout->setContentsMargins(100,0,0,15);
/**/
    page_1_login = new QWidget(this);
    page_1_login->setLayout(middle_layout);
    page_1_login->setStyleSheet("background-color:white");

    main_layout = new QStackedLayout();
    main_layout->addWidget(page_1_login);
    main_layout->addWidget(page_2_qrcode);
    main_layout->setMargin(0);
    main_layout->setSpacing(0);
    main_layout->setCurrentWidget(page_1_login);


    /*main layout*/
    layout = new QVBoxLayout(this);
    layout->addLayout(top_layout);
    layout->addLayout(main_layout);
    layout->addLayout(bottom_layout);
    //layout->addStretch(0);
    layout->setMargin(0);
    layout->setSpacing(0);
    this->setLayout(layout);


    /*自动补全*/
    QStringList word_list;
    word_list<<"admin"<<"user";
    m_completer = new QCompleter(word_list, this);
    m_completer->setCaseSensitivity(Qt::CaseInsensitive);
    User_Name->setCompleter(m_completer);
    /*SIGNAL TO SLOT*/
    connect(Close_Btn,SIGNAL(clicked()),this,SLOT(close()));
    connect(Regiser_account,SIGNAL(linkActivated(QString)),this,SLOT(OpenUrl(QString )));
    connect(Forget_Passwd,SIGNAL(linkActivated(QString)),this,SLOT(OpenUrl(QString )));
    connect(Login_Btn,SIGNAL(clicked()),this,SLOT(Login_response()));
    connect(Min_Btn,SIGNAL(clicked()),this,SLOT(hide()));
    connect(Qrcode_Btn,SIGNAL(clicked()),this,SLOT(Qrcode_Btn_clicked()));
}
Пример #25
0
void CAboutDlg::OnBnClickedProjectShizukuBellche()
{
	OpenUrl(URL_BELLCHE);
}
Пример #26
0
void CAboutDlg::OnBnClickedProjectShizukuOpensourcechannel()
{
	OpenUrl(URL_OPENSOURCECHANNEL);
}
Пример #27
0
void CAboutDlg::OnBnClickedProjectShizukuLinuxhajapan()
{
	OpenUrl(URL_LINUXHAJAPAN);
}
Пример #28
0
void CAboutDlg::OnBnClickedProjectShizukuKirinokasumu()
{
	OpenUrl(URL_KIRINOKASUMU);
}
Пример #29
0
void CSubtitleDlDlg::OnOK()
{
	SetStatus(ResStr(IDS_SUBDL_DLG_DOWNLOADING));

	for (int i = 0; i < m_list.GetItemCount(); ++i) {
		if (m_list.GetCheck(i)) {
			m_selsubs.AddTail(*reinterpret_cast<isdb_subtitle*>(m_list.GetItemData(i)));
		}
	}

	m_fReplaceSubs = IsDlgButtonChecked(IDC_CHECK1) == BST_CHECKED;

	CMainFrame* pMF = static_cast<CMainFrame*>(GetParentFrame());

	if (m_fReplaceSubs) {
		pMF->m_pSubStreams.RemoveAll();
	}

	CComPtr<ISubStream> pSubStreamToSet;

	POSITION pos = m_selsubs.GetHeadPosition();

	while (pos) {
		const isdb_subtitle& sub = m_selsubs.GetNext(pos);
		AppSettings& s = AfxGetAppSettings();
		CInternetSession is;
		CStringA url = "http://" + s.strISDb + "/dl.php?";
		CStringA args, ticket, str;
		args.Format("id=%d&ticket=%s", sub.id, UrlEncode(ticket));
		url.Append(args);

		if (OpenUrl(is, CString(url), str)) {

			if (pMF->b_UseVSFilter) {
				if (CComQIPtr<IDirectVobSub> pDVS = pMF->GetVSFilter()) {
					TCHAR lpszTempPath[_MAX_PATH] = { 0 };
					if (::GetTempPath(_MAX_PATH, lpszTempPath)) {
						CString subFileName(lpszTempPath);
						subFileName.Append(CString(sub.name));
						if (::PathFileExists(subFileName)) {
							::DeleteFile(subFileName);
						}

						CFile cf;
						if (cf.Open(subFileName, CFile::modeCreate|CFile::modeWrite|CFile::shareDenyNone)) {
							cf.Write(str.GetString(), str.GetLength());
							cf.Close();

							if (SUCCEEDED(pDVS->put_FileName((LPWSTR)(LPCWSTR)subFileName))) {
								pDVS->put_SelectedLanguage(0);
								pDVS->put_HideSubtitles(true);
								pDVS->put_HideSubtitles(false);
							}

							::DeleteFile(subFileName);
						}
					}

					__super::OnOK();
					return;
				}
			}

			CAutoPtr<CRenderedTextSubtitle> pRTS(DNew CRenderedTextSubtitle(&pMF->m_csSubLock, &s.subdefstyle, s.fUseDefaultSubtitlesStyle));
			if (pRTS && pRTS->Open((BYTE*)(LPCSTR)str, str.GetLength(), DEFAULT_CHARSET, CString(sub.name)) && pRTS->GetStreamCount() > 0) {
				CComPtr<ISubStream> pSubStream = pRTS.Detach();
				pMF->m_pSubStreams.AddTail(pSubStream);

				if (!pSubStreamToSet) {
					pSubStreamToSet = pSubStream;
				}
			}
		}
	}

	if (pSubStreamToSet) {
		pMF->SetSubtitle(pSubStreamToSet);

		AfxGetAppSettings().fEnableSubtitles = true;
	}

	__super::OnOK();
}
Пример #30
0
INT_PTR CALLBACK GeneralPageDialogProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) {
  int updatestrings = 0;
  if (msg == WM_INITDIALOG) {
    wchar_t txt[20];
    GetPrivateProfileString(L"General", L"AutoFocus", L"0", txt, ARRAY_SIZE(txt), inipath);
    Button_SetCheck(GetDlgItem(hwnd,IDC_AUTOFOCUS), _wtoi(txt)?BST_CHECKED:BST_UNCHECKED);

    GetPrivateProfileString(L"General", L"Aero", L"2", txt, ARRAY_SIZE(txt), inipath);
    Button_SetCheck(GetDlgItem(hwnd,IDC_AERO), _wtoi(txt)?BST_CHECKED:BST_UNCHECKED);

    GetPrivateProfileString(L"General", L"InactiveScroll", L"1", txt, ARRAY_SIZE(txt), inipath);
    Button_SetCheck(GetDlgItem(hwnd,IDC_INACTIVESCROLL), _wtoi(txt)?BST_CHECKED:BST_UNCHECKED);

    GetPrivateProfileString(L"General", L"MDI", L"0", txt, ARRAY_SIZE(txt), inipath);
    Button_SetCheck(GetDlgItem(hwnd,IDC_MDI), _wtoi(txt)?BST_CHECKED:BST_UNCHECKED);

    HWND control = GetDlgItem(hwnd, IDC_LANGUAGE);
    ComboBox_ResetContent(control);
    if (l10n == &l10n_ini) {
      ComboBox_AddString(control, l10n->lang);
      ComboBox_SetCurSel(control, 0);
      ComboBox_Enable(control, FALSE);
    }
    else {
      ComboBox_Enable(control, TRUE);
      int i;
      for (i=0; i < ARRAY_SIZE(languages); i++) {
        ComboBox_AddString(control, languages[i]->lang);
        if (l10n == languages[i]) {
          ComboBox_SetCurSel(control, i);
        }
      }
    }

    Button_Enable(GetDlgItem(hwnd,IDC_ELEVATE), vista && !elevated);
  }
  else if (msg == WM_COMMAND) {
    int id = LOWORD(wParam);
    int event = HIWORD(wParam);
    HWND control = GetDlgItem(hwnd, id);
    int val = Button_GetCheck(control);
    wchar_t txt[10];

    if (id == IDC_AUTOFOCUS) {
      WritePrivateProfileString(L"General", L"AutoFocus", _itow(val,txt,10), inipath);
    }
    else if (id == IDC_AUTOSNAP && event == CBN_SELCHANGE) {
      val = ComboBox_GetCurSel(control);
      WritePrivateProfileString(L"General", L"AutoSnap", _itow(val,txt,10), inipath);
    }
    else if (id == IDC_AERO) {
      WritePrivateProfileString(L"General", L"Aero", _itow(val,txt,10), inipath);
    }
    else if (id == IDC_INACTIVESCROLL) {
      WritePrivateProfileString(L"General", L"InactiveScroll", _itow(val,txt,10), inipath);
    }
    else if (id == IDC_MDI) {
      WritePrivateProfileString(L"General", L"MDI", _itow(val,txt,10), inipath);
    }
    else if (id == IDC_LANGUAGE && event == CBN_SELCHANGE) {
      int i = ComboBox_GetCurSel(control);
      if (i == ARRAY_SIZE(languages)) {
        OpenUrl(L"https://stefansundin.github.io/altdrag/doc/translate.html");
        for (i=0; l10n != languages[i]; i++) {}
        ComboBox_SetCurSel(control, i);
      }
      else {
        l10n = languages[i];
        WritePrivateProfileString(L"General", L"Language", l10n->code, inipath);
        updatestrings = 1;
        UpdateStrings();
      }
    }
    else if (id == IDC_AUTOSTART) {
      SetAutostart(val, 0, 0);
      Button_Enable(GetDlgItem(hwnd,IDC_AUTOSTART_HIDE), val);
      Button_Enable(GetDlgItem(hwnd,IDC_AUTOSTART_ELEVATE), val && vista);
      if (!val) {
        Button_SetCheck(GetDlgItem(hwnd,IDC_AUTOSTART_HIDE), BST_UNCHECKED);
        Button_SetCheck(GetDlgItem(hwnd,IDC_AUTOSTART_ELEVATE), BST_UNCHECKED);
      }
    }
    else if (id == IDC_AUTOSTART_HIDE) {
      int elevate = Button_GetCheck(GetDlgItem(hwnd,IDC_AUTOSTART_ELEVATE));
      SetAutostart(1, val, elevate);
    }
    else if (id == IDC_AUTOSTART_ELEVATE) {
      int hide = Button_GetCheck(GetDlgItem(hwnd,IDC_AUTOSTART_HIDE));
      SetAutostart(1, hide, val);
      if (val) {
        // Don't nag if UAC is disabled, only check if elevated
        DWORD uac_enabled = 1;
        if (elevated) {
          DWORD len = sizeof(uac_enabled);
          HKEY key;
          RegOpenKeyEx(HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\System", 0, KEY_QUERY_VALUE, &key);
          RegQueryValueEx(key, L"EnableLUA", NULL, NULL, (LPBYTE)&uac_enabled, &len);
          RegCloseKey(key);
        }
        if (uac_enabled) {
          MessageBox(NULL, l10n->general_autostart_elevate_tip, APP_NAME, MB_ICONINFORMATION|MB_OK);
        }
      }
    }
    else if (id == IDC_ELEVATE && MessageBox(NULL,l10n->general_elevate_tip,APP_NAME,MB_ICONINFORMATION|MB_OK)) {
      wchar_t path[MAX_PATH];
      GetModuleFileName(NULL, path, ARRAY_SIZE(path));
      if ((INT_PTR)ShellExecute(NULL,L"runas",path,L"-config -multi",NULL,SW_SHOWNORMAL) > 32) {
        PostMessage(g_hwnd, WM_CLOSE, 0, 0);
      }
      else {
        MessageBox(NULL, l10n->general_elevation_aborted, APP_NAME, MB_ICONINFORMATION|MB_OK);
      }
      return;
    }
    UpdateSettings();
  }
  else if (msg == WM_NOTIFY) {
    LPNMHDR pnmh = (LPNMHDR) lParam;
    if (pnmh->code == PSN_SETACTIVE) {
      updatestrings = 1;

      // Autostart
      int autostart=0, hidden=0, elevated=0;
      CheckAutostart(&autostart, &hidden, &elevated);
      Button_SetCheck(GetDlgItem(hwnd,IDC_AUTOSTART), autostart?BST_CHECKED:BST_UNCHECKED);
      Button_SetCheck(GetDlgItem(hwnd,IDC_AUTOSTART_HIDE), hidden?BST_CHECKED:BST_UNCHECKED);
      Button_SetCheck(GetDlgItem(hwnd,IDC_AUTOSTART_ELEVATE), elevated?BST_CHECKED:BST_UNCHECKED);
      Button_Enable(GetDlgItem(hwnd,IDC_AUTOSTART_HIDE), autostart);
      Button_Enable(GetDlgItem(hwnd,IDC_AUTOSTART_ELEVATE), autostart && vista);
    }
  }
  if (updatestrings) {
    // Update text
    SetDlgItemText(hwnd, IDC_GENERAL_BOX,        l10n->general_box);
    SetDlgItemText(hwnd, IDC_AUTOFOCUS,          l10n->general_autofocus);
    SetDlgItemText(hwnd, IDC_AERO,               l10n->general_aero);
    SetDlgItemText(hwnd, IDC_INACTIVESCROLL,     l10n->general_inactivescroll);
    SetDlgItemText(hwnd, IDC_MDI,                l10n->general_mdi);
    SetDlgItemText(hwnd, IDC_AUTOSNAP_HEADER,    l10n->general_autosnap);
    SetDlgItemText(hwnd, IDC_LANGUAGE_HEADER,    l10n->general_language);
    SetDlgItemText(hwnd, IDC_AUTOSTART_BOX,      l10n->general_autostart_box);
    SetDlgItemText(hwnd, IDC_AUTOSTART,          l10n->general_autostart);
    SetDlgItemText(hwnd, IDC_AUTOSTART_HIDE,     l10n->general_autostart_hide);
    SetDlgItemText(hwnd, IDC_AUTOSTART_ELEVATE,  l10n->general_autostart_elevate);
    SetDlgItemText(hwnd, IDC_ELEVATE,            (elevated?l10n->general_elevated:l10n->general_elevate));
    SetDlgItemText(hwnd, IDC_AUTOSAVE,           l10n->general_autosave);

    // AutoSnap
    HWND control = GetDlgItem(hwnd, IDC_AUTOSNAP);
    ComboBox_ResetContent(control);
    ComboBox_AddString(control, l10n->general_autosnap0);
    ComboBox_AddString(control, l10n->general_autosnap1);
    ComboBox_AddString(control, l10n->general_autosnap2);
    ComboBox_AddString(control, l10n->general_autosnap3);
    wchar_t txt[10];
    GetPrivateProfileString(L"General", L"AutoSnap", L"0", txt, ARRAY_SIZE(txt), inipath);
    ComboBox_SetCurSel(control, _wtoi(txt));

    // Language
    control = GetDlgItem(hwnd, IDC_LANGUAGE);
    ComboBox_DeleteString(control, ARRAY_SIZE(languages));
    if (l10n == &en_US) {
      ComboBox_AddString(control, L"How can I help translate?");
    }
  }
  return FALSE;
}