Rename Config to Preferences

This commit is contained in:
Jaidyn Ann 2021-01-24 23:20:11 -06:00
parent 9fcae6cf9a
commit 0066b9a522
11 changed files with 24 additions and 29 deletions

View File

@ -31,7 +31,6 @@ APP_MIME_SIG = application/x-vnd.Pogger
SRCS = \ SRCS = \
src/App.cpp, \ src/App.cpp, \
src/AtomFeed.cpp, \ src/AtomFeed.cpp, \
src/Config.cpp, \
src/Entry.cpp, \ src/Entry.cpp, \
src/EntriesView.cpp, \ src/EntriesView.cpp, \
src/Feed.cpp, \ src/Feed.cpp, \
@ -42,6 +41,7 @@ SRCS = \
src/MainWindow.cpp, \ src/MainWindow.cpp, \
src/Mimetypes.cpp, \ src/Mimetypes.cpp, \
src/Notifier.cpp, \ src/Notifier.cpp, \
src/Preferences.cpp, \
src/ProtocolListener.cpp, \ src/ProtocolListener.cpp, \
src/RssFeed.cpp, \ src/RssFeed.cpp, \
src/UpdatesView.cpp, \ src/UpdatesView.cpp, \

View File

@ -12,7 +12,6 @@
#include <getopt.h> #include <getopt.h>
#include "AtomFeed.h" #include "AtomFeed.h"
#include "Config.h"
#include "Entry.h" #include "Entry.h"
#include "Feed.h" #include "Feed.h"
#include "FeedController.h" #include "FeedController.h"
@ -20,6 +19,7 @@
#include "MainWindow.h" #include "MainWindow.h"
#include "Mimetypes.h" #include "Mimetypes.h"
#include "Notifier.h" #include "Notifier.h"
#include "Preferences.h"
#include "RssFeed.h" #include "RssFeed.h"
#include "Util.h" #include "Util.h"
@ -31,15 +31,15 @@ main(int argc, char** argv)
App* app = new App(); App* app = new App();
app->Run(); app->Run();
app->cfg->Save(); app->fPreferences->Save();
return 0; return 0;
} }
App::App() : BApplication("application/x-vnd.Pogger") App::App() : BApplication("application/x-vnd.Pogger")
{ {
cfg = new Config; fPreferences = new Preferences;
cfg->Load(); fPreferences->Load();
fMainWindow = new MainWindow(); fMainWindow = new MainWindow();
fNotifier = new Notifier(); fNotifier = new Notifier();
@ -49,7 +49,7 @@ App::App() : BApplication("application/x-vnd.Pogger")
BMessage* updateMessage = new BMessage(kUpdateSubscribed); BMessage* updateMessage = new BMessage(kUpdateSubscribed);
// MessageReceived(updateMessage); // MessageReceived(updateMessage);
fUpdateRunner = new BMessageRunner(this, updateMessage, fUpdateRunner = new BMessageRunner(this, updateMessage,
cfg->updateInterval); fPreferences->updateInterval);
} }

View File

@ -9,10 +9,10 @@
#include <SupportDefs.h> #include <SupportDefs.h>
#include <Application.h> #include <Application.h>
#include "Preferences.h"
class BMessage; class BMessage;
class BMessageRunner; class BMessageRunner;
class Config;
class FeedController; class FeedController;
class MainWindow; class MainWindow;
class Notifier; class Notifier;
@ -26,10 +26,10 @@ public:
void ArgvReceived(int32 argc, char** argv); void ArgvReceived(int32 argc, char** argv);
Config* cfg;
MainWindow* fMainWindow; MainWindow* fMainWindow;
BMessageRunner* fUpdateRunner; Preferences* fPreferences;
Notifier* fNotifier; Notifier* fNotifier;
BMessageRunner* fUpdateRunner;
private: private:
FeedController* fFeedController; FeedController* fFeedController;

View File

@ -8,7 +8,6 @@
#include <tinyxml2.h> #include <tinyxml2.h>
#include "App.h" #include "App.h"
#include "Config.h"
#include "Entry.h" #include "Entry.h"
#include "Util.h" #include "Util.h"

View File

@ -10,7 +10,6 @@
#include <iostream> #include <iostream>
#include <fstream> #include <fstream>
#include "Config.h"
#include "Util.h" #include "Util.h"

View File

@ -13,8 +13,6 @@
#include <tinyxml2.h> #include <tinyxml2.h>
#include "Config.h"
class Entry { class Entry {
public: public:

View File

@ -5,11 +5,12 @@
#include "Feed.h" #include "Feed.h"
#include <File.h>
#include <tinyxml2.h> #include <tinyxml2.h>
#include "App.h" #include "App.h"
#include "Entry.h" #include "Entry.h"
#include "Config.h"
#include "Util.h" #include "Util.h"
@ -188,8 +189,6 @@ Feed::xmlCountSiblings (tinyxml2::XMLElement* xsibling, const char* sibling_name
bool bool
Feed::AddEntry (Entry* newEntry) Feed::AddEntry (Entry* newEntry)
{ {
Config* cfg = ((App*)be_app)->cfg;
entries.AddItem(newEntry); entries.AddItem(newEntry);
return true; return true;
} }

View File

@ -5,6 +5,7 @@
#include "FeedController.h" #include "FeedController.h"
#include <Directory.h>
#include <Message.h> #include <Message.h>
#include <Notification.h> #include <Notification.h>
@ -149,7 +150,7 @@ FeedController::_ParseLoop(void* ignored)
BList entries; BList entries;
BString feedTitle; BString feedTitle;
BUrl feedUrl = feedBuffer->GetXmlUrl(); BUrl feedUrl = feedBuffer->GetXmlUrl();
BDirectory outDir = BDirectory(((App*)be_app)->cfg->outDir); BDirectory outDir = BDirectory(((App*)be_app)->fPreferences->outDir);
if (feedBuffer->IsAtom()) { if (feedBuffer->IsAtom()) {
AtomFeed* feed = (AtomFeed*)malloc(sizeof(AtomFeed)); AtomFeed* feed = (AtomFeed*)malloc(sizeof(AtomFeed));

View File

@ -3,24 +3,24 @@
* All rights reserved. Distributed under the terms of the MIT license. * All rights reserved. Distributed under the terms of the MIT license.
*/ */
#include "Config.h" #include "Preferences.h"
#include <String.h> #include <String.h>
#include <iostream> #include <iostream>
Config::Config() { Preferences::Preferences() {
} }
Config::Config(Config* cfg) { Preferences::Preferences(Preferences* pref) {
} }
// !! handle file status // !! handle file status
void void
Config::Load() Preferences::Load()
{ {
configDir = BString("/boot/home/config/settings/Pogger/"); configDir = BString("/boot/home/config/settings/Pogger/");
@ -41,7 +41,7 @@ Config::Load()
// !! handle file status // !! handle file status
void void
Config::Save () Preferences::Save ()
{ {
if (configDir == NULL) if (configDir == NULL)
configDir = BString("/boot/home/config/settings/Pogger/"); configDir = BString("/boot/home/config/settings/Pogger/");

View File

@ -2,8 +2,8 @@
* Copyright 2020, Jaidyn Levesque <jadedctrl@teknik.io> * Copyright 2020, Jaidyn Levesque <jadedctrl@teknik.io>
* All rights reserved. Distributed under the terms of the MIT license. * All rights reserved. Distributed under the terms of the MIT license.
*/ */
#ifndef CONFIG_H #ifndef PREFS_H
#define CONFIG_H #define PREFS_H
#include <DateTime.h> #include <DateTime.h>
@ -11,10 +11,10 @@
#include <StorageKit.h> #include <StorageKit.h>
class Config { class Preferences {
public: public:
Config(); Preferences();
Config(Config*); Preferences(Preferences*);
void Load(); void Load();
void Save(); void Save();
@ -32,5 +32,5 @@ public:
}; };
#endif #endif // PREFS_H

View File

@ -6,7 +6,6 @@
#include "RssFeed.h" #include "RssFeed.h"
#include "App.h" #include "App.h"
#include "Config.h"
#include "Entry.h" #include "Entry.h"
#include "Util.h" #include "Util.h"