Пример #1
0
void PlaylistView::CurrentSongChanged(const Song& song, const QString& uri,
                                      const QImage& song_art) {
  if (current_song_cover_art_ == song_art) return;

  current_song_cover_art_ = song_art;
  if (background_image_type_ == AlbumCover) {
    if (song.art_automatic().isEmpty() && song.art_manual().isEmpty()) {
      set_background_image(QImage());
    } else {
      set_background_image(current_song_cover_art_);
    }
    force_background_redraw_ = true;
    update();
  }
}
Пример #2
0
//Draws the hours and minutes
void handle_minute_tick(AppContextRef ctx, PebbleTickEvent *t) {

    (void)ctx;

    static char hours_text[] = "    00 00";
    static char minutes_text[] = "    00 00";

    char *minutes_format;
    char *hours_format;

    minutes_format = "MP  %M/59";
    if (clock_is_24h_style()) {
        hours_format = "HP  %H/23";
    } else {
        hours_format = "HP  %I/12";
    }

    string_format_time(hours_text, sizeof(hours_text), hours_format, t->tick_time);
    string_format_time(minutes_text, sizeof(minutes_text), minutes_format, t->tick_time);

    if (t->tick_time->tm_hour>0&&t->tick_time->tm_hour<6&&current_background!=2) {
        //Moogle is asleep
        set_background_image(&image_container,RESOURCE_ID_IMAGE_MOG_DEAD_WHITE);
        current_background=2;

    }
    if (t->tick_time->tm_hour>6&&t->tick_time->tm_hour<9&&current_background!=1) {
        //Moogle is groggy
        set_background_image(&image_container,RESOURCE_ID_IMAGE_MOG_HURT_WHITE);
        current_background=1;

    }
    if (t->tick_time->tm_hour>9&&t->tick_time->tm_hour<21&&current_background!=0) {
        //Moogle is awake
        set_background_image(&image_container,RESOURCE_ID_IMAGE_MOG_OK_WHITE);
        current_background=0;

    }
    if (t->tick_time->tm_hour>21&&t->tick_time->tm_hour<24&&current_background!=1) {
        //Moogle is tired
        set_background_image(&image_container,RESOURCE_ID_IMAGE_MOG_HURT_WHITE);
        current_background=1;
    }

    text_layer_set_text(&text_hours_layer, hours_text);
    text_layer_set_text(&text_minutes_layer, minutes_text);

}
Пример #3
0
void handle_init(AppContextRef ctx) {
    (void)ctx;

    window_init(&window, "Moogle");
    window_stack_push(&window, true /* Animated */);
    window_set_background_color(&window, GColorBlack);

    resource_init_current_app(&APP_RESOURCES);

    //Adds Moogle sprite
    layer_init(&background_layer, window.layer.frame);
    layer_add_child(&window.layer, &background_layer);
    current_background=0;
    set_background_image(&image_container,RESOURCE_ID_IMAGE_MOG_OK_WHITE);

    //Adds the time text
    init_text();

}
Пример #4
0
	void process_frame(ClFrame &in_frame, ClFrame &out_frame, ClFrame &orig_frame) {
		PERF_START("process_frame");

		if(m_crop) {
			in_frame.set_origin(m_width/2, m_height/2, 0);
			in_frame.set_region( m_width/3, m_height/3, 1);
			out_frame.set_origin(m_width/2, m_height/2, 0);
			out_frame.set_region( m_width/3, m_height/3, 1);
#ifndef _WITH_FRAMECPY
			//in_frame.vflip(); // no need to flip for frame memcpy
#endif //_WITH_FRAMECPY
		}

		if(m_crop) {
			set_background_image(bg_img);
		}

		if(m_ocl_image) {
			if(copyimg.proc(in_frame, out_frame) == false) {
				return;
			}
		}

		if(m_motion) {
			if(transimg.proc(3, in_frame, out_frame) == false) {
				return;
			}
		}  

		if(m_target.is_search()) {
			find_target(in_frame.get());
		}

		if(m_ocl_image || m_motion) {
			display_frame(out_frame);
		} else {
			display_frame(in_frame);
		}
		PERF_END("process_frame");
	}
/* Update the background image. */
void
update_background_image      (gchar *name)
{
  set_background_image (name);
  load_file ();
}
Пример #6
0
void PlaylistView::ReloadSettings() {
  QSettings s;
  s.beginGroup(Playlist::kSettingsGroup);
  glow_enabled_ = s.value("glow_effect", true).toBool();

  if (setting_initial_header_layout_ || upgrading_from_qheaderview_) {
    header_->SetStretchEnabled(s.value("stretch", true).toBool());
    upgrading_from_qheaderview_ = false;
  }

  if (currently_glowing_ && glow_enabled_ && isVisible()) StartGlowing();
  if (!glow_enabled_) StopGlowing();

  if (setting_initial_header_layout_) {
    header_->SetColumnWidth(Playlist::Column_Length, 0.06);
    header_->SetColumnWidth(Playlist::Column_Track, 0.05);
    setting_initial_header_layout_ = false;
  }

  if (upgrading_from_version_ != -1) {
    if (upgrading_from_version_ < 4) {
      header_->SetColumnWidth(Playlist::Column_Source, 0.05);
    }
    upgrading_from_version_ = -1;
  }

  column_alignment_ = s.value("column_alignments").value<ColumnAlignmentMap>();
  if (column_alignment_.isEmpty()) {
    column_alignment_ = DefaultColumnAlignment();
  }

  emit ColumnAlignmentChanged(column_alignment_);

  // Background:
  QVariant q_playlistview_background_type =
      s.value(kSettingBackgroundImageType);
  BackgroundImageType background_type(Default);
  // bg_enabled should also be checked for backward compatibility (in releases
  // <= 1.0, there was just a boolean to activate/deactivate the background)
  QVariant bg_enabled = s.value("bg_enabled");
  if (q_playlistview_background_type.isValid()) {
    background_type = static_cast<BackgroundImageType>(
        q_playlistview_background_type.toInt());
  } else if (bg_enabled.isValid()) {
    if (bg_enabled.toBool()) {
      background_type = Default;
    } else {
      background_type = None;
    }
  }
  QString background_image_filename =
      s.value(kSettingBackgroundImageFilename).toString();
  int blur_radius = s.value("blur_radius", kDefaultBlurRadius).toInt();
  int opacity_level = s.value("opacity_level", kDefaultOpacityLevel).toInt();
  // Check if background properties have changed.
  // We change properties only if they have actually changed, to avoid to call
  // set_background_image when it is not needed, as this will cause the fading
  // animation to start again. This also avoid to do useless
  // "force_background_redraw".
  if (background_image_filename != background_image_filename_ ||
      background_type != background_image_type_ ||
      blur_radius_ != blur_radius || opacity_level_ != opacity_level) {
    // Store background properties
    background_image_type_ = background_type;
    background_image_filename_ = background_image_filename;
    blur_radius_ = blur_radius;
    opacity_level_ = opacity_level;
    if (background_image_type_ == Custom) {
      set_background_image(QImage(background_image_filename));
    } else if (background_image_type_ == AlbumCover) {
      set_background_image(current_song_cover_art_);
    } else {
      // User changed background image type to something that will not be
      // painted through paintEvent: reset all background images.
      // This avoid to use old (deprecated) images for fading when selecting
      // AlbumCover or Custom background image type later.
      set_background_image(QImage());
      cached_scaled_background_image_ = QPixmap();
      previous_background_image_ = QPixmap();
    }
    setProperty("default_background_enabled",
                background_image_type_ == Default);
    emit BackgroundPropertyChanged();
    force_background_redraw_ = true;
  }

  if(!s.value("click_edit_inline", true).toBool())
      setEditTriggers(editTriggers() & ~QAbstractItemView::SelectedClicked);
  else
      setEditTriggers(editTriggers() | QAbstractItemView::SelectedClicked);
}