CurrentArtLoader::CurrentArtLoader(Application* app, QObject* parent)
    : QObject(parent),
      app_(app),
      temp_file_pattern_(QDir::tempPath() + "/clementine-art-XXXXXX.jpg"),
      id_(0) {
  options_.scale_output_image_ = false;
  options_.pad_output_image_ = false;
  options_.default_output_image_ = QImage(":nocover.png");

  connect(app_->album_cover_loader(), SIGNAL(ImageLoaded(quint64, QImage)),
          SLOT(TempArtLoaded(quint64, QImage)));

  connect(app_->playlist_manager(), SIGNAL(CurrentSongChanged(Song)),
          SLOT(LoadArt(Song)));
}
CurrentArtLoader::CurrentArtLoader(Application* app, QObject* parent)
    : QObject(parent),
      app_(app),
      temp_file_pattern_(QDir::tempPath() + "/clementine-art-XXXXXX.jpg"),
      id_(0) {
  options_.scale_output_image_ = false;
  options_.pad_output_image_ = false;
  QIcon nocover = IconLoader::Load("nocover", IconLoader::Other);
  options_.default_output_image_ = nocover.pixmap(nocover.availableSizes()
                                                         .last()).toImage();

  connect(app_->album_cover_loader(), SIGNAL(ImageLoaded(quint64, QImage)),
          SLOT(TempArtLoaded(quint64, QImage)));

  connect(app_->playlist_manager(), SIGNAL(CurrentSongChanged(Song)),
          SLOT(LoadArt(Song)));
}
Beispiel #3
0
int
main(int ac, char **av)
{
    int LoadArticle = 0;
    int DumpFeeds = 0;
    int SpoolMatch = 0;

    if (ac < 1)
	Usage(av[0]);

    LoadDiabloConfig(ac, av);

    /*
     * Options
     */

    {
	int i;

	for (i = 1; i < ac; ++i) {
	    char *ptr = av[i];

	    if (*ptr != '-')
		continue;
	    ptr += 2;
	    switch(ptr[-1]) {
	    case 'a':
		LoadArticle = 1;
		break;
	    case 'C':
		if (*ptr == 0)
		    ++i;
		break;
	    case 'D':
		if (*ptr == 0) {
		    ++i;
		    ptr = av[i];
		}
		Dist = ptr;
		break;
	    case 'd':
		if (isdigit((int)(unsigned char)*ptr)) {
		    DebugOpt = strtol(ptr, NULL, 0);
		} else {
		    --ptr;
		    while (*ptr == 'd') {
			++DebugOpt;
			++ptr;
		    }
		}
		FeedDebug = 1;
		break;
	    case 'F':
		DumpFeeds = 1;
		break;
	    case 'h':
		HeadOnly = 1;
		break;
	    case 'l':
		if (*ptr == 0) {
		    ++i;
		    ptr = av[i];
		}
		Label = ptr;
		break;
	    case 'M':
		if (*ptr == 0) {
		    ++i;
		    ptr = av[i];
		}
		MessageId = ptr;
		break;
	    case 'N':
		if (*ptr == 0) {
		    ++i;
		    ptr = av[i];
		}
		DNewsfeedsPat = ptr;
		break;
	    case 'n':
		if (*ptr == 0) {
		    ++i;
		    ptr = av[i];
		}
		Newsgroups = ptr;
		break;
	    case 'p':
		if (*ptr == 0) {
		    ++i;
		    ptr = av[i];
		}
		NumPath = ptr;
		break;
	    case 'S':
		Spam = 1;
		break;
	    case 's':
		if (*ptr == 0) {
		    ++i;
		    ptr = av[i];
		}
		Size = ptr;
		break;
	    case 't':
		if (*ptr == 0) {
		    ++i;
		    ptr = av[i];
		}
		ArtType = ArtTypeConv(ptr);
		break;
	    case 'V':
		PrintVersion();
		break;
	    case 'X':
		SpoolMatch = 1;
		break;
	    default:
		Usage(av[0]);
	    }
	}
    }

    LoadNewsFeed(0, 1, Label);

    if (LoadArticle)
	LoadArt();

    if (DumpFeeds) {
	if (Label == NULL)
	    DumpAllFeedInfo(stdout);
	else
	    DumpFeedInfo(stdout, Label);
	exit(0);
    }

    if (Newsgroups == NULL) {
	printf("Missing Newsgroups\n\n");
	Usage(av[0]);
    }

    {
	char artType[32];
	char offSize[64];
	sprintf(artType, "%06x", ArtType);
	sprintf(offSize, "0,%s", Size);

	printf("Matching:\n");
	printf("\tNewsgroups: %s\n", Newsgroups);
	printf("\tDistribution: %s\n", Dist);
	printf("\tSize: %s\n", Size);
	printf("\tMessage-ID: %s\n", MessageId != NULL ? MessageId : "NONE");
	printf("\tNumPath: %s\n", NumPath);
	printf("\tArtType: %s\n", artType);
	printf("\tHeadOnly: %s\n", HeadOnly ? "Yes" : "No");
	printf("\tSpam: %s\n", Spam ? "Yes" : "No");
	if (SpoolMatch) {
	    uint16 Spool;
	    LoadSpoolCtl(0, 1);
	    AllocateSpools(0);
	    Spool = GetSpool(MessageId, Newsgroups, atoi(Size),
                        ArtType, Label, NULL, NULL);
	    printf("\nMatched spool: ");
	    if (Spool == (uint16)-3)
		printf("DontStore\n");
	    else if (Spool == (uint16)-2)
		printf("RejectArt\n");
	    else if (Spool == (uint16)-1)
		printf("NoSpool\n");
	    else
		printf("%02d\n", Spool);
		

	    exit(0);
	}
	FeedWrite(0, fwCallBack, "", "",
			offSize, Newsgroups, NumPath, Dist,
			HeadOnly ? "1" : "0",
			artType, Spam, 0);
    }

    exit(0);
}