Skip to content

Commit

Permalink
Merge pull request #11 from humdingerb/settings
Browse files Browse the repository at this point in the history
Settings in B_USER_SETTINGS_DIRECTORY
  • Loading branch information
scottmc authored Sep 21, 2018
2 parents 5fac179 + 570c84e commit 365668d
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 14 deletions.
2 changes: 1 addition & 1 deletion AboutWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#define TRANSLATE(x) x

AboutWindow::AboutWindow(void)
: BWindow(BRect(100,100,500,400),"Lights Off!", B_MODAL_WINDOW_LOOK,
: BWindow(BRect(100,100,500,400),"HexVexed", B_MODAL_WINDOW_LOOK,
B_MODAL_APP_WINDOW_FEEL,
B_NOT_ZOOMABLE | B_NOT_RESIZABLE)
{
Expand Down
14 changes: 7 additions & 7 deletions MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,11 +147,11 @@ MainWindow::MainWindow(void)
break;
}

submenu = new BMenu("Tile Size");
submenu = new BMenu("Tile size");
submenu->AddItem(new BMenuItem("Small",new BMessage(M_SIZE1_TILES)));
submenu->AddItem(new BMenuItem("Medium",new BMessage(M_SIZE2_TILES)));
submenu->AddItem(new BMenuItem("Large",new BMessage(M_SIZE3_TILES)));
submenu->AddItem(new BMenuItem("Extra Large",new BMessage(M_SIZE4_TILES)));
submenu->AddItem(new BMenuItem("Extra large",new BMessage(M_SIZE4_TILES)));
submenu->AddItem(new BMenuItem("Jumbo",new BMessage(M_SIZE5_TILES)));
submenu->SetRadioMode(true);
menu->AddItem(submenu);
Expand All @@ -162,7 +162,7 @@ MainWindow::MainWindow(void)
break;
}

submenu = new BMenu("Number Base");
submenu = new BMenu("Number base");
submenu->AddItem(new BMenuItem("Binary",new BMessage(M_SET_BINARY)));
submenu->AddItem(new BMenuItem("Quarternary",new BMessage(M_SET_QUARTERNARY)));
submenu->AddItem(new BMenuItem("Heximal",new BMessage(M_SET_HEXIMAL)));
Expand Down Expand Up @@ -199,9 +199,9 @@ MainWindow::MainWindow(void)
ScanBackgrounds();

menu->AddSeparatorItem();
menu->AddItem(new BMenuItem("How to Play…",new BMessage(M_HOW_TO_PLAY)));
menu->AddItem(new BMenuItem("How to play" B_UTF8_ELLIPSIS,new BMessage(M_HOW_TO_PLAY)));
menu->AddSeparatorItem();
menu->AddItem(new BMenuItem("About HexVexed",new BMessage(B_ABOUT_REQUESTED)));
menu->AddItem(new BMenuItem("About HexVexed",new BMessage(B_ABOUT_REQUESTED)));

BBox *timeBox = new BBox("box");
timeBox->ResizeTo(70, 34);
Expand Down Expand Up @@ -372,7 +372,7 @@ void MainWindow::MessageReceived(BMessage *msg)
case M_HOW_TO_PLAY:
{
BString string =
"How to Play HexVexed:\n\n"
"How to play HexVexed:\n\n"
"Place the tiles in the grid on the right into the "
"grid on the left so that the numbers match wherever "
"one tile touches another. Easy to learn, tough to master.\n";
Expand Down Expand Up @@ -462,7 +462,7 @@ void MainWindow::GenerateGrid(uint8 size, bool newGame)
if (newGame) {
if (fTimer->Running()) {
BAlert* alert = new BAlert("",
"Do you want to abort the current game?", "No", "Yes");
"Do you want to abort the current game?", "Continue game", "Abort game");
alert->SetShortcut(0, B_ESCAPE);

if (alert->Go() == 0)
Expand Down
17 changes: 11 additions & 6 deletions Preferences.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
#include <stdlib.h>
#include <time.h>
#include <math.h>
#include <Directory.h>
#include <FindDirectory.h>
#include <PathFinder.h>
#include <string>
#include <stdio.h>
Expand Down Expand Up @@ -65,13 +67,16 @@ void ConstrainWindowFrameToScreen(BRect *rect)
void
Preferences::Init()
{
BPathFinder finder;
if (finder.FindPath(B_FIND_PATH_SETTINGS_DIRECTORY, "HexVexed",
B_FIND_PATH_CREATE_PARENT_DIRECTORY, fPrefsPath) != B_OK) {
find_directory(B_USER_SETTINGS_DIRECTORY, &fPrefsPath);
fPrefsPath.Append("global/HexVexed");
if (status_t status = find_directory(B_USER_SETTINGS_DIRECTORY,
&fPrefsPath) == B_OK) {
status = fPrefsPath.Append("HexVexed");

if (status == B_OK)
status = create_directory(fPrefsPath.Path(), 0777);

if (status == B_OK)
fPrefsPath.Append("HexVexed_settings");
}
printf("Path: %s\n", fPrefsPath.Path());
}


Expand Down

0 comments on commit 365668d

Please sign in to comment.