コード例 #1
0
ファイル: events.cpp プロジェクト: truefriend-cz/miranda-ng
int ContactStatusChanged(WPARAM wParam, LPARAM lParam)
{
	MCONTACT hContact = (MCONTACT) wParam;
	WORD newStatus = HIWORD(lParam);
	DWORD ann=db_get_dw(NULL,THIS_MODULE,"announce", DEFAULT_ANNOUNCE);

	logmsg("ContactStatusChanged1");

	if (!db_get_b(NULL,THIS_MODULE, "a_user", DEFAULT_ANNOUNCESTATUS))
		return 0;

	if (!(db_get_dw(NULL,THIS_MODULE,"showWhen", DEFAULT_SHOWWHEN)&(1<<(db_get_w(NULL, "CList", "Status", ID_STATUS_OFFLINE)-ID_STATUS_OFFLINE))))
		return 0;

	if (!(ann&(1<<(newStatus-ID_STATUS_OFFLINE))) )
		return 0;
	
	logmsg("ContactStatusChanged2");

	if (db_get_b(hContact,"CList","NotOnList",0) || db_get_b(hContact,"CList","Hidden",0) || 
		(CallService(MS_IGNORE_ISIGNORED,wParam,IGNOREEVENT_USERONLINE) && newStatus==ID_STATUS_ONLINE)
	)
		return 0;

	TCHAR bufferW[512];
	mir_sntprintf(bufferW, TranslateT("%s is %s"), pcli->pfnGetContactDisplayName(wParam, 0), pcli->pfnGetStatusModeDescription(newStatus, 0));
	ShowOSD(bufferW, 0, db_get_dw(NULL,THIS_MODULE, "clr_status", DEFAULT_CLRSTATUS), hContact);
	return 0;
}
コード例 #2
0
ファイル: events.cpp プロジェクト: 0xmono/miranda-ng
int ContactStatusChanged(WPARAM wParam, LPARAM lParam)
{
	MCONTACT hContact = (MCONTACT) wParam;
	WORD oldStatus = LOWORD(lParam);
	WORD newStatus = HIWORD(lParam);
	DWORD ann=db_get_dw(NULL,THIS_MODULE,"announce", DEFAULT_ANNOUNCE);

	logmsg("ContactStatusChanged1");

	if (!db_get_b(NULL,THIS_MODULE, "a_user", DEFAULT_ANNOUNCESTATUS))
		return 0;

	if (!(db_get_dw(NULL,THIS_MODULE,"showWhen", DEFAULT_SHOWWHEN)&(1<<(db_get_w(NULL, "CList", "Status", ID_STATUS_OFFLINE)-ID_STATUS_OFFLINE))))
		return 0;

	if (!(ann&(1<<(newStatus-ID_STATUS_OFFLINE))) )
		return 0;
	
	logmsg("ContactStatusChanged2");

	if (db_get_b(hContact,"CList","NotOnList",0) || db_get_b(hContact,"CList","Hidden",0) || 
		(CallService(MS_IGNORE_ISIGNORED,wParam,IGNOREEVENT_USERONLINE) && newStatus==ID_STATUS_ONLINE)
	)
		return 0;

	TCHAR bufferW[512];
	mir_sntprintf(bufferW, SIZEOF(bufferW), TranslateT("%s is %s"), CallService(MS_CLIST_GETCONTACTDISPLAYNAME, wParam, GCDNF_TCHAR), CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION,newStatus,GSMDF_TCHAR));
	ShowOSD(bufferW, 0, db_get_dw(NULL,THIS_MODULE, "clr_status", DEFAULT_CLRSTATUS), hContact);
	return 0;
}
コード例 #3
0
ファイル: events.cpp プロジェクト: truefriend-cz/miranda-ng
int ProtoAck(WPARAM,LPARAM lparam)
{
	ACKDATA *ack=(ACKDATA *)lparam;
	
	logmsg("ProtoAck");

	if (!db_get_b(NULL,THIS_MODULE, "a_user", DEFAULT_ANNOUNCESTATUS))
		return 0;

	if (!(db_get_dw(NULL,THIS_MODULE,"showWhen", DEFAULT_SHOWWHEN)&(1<<(db_get_w(NULL, "CList", "Status", ID_STATUS_OFFLINE)-ID_STATUS_OFFLINE))))
		return 0;

	if ( ack->type == ACKTYPE_STATUS ) {
		if (!db_get_b(NULL,THIS_MODULE, "showMyStatus", DEFAULT_SHOWMYSTATUS))
			return 0;

		if ( ack->result == ACKRESULT_SUCCESS && (LPARAM)ack->hProcess != ack->lParam ) {
			DWORD ann = db_get_dw( NULL, THIS_MODULE, "announce", DEFAULT_ANNOUNCE );
			if ( ann & ( 1 << ( ack->lParam - ID_STATUS_OFFLINE ))) {
				TCHAR buffer[512];
				mir_sntprintf(buffer, TranslateT("%s is %s"), pcli->pfnGetContactDisplayName(ack->hContact, 0), pcli->pfnGetStatusModeDescription(ack->lParam, 0));
				ShowOSD(buffer, 0, db_get_dw(NULL,THIS_MODULE, "clr_status", DEFAULT_CLRSTATUS), ack->hContact);
	}	}	}

	return 0;
}
コード例 #4
0
ファイル: events.cpp プロジェクト: 0xmono/miranda-ng
int ProtoAck(WPARAM,LPARAM lparam)
{
	ACKDATA *ack=(ACKDATA *)lparam;
	
	logmsg("ProtoAck");

	if (!db_get_b(NULL,THIS_MODULE, "a_user", DEFAULT_ANNOUNCESTATUS))
		return 0;

	if (!(db_get_dw(NULL,THIS_MODULE,"showWhen", DEFAULT_SHOWWHEN)&(1<<(db_get_w(NULL, "CList", "Status", ID_STATUS_OFFLINE)-ID_STATUS_OFFLINE))))
		return 0;

	if ( ack->type == ACKTYPE_STATUS ) {
		if (!db_get_b(NULL,THIS_MODULE, "showMyStatus", DEFAULT_SHOWMYSTATUS))
			return 0;

		if ( ack->result == ACKRESULT_SUCCESS && (LPARAM)ack->hProcess != ack->lParam ) {
			DWORD ann = db_get_dw( NULL, THIS_MODULE, "announce", DEFAULT_ANNOUNCE );
			if ( ann & ( 1 << ( ack->lParam - ID_STATUS_OFFLINE ))) {
				TCHAR buffer[512];
				mir_sntprintf(buffer, SIZEOF(buffer), TranslateT("%s is %s"), CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)ack->hContact, GCDNF_TCHAR), CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION,(WPARAM) ack->lParam,GSMDF_TCHAR));
				ShowOSD(buffer, 0, db_get_dw(NULL,THIS_MODULE, "clr_status", DEFAULT_CLRSTATUS), ack->hContact);
	}	}	}

	return 0;
}
コード例 #5
0
ファイル: MediaPlayer.cpp プロジェクト: vincent0629/GoodMedia
//implement IWindowListener
LRESULT CMediaPlayer::WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
	int i;

	switch (uMsg)
	{
		case WM_PAINT:
			if (m_nState != STATE_PLAY)
			{
				for (i = 0; i < m_nThreadNum; i++)
					if (m_pThreadParams[i].type == RENDER_TYPE_VIDEO)
					{
						m_pThreadParams[i].pRenderer->Write(NULL, 0);  //repaint the last frame
						break;
					}
				if (m_nState == STATE_PAUSE)
					ShowOSD();
				return 0;
			}
			break;
		//custom message
		case WM_PLAY_COMPLETED:
			Stop();
			if (m_pListener != NULL)
				m_pListener->PlayCompleted(this);
			return 0;
	}  //switch
	return 1;
}
コード例 #6
0
GlobalShortcuts::GlobalShortcuts(QObject *parent)
  : QObject(parent),
    gnome_backend_(NULL),
    system_backend_(NULL),
    use_gnome_(false),
    rating_signals_mapper_(new QSignalMapper(this))
{
  settings_.beginGroup(kSettingsGroup);

  // Create actions
  AddShortcut("play", tr("Play"), SIGNAL(Play()));
  AddShortcut("pause", tr("Pause"), SIGNAL(Pause()));
  AddShortcut("play_pause", tr("Play/Pause"), SIGNAL(PlayPause()), QKeySequence(Qt::Key_MediaPlay));
  AddShortcut("stop", tr("Stop"), SIGNAL(Stop()), QKeySequence(Qt::Key_MediaStop));
  AddShortcut("stop_after", tr("Stop playing after current track"), SIGNAL(StopAfter()));
  AddShortcut("next_track", tr("Next track"), SIGNAL(Next()), QKeySequence(Qt::Key_MediaNext));
  AddShortcut("prev_track", tr("Previous track"), SIGNAL(Previous()), QKeySequence(Qt::Key_MediaPrevious));
  AddShortcut("inc_volume", tr("Increase volume"), SIGNAL(IncVolume()));
  AddShortcut("dec_volume", tr("Decrease volume"), SIGNAL(DecVolume()));
  AddShortcut("mute", tr("Mute"), SIGNAL(Mute()));
  AddShortcut("seek_forward", tr("Seek forward"), SIGNAL(SeekForward()));
  AddShortcut("seek_backward", tr("Seek backward"), SIGNAL(SeekBackward()));
  AddShortcut("show_hide", tr("Show/Hide"), SIGNAL(ShowHide()));
  AddShortcut("show_osd", tr("Show OSD"), SIGNAL(ShowOSD()));
  AddShortcut("toggle_pretty_osd", tr("Toggle Pretty OSD"), SIGNAL(TogglePrettyOSD())); // Toggling possible only for pretty OSD
  AddShortcut("shuffle_mode", tr("Change shuffle mode"), SIGNAL(CycleShuffleMode()));
  AddShortcut("repeat_mode", tr("Change repeat mode"), SIGNAL(CycleRepeatMode()));
  AddShortcut("toggle_last_fm_scrobbling", tr("Enable/disable Last.fm scrobbling"), SIGNAL(ToggleScrobbling()));
  AddShortcut("global_search_popup", tr("Show Global Search Popup"), SIGNAL(ShowGlobalSearch()));

  AddRatingShortcut("rate_zero_star", tr("Rate the current song 0 stars"), rating_signals_mapper_, 0);
  AddRatingShortcut("rate_one_star", tr("Rate the current song 1 star"), rating_signals_mapper_, 1);
  AddRatingShortcut("rate_two_star", tr("Rate the current song 2 stars"), rating_signals_mapper_, 2);
  AddRatingShortcut("rate_three_star", tr("Rate the current song 3 stars"), rating_signals_mapper_, 3);
  AddRatingShortcut("rate_four_star", tr("Rate the current song 4 stars"), rating_signals_mapper_, 4);
  AddRatingShortcut("rate_five_star", tr("Rate the current song 5 stars"), rating_signals_mapper_, 5);

  connect(rating_signals_mapper_, SIGNAL(mapped(int)), SIGNAL(RateCurrentSong(int)));

  // Create backends - these do the actual shortcut registration
  gnome_backend_ = new GnomeGlobalShortcutBackend(this);

#ifndef Q_OS_DARWIN
  system_backend_ = new QxtGlobalShortcutBackend(this);
#else
  system_backend_ = new MacGlobalShortcutBackend(this);
#endif

  ReloadSettings();
}
コード例 #7
0
ファイル: MediaPlayer.cpp プロジェクト: vincent0629/GoodMedia
void CMediaPlayer::Pause(void)
{
	int i;

	if (m_nState != STATE_PLAY)
		return;

	m_nState = STATE_PAUSE;
	m_pClock->Pause();  //pause clock
	for (i = 0; i < m_nThreadNum; i++)  //pause all play threads
		m_pSemaphore->Wait();
	for (i = 0; i < m_nThreadNum; i++)
		if (m_pThreadParams[i].type == RENDER_TYPE_MIDI)
			m_pThreadParams[i].pRenderer->Flush(false);  //MIDI renderer must be flushed to turn off all notes

	ShowOSD();
}
コード例 #8
0
ファイル: events.cpp プロジェクト: truefriend-cz/miranda-ng
int HookedNewEvent(WPARAM wParam, LPARAM hDBEvent)
{
	logmsg("HookedNewEvent1");
	DBEVENTINFO dbe;
	dbe.cbSize = sizeof(dbe);
	dbe.cbBlob = db_event_getBlobSize(hDBEvent);
	if (dbe.cbBlob == -1)
		return 0;

	dbe.pBlob = (PBYTE) malloc(dbe.cbBlob);
	if(db_event_get(hDBEvent,&dbe))
		return 0;

	if (dbe.flags & DBEF_SENT)
	    return 0;

	if (db_get_b(NULL,THIS_MODULE, "messages", DEFAULT_ANNOUNCEMESSAGES)==0)
		return 0;

	if (!(db_get_dw(NULL,THIS_MODULE,"showWhen", DEFAULT_SHOWWHEN)&(1<<(db_get_w(NULL, "CList", "Status", ID_STATUS_OFFLINE)-ID_STATUS_OFFLINE))))
		return 0;
	
	logmsg("HookedNewEvent2");

	TCHAR buf[512];
	_tcsncpy(buf, DEFAULT_MESSAGEFORMAT,_countof(buf));

	DBVARIANT dbv;
	if(!db_get_ts(NULL,THIS_MODULE,"message_format",&dbv)) {
		mir_tstrcpy(buf, dbv.ptszVal);
		db_free(&dbv);
	}

	int i1=-1, i2=-1;
	TCHAR* pbuf = buf;
	while (*pbuf) {
		if (*pbuf=='%') {
			if (*(pbuf+1)=='n') {
				if (i1==-1)
					i1=1;
				else i2=1;
				*(pbuf+1)='s';
			} else if (*(pbuf+1)=='m') {
				if (i1==-1)
					i1=2;
				else i2=2;
				*(pbuf+1)='s';
			} else if (*(pbuf+1)=='l') {
				*pbuf=0x0d;
				*(pbuf+1)=0x0a;
			}
		}
		pbuf++;
	}

	TCHAR *c1 = 0, *c2 = 0;
	if ( i1 == 1 )
		c1 = mir_tstrdup(pcli->pfnGetContactDisplayName(wParam, 0));
	else if ( i1 == 2 )
		c1 = DbGetEventTextT( &dbe, 0 );

	if ( i2 == 1 )
		c2 = mir_tstrdup(pcli->pfnGetContactDisplayName(wParam, 0));
	else if ( i2 == 2 )
		c2 = DbGetEventTextT( &dbe, 0 );

	TCHAR buffer[512];
	mir_sntprintf(buffer, buf, c1, c2);
	ShowOSD(buffer, 0, db_get_dw(NULL,THIS_MODULE, "clr_msg", DEFAULT_CLRMSG), wParam);

	mir_free( c1 );
	mir_free( c2 );
	return 0;
}