Assorted whitespace cleanup and typo fixes.
[haiku.git] / src / preferences / media / Media.cpp
blob74fbd73e3a34c80cc88e7b73620d2a21d4da48a1
1 /*
2 * Copyright 2003-2006, Haiku. All rights reserved.
3 * Distributed under the terms of the MIT License.
5 * Authors in chronological order:
6 * Sikosis
7 * Jérôme Duval
8 */
11 #include "Media.h"
13 #include <stdio.h>
15 #include <Catalog.h>
16 #include <Locale.h>
17 #include <StorageKit.h>
18 #include <String.h>
21 Media::Media()
23 BApplication("application/x-vnd.Haiku-Media"),
24 fIcons(),
25 fWindow(NULL)
27 BRect rect(32, 64, 637, 462);
29 BPath path;
30 if (find_directory(B_USER_SETTINGS_DIRECTORY, &path) == B_OK) {
31 path.Append(SETTINGS_FILE);
32 BFile file(path.Path(),B_READ_ONLY);
33 if (file.InitCheck()==B_OK) {
34 char buffer[255];
35 ssize_t size = 0;
36 while ((size = file.Read(buffer, 255)) > 0) {
37 int32 i = 0;
38 while (buffer[i] == '#') {
39 while (i < size && buffer[i] != '\n')
40 i++;
41 i++;
43 int32 a, b, c, d;
44 const char* scanString = " rect = %li,%li,%li,%li";
45 if (sscanf(&buffer[i], scanString, &a, &b, &c, &d) == 4) {
46 if (c - a >= rect.IntegerWidth()) {
47 rect.left = a;
48 rect.right = c;
50 if (d - b >= rect.IntegerHeight()) {
51 rect.top = b;
52 rect.bottom = d;
59 MediaListItem::SetIcons(&fIcons);
60 fWindow = new MediaWindow(rect);
64 status_t
65 Media::InitCheck()
67 if (fWindow)
68 return fWindow->InitCheck();
69 return B_OK;
73 // #pragma mark -
76 int
77 main(int, char**)
79 Media app;
80 if (app.InitCheck() == B_OK)
81 app.Run();
83 return 0;