Skip to content

Commit

Permalink
Modified ConfigManager and Configuration classes.
Browse files Browse the repository at this point in the history
Removed usage of the Node class.
For #102.
  • Loading branch information
end2endzone committed Jan 1, 2022
1 parent b94ea0c commit aacb482
Show file tree
Hide file tree
Showing 19 changed files with 125 additions and 829 deletions.
1 change: 0 additions & 1 deletion include/shellanything/Action.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
#ifndef SA_ACTION_H
#define SA_ACTION_H

#include "shellanything/Node.h"
#include "shellanything/Context.h"
#include <vector>

Expand Down
7 changes: 5 additions & 2 deletions include/shellanything/ConfigManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
#ifndef SA_CONFIGMANAGER_H
#define SA_CONFIGMANAGER_H

#include "shellanything/Node.h"
#include "shellanything/Configuration.h"
#include "shellanything/Context.h"

Expand Down Expand Up @@ -111,9 +110,13 @@ namespace shellanything
void AddSearchPath(const std::string & path);

private:
//methods
void DeleteChildren();
void DeleteChild(Configuration * config);

//attributes
PathList mPaths;
Node mConfigurations;
Configuration::ConfigurationPtrList mConfigurations;
};

} //namespace shellanything
Expand Down
14 changes: 12 additions & 2 deletions include/shellanything/Configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
#ifndef SA_CONFIGURATION_H
#define SA_CONFIGURATION_H

#include "shellanything/Node.h"
#include "shellanything/Menu.h"
#include "shellanything/DefaultSettings.h"
#include <stdint.h>
Expand All @@ -36,7 +35,7 @@ namespace shellanything
/// <summary>
/// A configuration holds mutiple Menu instances.
/// </summary>
class Configuration : public Node
class Configuration
{
public:
/// <summary>
Expand Down Expand Up @@ -129,10 +128,21 @@ namespace shellanything
/// <returns>Returns the DefaultSettings instance of the Configuration. Returns NULL if no DefaultSettings is set.</returns>
const DefaultSettings * GetDefaultSettings() const;

/// <summary>
/// Add a Menu to this Configuration. The Configuration takes ownership of the Menu.
/// </summary>
/// <param name="menu">The Menu to add.</param>
void AddMenu(Menu * menu);

private:
//methods
void DeleteChildren();
void DeleteChild(Menu* menu);

DefaultSettings * mDefaults;
uint64_t mFileModifiedDate;
std::string mFilePath;
Menu::MenuPtrList mMenus;
};

} //namespace shellanything
Expand Down
3 changes: 0 additions & 3 deletions include/shellanything/DefaultSettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@
#define SA_DEFAULTSETTINGS_H

#include "shellanything/Action.h"
#include <string>
#include <vector>
#include <stdint.h>

namespace shellanything
{
Expand Down
10 changes: 8 additions & 2 deletions include/shellanything/Menu.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
#ifndef SA_MENU_H
#define SA_MENU_H

#include "shellanything/Node.h"
#include "shellanything/Icon.h"
#include "shellanything/Validator.h"
#include "shellanything/Action.h"
Expand All @@ -39,7 +38,7 @@ namespace shellanything
/// <summary>
/// The Menu class defines a displayed menu option.
/// </summary>
class Menu : public Node
class Menu
{
public:
/// <summary>
Expand Down Expand Up @@ -247,6 +246,12 @@ namespace shellanything
/// </summary>
const Action::ActionPtrList & GetActions() const;

/// <summary>
/// Add a new sub menu to the menu. The menu instance takes ownership of the sub menu.
/// </summary>
/// <param name="menu">The given menu to add as a sub menu</param>
void AddMenu(Menu* menu);

/// <summary>
/// Get the list of submenu of the menu.
/// </summary>
Expand All @@ -265,6 +270,7 @@ namespace shellanything
int mNameMaxLength;
std::string mDescription;
Action::ActionPtrList mActions;
MenuPtrList mSubMenus;
};

} //namespace shellanything
Expand Down
184 changes: 0 additions & 184 deletions include/shellanything/Node.h

This file was deleted.

1 change: 0 additions & 1 deletion include/shellanything/Validator.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
#ifndef SA_VALIDATION_H
#define SA_VALIDATION_H

#include "shellanything/Node.h"
#include "shellanything/Context.h"
#include <string>
#include <vector>
Expand Down
2 changes: 0 additions & 2 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ set(SHELLANYTHING_HEADER_FILES ""
${CMAKE_SOURCE_DIR}/include/shellanything/DefaultSettings.h
${CMAKE_SOURCE_DIR}/include/shellanything/Icon.h
${CMAKE_SOURCE_DIR}/include/shellanything/Menu.h
${CMAKE_SOURCE_DIR}/include/shellanything/Node.h
${CMAKE_SOURCE_DIR}/include/shellanything/Validator.h
)

Expand Down Expand Up @@ -70,7 +69,6 @@ add_library(shellanything STATIC
InputBox.h
InputBox.cpp
Menu.cpp
Node.cpp
ObjectFactory.h
ObjectFactory.cpp
Unicode.h
Expand Down
Loading

0 comments on commit aacb482

Please sign in to comment.