From 0066b9a52299061e9b2928fa866ea750ea40119d Mon Sep 17 00:00:00 2001 From: Jaidyn Ann Date: Sun, 24 Jan 2021 23:20:11 -0600 Subject: [PATCH] Rename Config to Preferences --- Makefile | 2 +- src/App.cpp | 10 +++++----- src/App.h | 6 +++--- src/AtomFeed.cpp | 1 - src/Entry.cpp | 1 - src/Entry.h | 2 -- src/Feed.cpp | 5 ++--- src/FeedController.cpp | 3 ++- src/{Config.cpp => Preferences.cpp} | 10 +++++----- src/{Config.h => Preferences.h} | 12 ++++++------ src/RssFeed.cpp | 1 - 11 files changed, 24 insertions(+), 29 deletions(-) rename src/{Config.cpp => Preferences.cpp} (91%) rename src/{Config.h => Preferences.h} (77%) diff --git a/Makefile b/Makefile index 165c148..250549a 100644 --- a/Makefile +++ b/Makefile @@ -31,7 +31,6 @@ APP_MIME_SIG = application/x-vnd.Pogger SRCS = \ src/App.cpp, \ src/AtomFeed.cpp, \ - src/Config.cpp, \ src/Entry.cpp, \ src/EntriesView.cpp, \ src/Feed.cpp, \ @@ -42,6 +41,7 @@ SRCS = \ src/MainWindow.cpp, \ src/Mimetypes.cpp, \ src/Notifier.cpp, \ + src/Preferences.cpp, \ src/ProtocolListener.cpp, \ src/RssFeed.cpp, \ src/UpdatesView.cpp, \ diff --git a/src/App.cpp b/src/App.cpp index b293de5..c804a5e 100644 --- a/src/App.cpp +++ b/src/App.cpp @@ -12,7 +12,6 @@ #include #include "AtomFeed.h" -#include "Config.h" #include "Entry.h" #include "Feed.h" #include "FeedController.h" @@ -20,6 +19,7 @@ #include "MainWindow.h" #include "Mimetypes.h" #include "Notifier.h" +#include "Preferences.h" #include "RssFeed.h" #include "Util.h" @@ -31,15 +31,15 @@ main(int argc, char** argv) App* app = new App(); app->Run(); - app->cfg->Save(); + app->fPreferences->Save(); return 0; } App::App() : BApplication("application/x-vnd.Pogger") { - cfg = new Config; - cfg->Load(); + fPreferences = new Preferences; + fPreferences->Load(); fMainWindow = new MainWindow(); fNotifier = new Notifier(); @@ -49,7 +49,7 @@ App::App() : BApplication("application/x-vnd.Pogger") BMessage* updateMessage = new BMessage(kUpdateSubscribed); // MessageReceived(updateMessage); fUpdateRunner = new BMessageRunner(this, updateMessage, - cfg->updateInterval); + fPreferences->updateInterval); } diff --git a/src/App.h b/src/App.h index 067734b..3914267 100644 --- a/src/App.h +++ b/src/App.h @@ -9,10 +9,10 @@ #include #include +#include "Preferences.h" class BMessage; class BMessageRunner; -class Config; class FeedController; class MainWindow; class Notifier; @@ -26,10 +26,10 @@ public: void ArgvReceived(int32 argc, char** argv); - Config* cfg; MainWindow* fMainWindow; - BMessageRunner* fUpdateRunner; + Preferences* fPreferences; Notifier* fNotifier; + BMessageRunner* fUpdateRunner; private: FeedController* fFeedController; diff --git a/src/AtomFeed.cpp b/src/AtomFeed.cpp index 49f084e..90ef5d4 100644 --- a/src/AtomFeed.cpp +++ b/src/AtomFeed.cpp @@ -8,7 +8,6 @@ #include #include "App.h" -#include "Config.h" #include "Entry.h" #include "Util.h" diff --git a/src/Entry.cpp b/src/Entry.cpp index e275f59..b73fc19 100644 --- a/src/Entry.cpp +++ b/src/Entry.cpp @@ -10,7 +10,6 @@ #include #include -#include "Config.h" #include "Util.h" diff --git a/src/Entry.h b/src/Entry.h index 7d23df5..a24298b 100644 --- a/src/Entry.h +++ b/src/Entry.h @@ -13,8 +13,6 @@ #include -#include "Config.h" - class Entry { public: diff --git a/src/Feed.cpp b/src/Feed.cpp index 922328f..cf9f068 100644 --- a/src/Feed.cpp +++ b/src/Feed.cpp @@ -5,11 +5,12 @@ #include "Feed.h" +#include + #include #include "App.h" #include "Entry.h" -#include "Config.h" #include "Util.h" @@ -188,8 +189,6 @@ Feed::xmlCountSiblings (tinyxml2::XMLElement* xsibling, const char* sibling_name bool Feed::AddEntry (Entry* newEntry) { - Config* cfg = ((App*)be_app)->cfg; - entries.AddItem(newEntry); return true; } diff --git a/src/FeedController.cpp b/src/FeedController.cpp index ffc1f88..4d88d17 100644 --- a/src/FeedController.cpp +++ b/src/FeedController.cpp @@ -5,6 +5,7 @@ #include "FeedController.h" +#include #include #include @@ -149,7 +150,7 @@ FeedController::_ParseLoop(void* ignored) BList entries; BString feedTitle; BUrl feedUrl = feedBuffer->GetXmlUrl(); - BDirectory outDir = BDirectory(((App*)be_app)->cfg->outDir); + BDirectory outDir = BDirectory(((App*)be_app)->fPreferences->outDir); if (feedBuffer->IsAtom()) { AtomFeed* feed = (AtomFeed*)malloc(sizeof(AtomFeed)); diff --git a/src/Config.cpp b/src/Preferences.cpp similarity index 91% rename from src/Config.cpp rename to src/Preferences.cpp index 0344168..0b3aa38 100644 --- a/src/Config.cpp +++ b/src/Preferences.cpp @@ -3,24 +3,24 @@ * All rights reserved. Distributed under the terms of the MIT license. */ -#include "Config.h" +#include "Preferences.h" #include #include -Config::Config() { +Preferences::Preferences() { } -Config::Config(Config* cfg) { +Preferences::Preferences(Preferences* pref) { } // !! handle file status void -Config::Load() +Preferences::Load() { configDir = BString("/boot/home/config/settings/Pogger/"); @@ -41,7 +41,7 @@ Config::Load() // !! handle file status void -Config::Save () +Preferences::Save () { if (configDir == NULL) configDir = BString("/boot/home/config/settings/Pogger/"); diff --git a/src/Config.h b/src/Preferences.h similarity index 77% rename from src/Config.h rename to src/Preferences.h index 51cd686..3be961d 100644 --- a/src/Config.h +++ b/src/Preferences.h @@ -2,8 +2,8 @@ * Copyright 2020, Jaidyn Levesque * All rights reserved. Distributed under the terms of the MIT license. */ -#ifndef CONFIG_H -#define CONFIG_H +#ifndef PREFS_H +#define PREFS_H #include @@ -11,10 +11,10 @@ #include -class Config { +class Preferences { public: - Config(); - Config(Config*); + Preferences(); + Preferences(Preferences*); void Load(); void Save(); @@ -32,5 +32,5 @@ public: }; -#endif +#endif // PREFS_H diff --git a/src/RssFeed.cpp b/src/RssFeed.cpp index 7cc5592..e5a876e 100644 --- a/src/RssFeed.cpp +++ b/src/RssFeed.cpp @@ -6,7 +6,6 @@ #include "RssFeed.h" #include "App.h" -#include "Config.h" #include "Entry.h" #include "Util.h"