示例#1
0
RedditModel::RedditModel(const QStringList& reddits, Application* app,
                         QObject* parent)
  : QAbstractItemModel(parent),
    app_(app),
    reddits_(reddits),
    no_image_(QPixmap::fromImage(ScaleAndPad(QImage(":/noimage.png")))),
    network_(new NetworkAccessManager(this)),
    is_fetching_more_(false),
    no_more_links_(false),
    show_self_posts_(false),
    show_viewed_images_(false),
    preload_next_(kDefaultPreloadNext),
    max_preloaded_pages_(kDefaultMaxPreloadedPages)
{
  // Read the user's cookie
  QSettings s;
  s.beginGroup(kSettingsGroup);
  const QString cookie = s.value("cookie").toString();

  if (cookie.isEmpty()) {
    // Not-logged in users are only allowed to get one subreddit.
    while (reddits_.size() > 1) {
      reddits_.removeLast();
    }
  } else {
    network_->cookieJar()->setCookiesFromUrl(
          QList<QNetworkCookie>() << QNetworkCookie(kCookieName, cookie.toAscii()),
          QUrl(kUrlForCookies));
  }

  connect(app_, SIGNAL(SettingsChanged()), SLOT(ReloadSettings()));
  ReloadSettings();
}
PodcastDeleter::PodcastDeleter(Application* app, QObject* parent)
    : QObject(parent),
      app_(app),
      backend_(app_->podcast_backend()),
      delete_after_secs_(0),
      auto_delete_timer_(new QTimer(this)) {
  ReloadSettings();
  auto_delete_timer_->setSingleShot(true);
  AutoDelete();
  connect(auto_delete_timer_, SIGNAL(timeout()), SLOT(AutoDelete()));
  connect(app_, SIGNAL(SettingsChanged()), SLOT(ReloadSettings()));
}
NetworkProxyFactory::NetworkProxyFactory()
  : mode_(Mode_System),
    type_(QNetworkProxy::HttpProxy),
    port_(8080),
    use_authentication_(false)
{
#ifdef Q_OS_LINUX
  // Linux uses environment variables to pass proxy configuration information,
  // which systemProxyForQuery doesn't support for some reason.

  QStringList urls;
  urls << QString::fromLocal8Bit(getenv("HTTP_PROXY"));
  urls << QString::fromLocal8Bit(getenv("http_proxy"));
  urls << QString::fromLocal8Bit(getenv("ALL_PROXY"));
  urls << QString::fromLocal8Bit(getenv("all_proxy"));

  qLog(Debug) << "Detected system proxy URLs:" << urls;

  foreach (const QString& url_str, urls) {
    if (url_str.isEmpty())
      continue;

    env_url_ = QUrl(url_str);
    break;
  }
#endif

  ReloadSettings();
}
示例#4
0
Remote::Remote(Player* player, QObject* parent)
  : QObject(parent),
    player_(player),
    connection_(new xrme::Connection(this)),
    retry_count_(0)
{
  connection_->SetMediaPlayer(this);
  connection_->SetMediaStorage(this);
  connection_->set_verbose(true);
  connect(connection_, SIGNAL(Connected()), SLOT(Connected()));
  connect(connection_, SIGNAL(Disconnected(QString)), SLOT(Disconnected(QString)));

  connect(player_, SIGNAL(Playing()), SLOT(SetStateChanged()));
  connect(player_, SIGNAL(Paused()), SLOT(SetStateChanged()));
  connect(player_, SIGNAL(Stopped()), SLOT(SetStateChanged()));
  connect(player_, SIGNAL(PlaylistFinished()), SLOT(SetStateChanged()));
  connect(player_, SIGNAL(VolumeChanged(int)), SLOT(SetStateChanged()));
  connect(player_, SIGNAL(Seeked(qlonglong)), SLOT(SetStateChanged()));
  connect(player_->playlists(), SIGNAL(CurrentSongChanged(Song)), SLOT(SetStateChanged()));

  connect(connection_,
      SIGNAL(TomahawkSIPReceived(const QVariant&)),
      SLOT(TomahawkSIPReceived(const QVariant&)));

  ReloadSettings();
}
DigitallyImportedServiceBase::DigitallyImportedServiceBase(
    const QString& name, const QString& description, const QUrl& homepage_url,
    const QIcon& icon, const QString& api_service_name, Application* app,
    InternetModel* model, QObject* parent)
    : InternetService(name, app, model, parent),
      homepage_url_(homepage_url),
      icon_(icon),
      service_description_(description),
      api_service_name_(api_service_name),
      network_(new NetworkAccessManager(this)),
      url_handler_(new DigitallyImportedUrlHandler(app, this)),
      basic_audio_type_(1),
      premium_audio_type_(2),
      root_(nullptr),
      saved_channels_(kSettingsGroup, api_service_name,
                      kStreamsCacheDurationSecs),
      api_client_(new DigitallyImportedClient(api_service_name, this)) {
  ReloadSettings();

  model->app()->player()->RegisterUrlHandler(url_handler_);
  model->app()->global_search()->AddProvider(
      new DigitallyImportedSearchProvider(this, app_, this));

  basic_playlists_ << "http://%1/public3/%2.pls"
                   << "http://%1/public1/%2.pls"
                   << "http://%1/public5/%2.asx";

  premium_playlists_ << "http://%1/premium_high/%2.pls?hash=%3"
                     << "http://%1/premium_medium/%2.pls?hash=%3"
                     << "http://%1/premium/%2.pls?hash=%3"
                     << "http://%1/premium_wma_low/%2.asx?hash=%3"
                     << "http://%1/premium_wma/%2.asx?hash=%3";
}
示例#6
0
bool CDefTermHk::isDefaultTerminalAllowed(bool bDontCheckName /*= false*/)
{
	_ASSERTEX((gbPrepareDefaultTerminal==false) || ((gpDefTerm!=NULL) && (this==gpDefTerm)));

	if (!gbPrepareDefaultTerminal || !this)
	{
		_ASSERTEX(gbPrepareDefaultTerminal && this);
		return false;
	}

	DWORD nDelta = (GetTickCount() - mn_LastCheck);
	if (nDelta > SERIALIZE_CHECK_TIMEOUT)
	{
		ReloadSettings();
	}

	// Разрешен ли вообще?
	if (!m_Opt.bUseDefaultTerminal)
		return false;
	// Известны пути?
	if (!m_Opt.pszConEmuExe || !*m_Opt.pszConEmuExe || !m_Opt.pszConEmuBaseDir || !*m_Opt.pszConEmuBaseDir)
		return false;
	// Проверить НАШ exe-шник на наличие в m_Opt.pszzHookedApps
	if (!bDontCheckName && !IsAppMonitored(ms_ExeName))
		return false;
	// Да
	return true;
}
void PlaylistView::SetPlaylist(Playlist* playlist) {
  if (playlist_) {
    disconnect(playlist_, SIGNAL(CurrentSongChanged(Song)),
               this, SLOT(MaybeAutoscroll()));
    disconnect(playlist_, SIGNAL(DynamicModeChanged(bool)),
               this, SLOT(DynamicModeChanged(bool)));
    disconnect(playlist_, SIGNAL(destroyed()), this, SLOT(PlaylistDestroyed()));

    disconnect(dynamic_controls_, SIGNAL(Repopulate()),
               playlist_, SLOT(RepopulateDynamicPlaylist()));
    disconnect(dynamic_controls_, SIGNAL(TurnOff()),
               playlist_, SLOT(TurnOffDynamicPlaylist()));
  }

  playlist_ = playlist;
  LoadGeometry();
  ReloadSettings();
  DynamicModeChanged(playlist->is_dynamic());
  setFocus();
  read_only_settings_ = false;

  connect(playlist_, SIGNAL(RestoreFinished()), SLOT(JumpToLastPlayedTrack()));

  connect(playlist_, SIGNAL(CurrentSongChanged(Song)), SLOT(MaybeAutoscroll()));
  connect(playlist_, SIGNAL(DynamicModeChanged(bool)), SLOT(DynamicModeChanged(bool)));
  connect(playlist_, SIGNAL(destroyed()), SLOT(PlaylistDestroyed()));
  connect(dynamic_controls_, SIGNAL(Repopulate()), playlist_, SLOT(RepopulateDynamicPlaylist()));
  connect(dynamic_controls_, SIGNAL(TurnOff()), playlist_, SLOT(TurnOffDynamicPlaylist()));
}
示例#8
0
LibraryWatcher::LibraryWatcher(QObject* parent)
    : QObject(parent),
      backend_(nullptr),
      task_manager_(nullptr),
      fs_watcher_(FileSystemWatcherInterface::Create(this)),
      stop_requested_(false),
      scan_on_startup_(true),
      monitor_(true),
      rescan_timer_(new QTimer(this)),
      rescan_paused_(false),
      total_watches_(0),
      cue_parser_(new CueParser(backend_, this)) {
  rescan_timer_->setInterval(1000);
  rescan_timer_->setSingleShot(true);

  if (sValidImages.isEmpty()) {
    sValidImages << "jpg"
                 << "png"
                 << "gif"
                 << "jpeg";
  }

  ReloadSettings();

  connect(rescan_timer_, SIGNAL(timeout()), SLOT(RescanPathsNow()));
}
示例#9
0
void OSD::AlbumArtLoaded(const Song& song, const QString& uri,
                         const QImage& image) {
  // Don't change tray icon details if it's a preview
  if (!preview_mode_) {
    tray_icon_->SetNowPlaying(song, uri);
  }

  last_song_ = song;
  last_image_ = image;
  last_image_uri_ = uri;

  QStringList message_parts;
  QString summary;
  if (!use_custom_text_) {
    summary = song.PrettyTitle();
    if (!song.artist().isEmpty())
      summary = QString("%1 - %2").arg(song.artist(), summary);
    if (!song.album().isEmpty()) message_parts << song.album();
    if (song.disc() > 0) message_parts << tr("disc %1").arg(song.disc());
    if (song.track() > 0) message_parts << tr("track %1").arg(song.track());
  } else {
    QRegExp variable_replacer("[%][a-z]+[%]");
    summary = custom_text1_;
    QString message(custom_text2_);

    // Replace the first line
    int pos = 0;
    variable_replacer.indexIn(custom_text1_);
    while ((pos = variable_replacer.indexIn(custom_text1_, pos)) != -1) {
      QStringList captured = variable_replacer.capturedTexts();
      summary.replace(captured[0], ReplaceVariable(captured[0], song));
      pos += variable_replacer.matchedLength();
    }

    // Replace the second line
    pos = 0;
    variable_replacer.indexIn(custom_text2_);
    while ((pos = variable_replacer.indexIn(custom_text2_, pos)) != -1) {
      QStringList captured = variable_replacer.capturedTexts();
      message.replace(captured[0], ReplaceVariable(captured[0], song));
      pos += variable_replacer.matchedLength();
    }
    message_parts << message;
  }

  if (show_art_) {
    ShowMessage(summary, message_parts.join(", "), "notification-audio-play",
                image);
  } else {
    ShowMessage(summary, message_parts.join(", "), "notification-audio-play",
                QImage());
  }

  // Reload the saved settings if they were changed for preview
  if (preview_mode_) {
    ReloadSettings();
    preview_mode_ = false;
  }
}
示例#10
0
SongInfoTextView::SongInfoTextView(QWidget* parent)
    : QTextBrowser(parent), last_width_(-1), recursion_filter_(false) {
  setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
  setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);

  setOpenExternalLinks(true);
  ReloadSettings();
}
示例#11
0
PodcastUpdater::PodcastUpdater(Application* app, QObject* parent)
  : QObject(parent),
    app_(app),
    update_interval_secs_(0),
    update_timer_(new QTimer(this)),
    loader_(new PodcastUrlLoader(this)),
    pending_replies_(0)
{
  connect(app_, SIGNAL(SettingsChanged()), SLOT(ReloadSettings()));
  connect(update_timer_, SIGNAL(timeout()), SLOT(UpdateAllPodcastsNow()));
  connect(app_->podcast_backend(), SIGNAL(SubscriptionAdded(Podcast)),
          SLOT(SubscriptionAdded(Podcast)));

  update_timer_->setSingleShot(true);

  ReloadSettings();
}
示例#12
0
void COptionsPageConnection::OnWizard(wxCommandEvent& event)
{
	CNetConfWizard wizard(GetParent(), m_pOptions);
	if (!wizard.Load())
		return;
	if (wizard.Run())
		ReloadSettings();
}
示例#13
0
void LibraryBackend::Init(Database* db, const QString& songs_table,
                          const QString& dirs_table, const QString& subdirs_table,
                          const QString& fts_table) {
  db_ = db;
  songs_table_ = songs_table;
  dirs_table_ = dirs_table;
  subdirs_table_ = subdirs_table;
  fts_table_ = fts_table;
  ReloadSettings();
}
示例#14
0
void CDefaultTerminal::ApplyAndSave(bool bApply, bool bSaveToReg)
{
	// Get new values from gpSet
	if (bApply)
		ReloadSettings();

	// And save to [HKCU\Software\ConEmu]
	if (bSaveToReg)
		m_Opt.Serialize(true);
}
示例#15
0
HWND CDefTermHk::AllocHiddenConsole(bool bTempForVS)
{
	// функция AttachConsole есть только в WinXP и выше
	AttachConsole_t _AttachConsole = GetAttachConsoleProc();
	if (!_AttachConsole)
	{
		LogHookingStatus(L"Can't create hidden console, function does not exist");
		return NULL;
	}

	LogHookingStatus(L"AllocHiddenConsole");

	ReloadSettings();
	_ASSERTEX(isDefTermEnabled() && (gbIsNetVsHost || bTempForVS));

	if (!isDefTermEnabled())
	{
		// Disabled in settings or registry
		LogHookingStatus(L"Application skipped by settings");
		return NULL;
	}

	HANDLE hSrvProcess = NULL;
	DWORD nAttachPID = bTempForVS ? 0 : gnSelfPID;
	DWORD nSrvPID = StartConsoleServer(nAttachPID, true, &hSrvProcess);
	if (!nSrvPID)
	{
		// Failed to start process?
		return NULL;
	}
	_ASSERTEX(hSrvProcess!=NULL);

	HWND hCreatedCon = NULL;

	// Do while server process is alive
	DWORD nStart = GetTickCount(), nMaxDelta = 30000, nDelta = 0;
	DWORD nWait = WaitForSingleObject(hSrvProcess, 0);
	while (nWait != WAIT_OBJECT_0)
	{
		if (_AttachConsole(nSrvPID))
		{
			hCreatedCon = GetRealConsoleWindow();
			if (hCreatedCon)
				break;
		}

		nWait = WaitForSingleObject(hSrvProcess, 150);

		nDelta = (GetTickCount() - nStart);
		if (nDelta > nMaxDelta)
			break;
	}

	return hCreatedCon;
}
示例#16
0
CDefTermHk::CDefTermHk()
	: CDefTermBase(false)
{
	mh_StopEvent = CreateEvent(NULL, TRUE, FALSE, NULL);

	wchar_t szSelfName[MAX_PATH+1] = L"";
	GetModuleFileName(NULL, szSelfName, countof(szSelfName));
	lstrcpyn(ms_ExeName, PointToName(szSelfName), countof(ms_ExeName));

	mn_LastCheck = 0;
	ReloadSettings();
}
示例#17
0
SomaFMService::SomaFMService(Application* app, InternetModel* parent)
  : InternetService(kServiceName, app, parent, parent),
    url_handler_(new SomaFMUrlHandler(app, this, this)),
    root_(NULL),
    context_menu_(NULL),
    network_(new NetworkAccessManager(this)),
    streams_(kSettingsGroup, "streams", kStreamsCacheDurationSecs)
{
  ReloadSettings();

  app_->player()->RegisterUrlHandler(url_handler_);
  app_->global_search()->AddProvider(new SomaFMSearchProvider(this, app_, this));
}
SongKickConcertWidget::SongKickConcertWidget(QWidget* parent)
  : QWidget(parent),
    ui_(new Ui_SongKickConcertWidget),
    network_(new NetworkAccessManager(this))
{
  ui_->setupUi(this);

  // Hide the map by default
  ui_->map->hide();
  ui_->map->setFixedSize(kStaticMapWidth, kStaticMapHeight);
  ui_->map->installEventFilter(this);

  ReloadSettings();
}
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();
}
示例#20
0
LibraryViewContainer::LibraryViewContainer(QWidget* parent)
    : QWidget(parent), ui_(new Ui_LibraryViewContainer) {
  ui_->setupUi(this);
  view()->SetFilter(filter());

  connect(filter(), SIGNAL(UpPressed()), view(), SLOT(UpAndFocus()));
  connect(filter(), SIGNAL(DownPressed()), view(), SLOT(DownAndFocus()));
  connect(filter(), SIGNAL(ReturnPressed()), view(),
          SLOT(FilterReturnPressed()));
  connect(view(), SIGNAL(FocusOnFilterSignal(QKeyEvent*)), filter(),
          SLOT(FocusOnFilter(QKeyEvent*)));

  ReloadSettings();
}
示例#21
0
NetworkRemoteHelper::NetworkRemoteHelper(Application* app)
  : app_(app)
{
  app_ = app;
  connect(this, SIGNAL(ReloadSettingsSig()),
          app_->network_remote(), SLOT(ReloadSettings()));
  connect(this, SIGNAL(StartServerSig()),
          app_->network_remote(), SLOT(StartServer()));
  connect(this, SIGNAL(SetupServerSig()),
          app_->network_remote(), SLOT(SetupServer()));

  // Start the server once the playlistmanager is initialized
  connect(app_->playlist_manager(), SIGNAL(PlaylistManagerInitialized()),
          this, SLOT(StartServer()));

  sInstance = this;
}
示例#22
0
Notifyd::Notifyd(QObject* parent)
    : QObject(parent),
      mId(0)
{
    m_area = new NotificationArea();
    ReloadSettings();

    connect(this, SIGNAL(notificationAdded(uint,QString,QString,QString,QString,int,QStringList,QVariantMap)),
            m_area->layout(), SLOT(addNotification(uint,QString,QString,QString,QString,int,QStringList,QVariantMap)));
    connect(this, SIGNAL(notificationClosed(uint, uint)),
            m_area->layout(), SLOT(removeNotification(uint, uint)));
    // feedback for original caller
    connect(m_area->layout(), SIGNAL(notificationClosed(uint,uint)),
            this, SIGNAL(NotificationClosed(uint,uint)));
    connect(m_area->layout(), SIGNAL(actionInvoked(uint, QString)),
            this, SIGNAL(ActionInvoked(uint,QString)));

}
示例#23
0
void CEngine::Initialize(void)
{
	// Other stuff
	string_path              fn;
    strconcat               (sizeof(fn),fn,UI->EditorName(),".log");
    FS.update_path			(fn,_local_root_,fn);

#ifdef _EDITOR
	// Bind PSGP
	ZeroMemory				(&PSGP,sizeof(PSGP));
	hPSGP		            = LoadLibrary("xrCPU_Pipe.dll");
	R_ASSERT2	            (hPSGP,"Can't find 'xrCPU_Pipe.dll'");

	xrBinder* bindCPU	    = (xrBinder*)GetProcAddress(hPSGP,"xrBind_PSGP");	R_ASSERT(bindCPU);
	bindCPU		            (&PSGP, CPU::ID.feature /*& CPU::ID.os_support*/);
    // for compliance with editor
    PSGP.skin1W				= xrSkin1W_x86;
    PSGP.skin2W				= xrSkin2W_x86;
#endif

	ReloadSettings			();
}
示例#24
0
void CDefTermHk::OnAllocConsoleFinished()
{
	if (!gbPrepareDefaultTerminal || !this)
	{
		_ASSERTEX((gbPrepareDefaultTerminal && gpDefTerm) && "Must be called in DefTerm mode only");
		return;
	}

	if (!ghConWnd || !IsWindow(ghConWnd))
	{
		LogHookingStatus(L"OnAllocConsoleFinished: ghConWnd must be initialized already!");
		_ASSERTEX(FALSE && "ghConWnd must be initialized already!");
		return;
	}

	ReloadSettings();
	_ASSERTEX(isDefTermEnabled() && gbIsNetVsHost);

	if (!isDefTermEnabled())
	{
		// Disabled in settings or registry
		LogHookingStatus(L"OnAllocConsoleFinished: !isDefTermEnabled()");
		return;
	}

	// По идее, после AllocConsole окно RealConsole всегда видимо
	BOOL bConWasVisible = IsWindowVisible(ghConWnd);
	_ASSERTEX(bConWasVisible);
	// Чтобы минимизировать "мелькания" - сразу спрячем его
	ShowWindow(ghConWnd, SW_HIDE);
	LogHookingStatus(L"Console window was hidden");

	if (!StartConsoleServer(gnSelfPID, false, NULL))
	{
		if (bConWasVisible)
			ShowWindow(ghConWnd, SW_SHOW);
		LogHookingStatus(L"Starting attach server failed?");
	}
}
示例#25
0
OSD::OSD(SystemTrayIcon* tray_icon, Application* app, QObject* parent)
  : QObject(parent),
    tray_icon_(tray_icon),
    app_(app),
    timeout_msec_(5000),
    behaviour_(Native),
    show_on_volume_change_(false),
    show_art_(true),
    show_on_play_mode_change_(true),
    use_custom_text_(false),
    custom_text1_(QString()),
    custom_text2_(QString()),
    preview_mode_(false),
    force_show_next_(false),
    ignore_next_stopped_(false),
    pretty_popup_(new OSDPretty(OSDPretty::Mode_Popup))
{
  connect(app_->current_art_loader(), SIGNAL(ThumbnailLoaded(Song,QString,QImage)),
          SLOT(AlbumArtLoaded(Song,QString,QImage)));

  ReloadSettings();
  Init();
}
示例#26
0
ScreenSaverFilter::ScreenSaverFilter()
	: BLocker("screen saver filter"),
	fLastEventTime(system_time()),
	fBlankTime(0),
	fSnoozeTime(0),
	fCurrentCorner(NO_CORNER),
	fFrameNum(0),
	fRunner(NULL),
	fCornerRunner(NULL),
	fWatchingDirectory(false),
	fWatchingFile(false),
	fIsRunning(false)
{
	fController = new (std::nothrow) ScreenSaverController(this);
	if (fController == NULL)
		return;

	BAutolock _(this);

	fController->Run();

	ReloadSettings();
	be_roster->StartWatching(fController);
}
示例#27
0
SomaFMServiceBase::SomaFMServiceBase(Application* app, InternetModel* parent,
                                     const QString& name,
                                     const QUrl& channel_list_url,
                                     const QUrl& homepage_url,
                                     const QUrl& donate_page_url,
                                     const QIcon& icon)
    : InternetService(name, app, parent, parent),
      url_scheme_(name.toLower().remove(' ')),
      url_handler_(new SomaFMUrlHandler(app, this, this)),
      root_(nullptr),
      context_menu_(nullptr),
      network_(new NetworkAccessManager(this)),
      streams_(name, "streams", kStreamsCacheDurationSecs),
      name_(name),
      channel_list_url_(channel_list_url),
      homepage_url_(homepage_url),
      donate_page_url_(donate_page_url),
      icon_(icon) {
  ReloadSettings();

  app_->player()->RegisterUrlHandler(url_handler_);
  app_->global_search()->AddProvider(
      new SomaFMSearchProvider(this, app_, this));
}
示例#28
0
PlaylistContainer::PlaylistContainer(QWidget* parent)
    : QWidget(parent),
      ui_(new Ui_PlaylistContainer),
      manager_(nullptr),
      undo_(nullptr),
      redo_(nullptr),
      playlist_(nullptr),
      starting_up_(true),
      tab_bar_visible_(false),
      tab_bar_animation_(new QTimeLine(500, this)),
      no_matches_label_(nullptr),
      filter_timer_(new QTimer(this)) {
  ui_->setupUi(this);

  ui_->file_path_box->addItem("Automatic");
  ui_->file_path_box->addItem("Absolute");
  ui_->file_path_box->addItem("Relative");

  connect(ui_->file_path_box, SIGNAL(currentIndexChanged(int)),
          SLOT(PathSettingChanged(int)));

  no_matches_label_ = new QLabel(ui_->playlist);
  no_matches_label_->setAlignment(Qt::AlignTop | Qt::AlignHCenter);
  no_matches_label_->setAttribute(Qt::WA_TransparentForMouseEvents);
  no_matches_label_->setWordWrap(true);
  no_matches_label_->raise();
  no_matches_label_->hide();

  // Set the colour of the no matches label to the disabled text colour
  QPalette no_matches_palette = no_matches_label_->palette();
  const QColor no_matches_color =
      no_matches_palette.color(QPalette::Disabled, QPalette::Text);
  no_matches_palette.setColor(QPalette::Normal, QPalette::WindowText,
                              no_matches_color);
  no_matches_palette.setColor(QPalette::Inactive, QPalette::WindowText,
                              no_matches_color);
  no_matches_label_->setPalette(no_matches_palette);

  // Make it bold
  QFont no_matches_font = no_matches_label_->font();
  no_matches_font.setBold(true);
  no_matches_label_->setFont(no_matches_font);

  settings_.beginGroup(kSettingsGroup);

  ReloadSettings();

  // Tab bar
  ui_->tab_bar->setExpanding(false);
  ui_->tab_bar->setMovable(true);

  connect(tab_bar_animation_, SIGNAL(frameChanged(int)),
          SLOT(SetTabBarHeight(int)));
  ui_->tab_bar->setMaximumHeight(0);

  // Connections
  connect(ui_->tab_bar, SIGNAL(currentChanged(int)), SLOT(Save()));
  connect(ui_->tab_bar, SIGNAL(Save(int)), SLOT(SavePlaylist(int)));

  // set up timer for delayed filter updates
  filter_timer_->setSingleShot(true);
  filter_timer_->setInterval(kFilterDelayMs);
  connect(filter_timer_, SIGNAL(timeout()), this, SLOT(UpdateFilter()));

  // Replace playlist search filter with native search box.
  connect(ui_->filter, SIGNAL(textChanged(QString)), SLOT(MaybeUpdateFilter()));
  connect(ui_->playlist, SIGNAL(FocusOnFilterSignal(QKeyEvent*)),
          SLOT(FocusOnFilter(QKeyEvent*)));
  ui_->filter->installEventFilter(this);
}
示例#29
0
void ColorsPreflet::MessageReceived(BMessage *msg)
{
	switch(msg->what)
	{
		case M_POINTSIZE_CHANGED:
		{
			int newsize = fFontSize->Value();
			MainWindow->main.editarea->SetFontSize(newsize);
			
			fParent->SettingsChanged();
		}
		break;
		
		case M_SCHEMESEL_CHANGED:
		{			
			int32 newindex;
			msg->FindInt32("newindex", &newindex);
			
			if (CurrentColorScheme.GetLoadedSchemeIndex() == newindex)
				break;
			
			BMenuItem *item = fSchemeMenu->ItemAt(newindex);
			if (item) item->SetMarked(true);
			
			CurrentColorScheme.SaveScheme();
			CurrentColorScheme.LoadScheme(newindex);
			
			editor.curev->FullRedrawView();
			
			fColorsList->ResetRevertBuffer();
			ReloadSettings();
		}
		break;
		
		case M_SCHEME_DELETE:
		{
			int numschemes = ColorScheme::GetNumColorSchemes();
			
			if (numschemes <= 1)
			{
				(new BAlert("", "Cannot delete that color scheme. There must always least one scheme available.", "OK", NULL, NULL, B_WIDTH_AS_USUAL, B_STOP_ALERT))->Go();
				break;
			}
			
			BString prompt;
			prompt << "Are you sure you want to delete the scheme \"" <<
				CurrentColorScheme.GetSchemeName() << "\"?";
			
			BAlert *alert = new BAlert("", prompt.String(), "No", "Yes");
			if (alert->Go())
			{
				int newindex;
				int curscheme = CurrentColorScheme.GetLoadedSchemeIndex();
				
				// make some other scheme active
				if (curscheme == numschemes - 1)
					newindex = curscheme - 1;
				else
					newindex = curscheme + 1;
				
				BMessage msg(M_SCHEMESEL_CHANGED);
				msg.AddInt32("newindex", newindex);
				MessageReceived(&msg);
				
				// now, delete the scheme
				ColorScheme::DeleteScheme(curscheme);
				
				// fixup loaded index for the deletion
				if (newindex > curscheme)
					CurrentColorScheme.LoadScheme(curscheme);
				
				UpdateSchemesMenu();
				
				fColorsList->ResetRevertBuffer();
				ReloadSettings();
			}
		}
		break;
		
		case M_SCHEME_NEW:
		{
			BString *schemeName;
			BString defaultName(CurrentColorScheme.GetSchemeName());
			defaultName.Append(" Copy");
			
			schemeName = InputBox::Go(MainWindow, "New Scheme", "Name of new scheme:", defaultName.String());
			if (!schemeName) break;
			if (!schemeName->String()[0]) break;
			
			stat("creating new scheme '%s'", schemeName->String());
			
			// duplicate current scheme into the next available index
			CurrentColorScheme.SaveScheme();
			ColorScheme tempscheme = CurrentColorScheme;
			
			int count = ColorScheme::GetNumColorSchemes();
			tempscheme.SetSchemeName(schemeName->String());
			tempscheme.SaveScheme(count);
			
			UpdateSchemesMenu();
			
			// set the new scheme to be active
			CurrentColorScheme.LoadScheme(count);
			BMenuItem *item = fSchemeMenu->ItemAt(count);
			if (item) item->SetMarked(true);
			
			// clean up and we're done
			fColorsList->ResetRevertBuffer();
			delete schemeName;
		}
		break;
		
		case M_SCHEME_DEFAULTS:
		{
			BAlert *alert = new BAlert("", "This will erase all user color-schemes and reset"
										   " colors to the built-in defaults. Is that want you"
										   " want to do?", "Cancel", "Set Defaults", NULL,
										   B_WIDTH_AS_USUAL, B_STOP_ALERT);
			
			if (alert->Go())
			{
				ColorScheme::ResetToDefaults();
				CurrentColorScheme.LoadScheme(1);
				UpdateSchemesMenu();
				
				editor.curev->FullRedrawView();
				
				ReloadSettings();
				
				fColorsList->ResetRevertBuffer();
				fParent->SettingsChanged();
			}
		}
		break;
		
		default:
			MessageView::MessageReceived(msg);
		break;
	}	
}
示例#30
0
CSandBoxSettings::CSandBoxSettings()
{
	ReloadSettings();
}