mirror of
https://github.com/yann64/haikuports.git
synced 2026-05-03 13:38:52 +02:00
259 lines
7.8 KiB
Plaintext
259 lines
7.8 KiB
Plaintext
From 3e935bf077033a9bff8d3b9ff984ac0895639518 Mon Sep 17 00:00:00 2001
|
|
From: Jerome Duval <jerome.duval@gmail.com>
|
|
Date: Sun, 29 Jan 2017 20:47:06 +0100
|
|
Subject: fix build for gcc5/x86_64.
|
|
|
|
|
|
diff --git a/Import/ImportProducts.cpp b/Import/ImportProducts.cpp
|
|
index 6a60da9..9be09a1 100644
|
|
--- a/Import/ImportProducts.cpp
|
|
+++ b/Import/ImportProducts.cpp
|
|
@@ -5,7 +5,7 @@
|
|
|
|
#include "ImportProducts.h"
|
|
|
|
-#include <fstream.h>
|
|
+#include <fstream>
|
|
#include <sstream>
|
|
|
|
#define DEBUG 1
|
|
@@ -42,18 +42,18 @@ ImportProducts::Import()
|
|
//line.get(buffer, 1024, '\t');
|
|
|
|
//barcode
|
|
- char* buf;
|
|
- line.gets(&buf, '\t');
|
|
+ char buf[256];
|
|
+ line.getline(buf, 256, '\t');
|
|
string word = buf;
|
|
if(word == "Barcode" || word == ""){
|
|
continue;
|
|
}
|
|
product.barcode = word.c_str();
|
|
//name
|
|
- line.gets(&buf, '\t');
|
|
+ line.getline(buf, 256, '\t');
|
|
product.name = buf;
|
|
//comment
|
|
- line.gets(&buf, '\t');
|
|
+ line.getline(buf, 256, '\t');
|
|
product.comment = buf;
|
|
//prize
|
|
double prize;
|
|
diff --git a/Import/main.cpp b/Import/main.cpp
|
|
index 77f9b63..7bf815f 100644
|
|
--- a/Import/main.cpp
|
|
+++ b/Import/main.cpp
|
|
@@ -5,6 +5,7 @@
|
|
|
|
#include "ImportProducts.h"
|
|
|
|
+#include <iostream>
|
|
|
|
int
|
|
main(int argc, char* argv[])
|
|
diff --git a/gui/column/ColumnListView.cpp b/gui/column/ColumnListView.cpp
|
|
index 9e551f6..1a5474f 100644
|
|
--- a/gui/column/ColumnListView.cpp
|
|
+++ b/gui/column/ColumnListView.cpp
|
|
@@ -459,7 +459,7 @@ BRow::BRow(float height)
|
|
BRow::~BRow()
|
|
{
|
|
while (true) {
|
|
- BField *field = (BField*) fFields.RemoveItem(0L);
|
|
+ BField *field = (BField*) fFields.RemoveItem((int32)0);
|
|
if (field == 0)
|
|
break;
|
|
|
|
@@ -773,7 +773,7 @@ BColumnListView::BColumnListView(BRect rect, const char *name, uint32 resizingMo
|
|
BColumnListView::~BColumnListView()
|
|
{
|
|
while (true) {
|
|
- BColumn *column = (BColumn*) fColumns.RemoveItem(0L);
|
|
+ BColumn *column = (BColumn*) fColumns.RemoveItem((int32)0);
|
|
if (column == 0)
|
|
break;
|
|
|
|
@@ -2026,7 +2026,7 @@ void TitleView::ComputeDragBoundries(BColumn *findColumn, BPoint )
|
|
void TitleView::DrawTitle(BView *view, BRect rect, BColumn *column, bool depressed)
|
|
{
|
|
BRect drawRect;
|
|
- rgb_color borderColor = mix_color(fMasterView->Color(B_COLOR_HEADER_BACKGROUND), make_color(0, 0, 0), 128);
|
|
+ rgb_color borderColor = ::mix_color(fMasterView->Color(B_COLOR_HEADER_BACKGROUND), make_color(0, 0, 0), 128);
|
|
rgb_color backgroundColor;
|
|
|
|
rgb_color bevelHigh;
|
|
@@ -2036,15 +2036,15 @@ void TitleView::DrawTitle(BView *view, BRect rect, BColumn *column, bool depress
|
|
drawRect = rect;
|
|
drawRect.InsetBy(2, 2);
|
|
if (depressed) {
|
|
- backgroundColor = mix_color(fMasterView->Color(B_COLOR_HEADER_BACKGROUND), make_color(0, 0, 0), 64);
|
|
- bevelHigh = mix_color(backgroundColor, make_color(0, 0, 0), 64);
|
|
- bevelLow = mix_color(backgroundColor, make_color(255, 255, 255), 128);
|
|
+ backgroundColor = ::mix_color(fMasterView->Color(B_COLOR_HEADER_BACKGROUND), make_color(0, 0, 0), 64);
|
|
+ bevelHigh = ::mix_color(backgroundColor, make_color(0, 0, 0), 64);
|
|
+ bevelLow = ::mix_color(backgroundColor, make_color(255, 255, 255), 128);
|
|
drawRect.left++;
|
|
drawRect.top++;
|
|
} else {
|
|
backgroundColor = fMasterView->Color(B_COLOR_HEADER_BACKGROUND);
|
|
- bevelHigh = mix_color(backgroundColor, make_color(255, 255, 255), 192);
|
|
- bevelLow = mix_color(backgroundColor, make_color(0, 0, 0), 64);
|
|
+ bevelHigh = ::mix_color(backgroundColor, make_color(255, 255, 255), 192);
|
|
+ bevelLow = ::mix_color(backgroundColor, make_color(0, 0, 0), 64);
|
|
drawRect.bottom--;
|
|
drawRect.right--;
|
|
}
|
|
diff --git a/gui/column/ObjectList.h b/gui/column/ObjectList.h
|
|
index cc639c5..5f5cc48 100644
|
|
--- a/gui/column/ObjectList.h
|
|
+++ b/gui/column/ObjectList.h
|
|
@@ -668,7 +668,7 @@ BObjectList<T>::BinaryInsert(T *item, CompareFunctionWithState func, void *state
|
|
|
|
template<class T>
|
|
bool
|
|
-BObjectList<T>::BinaryInsertUnique(T *, CompareFunction func)
|
|
+BObjectList<T>::BinaryInsertUnique(T *item, CompareFunction func)
|
|
{
|
|
int32 index = _PointerList_::BinarySearchIndex(item,
|
|
(GenericCompareFunction)func);
|
|
@@ -681,7 +681,7 @@ BObjectList<T>::BinaryInsertUnique(T *, CompareFunction func)
|
|
|
|
template<class T>
|
|
bool
|
|
-BObjectList<T>::BinaryInsertUnique(T *, CompareFunctionWithState func, void *state)
|
|
+BObjectList<T>::BinaryInsertUnique(T *item, CompareFunctionWithState func, void *state)
|
|
{
|
|
int32 index = _PointerList_::BinarySearchIndex(item,
|
|
(GenericCompareFunctionWithState)func, state);
|
|
diff --git a/gui/productsview.cpp b/gui/productsview.cpp
|
|
index 0362333..5169cc7 100644
|
|
--- a/gui/productsview.cpp
|
|
+++ b/gui/productsview.cpp
|
|
@@ -152,7 +152,7 @@ ProductView::BarcodeEntered(BString barcode)
|
|
|
|
|
|
void
|
|
-ProductView::EditProduct(product_f *product = NULL)
|
|
+ProductView::EditProduct(product_f *product)
|
|
{
|
|
BWindow *EditWindow = new EditProductWindow(BRect(150,200,700,700),"edit product",product);
|
|
EditWindow->Show();
|
|
diff --git a/sqlite/SQLConnection.cpp b/sqlite/SQLConnection.cpp
|
|
index bc4df8b..0851637 100644
|
|
--- a/sqlite/SQLConnection.cpp
|
|
+++ b/sqlite/SQLConnection.cpp
|
|
@@ -1,5 +1,6 @@
|
|
#include "SQLConnection.h"
|
|
|
|
+#include <iostream>
|
|
#include <stdio.h>
|
|
#include <OS.h>
|
|
|
|
diff --git a/sqlite/SQLConnection.h b/sqlite/SQLConnection.h
|
|
index a6d2a2f..85a0690 100644
|
|
--- a/sqlite/SQLConnection.h
|
|
+++ b/sqlite/SQLConnection.h
|
|
@@ -6,6 +6,8 @@
|
|
|
|
#include "sqlite3.h"
|
|
|
|
+using namespace std;
|
|
+
|
|
class SQLiteConnection
|
|
{
|
|
private:
|
|
--
|
|
2.10.2
|
|
|
|
|
|
From 219ea8d674d873fc30b2913a81df2fba28b79a7b Mon Sep 17 00:00:00 2001
|
|
From: Jerome Duval <jerome.duval@gmail.com>
|
|
Date: Sun, 29 Jan 2017 21:58:02 +0100
|
|
Subject: move datafiles in config/settings/fairtrade/
|
|
|
|
|
|
diff --git a/ConfigApp/ConfigFairTrade.h b/ConfigApp/ConfigFairTrade.h
|
|
index 72058f1..01ffeca 100644
|
|
--- a/ConfigApp/ConfigFairTrade.h
|
|
+++ b/ConfigApp/ConfigFairTrade.h
|
|
@@ -22,8 +22,8 @@ class config{
|
|
public:
|
|
config()
|
|
{
|
|
- databasePath = "./fairtrade.db";
|
|
- csvExportPath = "./CSVExport";
|
|
+ databasePath = "fairtrade.db";
|
|
+ csvExportPath = "CSVExport";
|
|
welcomeString1 = "Willkommen";
|
|
welcomeString2 = "bei der Eine-Welt-Gruppe Anrath";
|
|
shutdownOnExit = true;
|
|
diff --git a/fairtrade.cpp b/fairtrade.cpp
|
|
index 1ea6562..b4219b7 100644
|
|
--- a/fairtrade.cpp
|
|
+++ b/fairtrade.cpp
|
|
@@ -24,30 +24,25 @@ TradeApp::TradeApp(char *signature)
|
|
BApplication(signature)
|
|
{
|
|
//read config
|
|
- app_info appInfo;
|
|
- GetAppInfo(&appInfo);
|
|
- BEntry appEntry(&appInfo.ref);
|
|
- BPath appPath;
|
|
- appEntry.GetPath(&appPath);
|
|
-
|
|
- BString configPath = appPath.Path();
|
|
- configPath.RemoveLast(appInfo.ref.name);
|
|
- chdir(configPath.String());
|
|
- configPath+= "./";
|
|
- configPath+= kConfigFile;
|
|
- BPath configP(configPath.String(), NULL, true);
|
|
+ BPath path;
|
|
+ if (find_directory (B_USER_SETTINGS_DIRECTORY, &path) != B_OK)
|
|
+ return;
|
|
+ path.Append ("fairtrade");
|
|
+
|
|
+ BPath configP(path.Path());
|
|
+ configP.Append(kConfigFile);
|
|
|
|
fConfig.ReadConfig(configP.Path());
|
|
|
|
- BString dbString = fConfig.databasePath;
|
|
- if(dbString.FindFirst("/") != 0){
|
|
+ BPath dbP;
|
|
+ if(fConfig.databasePath.FindFirst("/") != 0){
|
|
//relative path
|
|
- dbString = appPath.Path();
|
|
- dbString.RemoveLast(appInfo.ref.name);
|
|
- dbString+= fConfig.databasePath;
|
|
- }
|
|
+ dbP.SetTo(path.Path());
|
|
+ dbP.Append(fConfig.databasePath);
|
|
+ } else
|
|
+ dbP.SetTo(fConfig.databasePath);
|
|
//create dir if not exist
|
|
- BString dbDir(dbString);
|
|
+ BString dbDir(dbP.Path());
|
|
dbDir.Truncate(dbDir.IFindLast("/"));
|
|
|
|
BDirectory dir;
|
|
@@ -57,13 +52,12 @@ TradeApp::TradeApp(char *signature)
|
|
fExportPath = fConfig.csvExportPath;
|
|
if(fExportPath.FindFirst("/") != 0){
|
|
//relative path
|
|
- fExportPath = appPath.Path();
|
|
- fExportPath.RemoveLast(appInfo.ref.name);
|
|
+ fExportPath = path.Path();
|
|
fExportPath+= fConfig.csvExportPath;
|
|
}
|
|
|
|
HideCursor();
|
|
- fStock = new Stock(dbString.String());
|
|
+ fStock = new Stock(dbP.Path());
|
|
|
|
fMainWindow = new MainWindow(BRect(100, 300, 400, 700), "Fair Trade", fConfig);
|
|
fMainWindowMessenger = new BMessenger(fMainWindow);
|
|
--
|
|
2.10.2
|
|
|