Commit 3e37b5bc authored by Melroy van den Berg's avatar Melroy van den Berg
Browse files

working intergrated example! First prototype

parent 1dac2bde
......@@ -40,7 +40,7 @@ public:
static BottleTypes::Bit GetSystemBit(const string prefix_path);
static BottleTypes::AudioDriver GetAudioDriver(const string prefix_path);
static string GetVirtualDesktop(const string prefix_path);
static string GetLastWineUpdate(const string prefix_path);
static string GetLastWineUpdated(const string prefix_path);
static bool GetBottleStatus(const string prefix_path);
static string GetCLetterDrive(const string prefix_path);
static bool DirExists(const string& dir_path);
......
......@@ -44,7 +44,7 @@ public:
virtual ~MainWindow();
void SetDispatcher(SignalDispatcher& signalDispatcher);
void SetWineBottles(std::vector<WineBottle> bottles);
void SetWineBottles(const std::vector<WineBottle>& bottles);
void SetDetailedInfo(WineBottle bottle);
void ShowErrorMessage(const Glib::ustring& message);
......
......@@ -48,6 +48,15 @@ BottleManager::BottleManager(MainWindow& mainWindow): mainWindow(mainWindow)
// Read bottles from disk and create classes from it
std::vector<string> bottleDirs = ReadBottles();
CreateWineBottles(wineVersion, bottleDirs);
if(bottles.size() > 0)
{
// Update main Window
mainWindow.SetWineBottles(bottles);
// Set first element as active (details)
mainWindow.SetDetailedInfo(bottles.at(0));
}
}
/**
......@@ -87,22 +96,26 @@ void BottleManager::CreateWineBottles(string wineVersion, std::vector<string> bo
for(string prefix: bottleDirs) {
string name = Helper::GetName(prefix);
bool status = Helper::GetBottleStatus(prefix);
string cDriveLocation = Helper::GetCLetterDrive(prefix);
BottleTypes::Windows windows = Helper::GetWindowsOSVersion(prefix);
BottleTypes::Bit bit = Helper::GetSystemBit(prefix);
BottleTypes::AudioDriver driver = Helper::GetAudioDriver(prefix);
string cDriveLocation = Helper::GetCLetterDrive(prefix);
string lastTimeWineUpdated = Helper::GetLastWineUpdated(prefix);
BottleTypes::AudioDriver audioDriver = Helper::GetAudioDriver(prefix);
string virtualDesktop = Helper::GetVirtualDesktop(prefix);
string lastTimeWineUpdate = Helper::GetLastWineUpdate(prefix);
std::cout << name << std::endl;
std::cout << status << std::endl;
std::cout << cDriveLocation << std::endl;
std::cout << BottleTypes::toString(windows) << std::endl;
std::cout << BottleTypes::toString(bit) << std::endl;
std::cout << BottleTypes::toString(driver) << std::endl;
std::cout << virtualDesktop << std::endl;
std::cout << wineVersion << std::endl;
std::cout << lastTimeWineUpdate << std::endl;
WineBottle* bottle = new WineBottle(
name,
status,
windows,
bit,
wineVersion,
prefix,
cDriveLocation,
lastTimeWineUpdated,
audioDriver,
virtualDesktop);
bottles.push_back(*bottle);
}
}
......
......@@ -240,7 +240,7 @@ string Helper::GetVirtualDesktop(const string prefix_path)
* \brief Get the date/time of the last time the Wine Inf file was updated
* \return Date/time of last update
*/
string Helper::GetLastWineUpdate(const string prefix_path)
string Helper::GetLastWineUpdated(const string prefix_path)
{
string filename = prefix_path + "/.update-timestamp";
if(Helper::FileExists(filename)) {
......
......@@ -37,6 +37,8 @@ MainWindow::MainWindow(Menu& menu)
set_default_size(1000, 600);
set_position(Gtk::WIN_POS_CENTER_ALWAYS);
// Add menu to box (top), no expand/fill
vbox.pack_start(menu, false, false);
......@@ -48,16 +50,6 @@ MainWindow::MainWindow(Menu& menu)
CreateLeftPanel();
CreateRightPanel();
// Move this code to the controller!
std::vector<WineBottle> bottles;
bottles.push_back(*new WineBottle("Windows 10 (32bit)", "5.1", "~/.fadsad", "~/.sadasd", "07-07-2019 2:10AM"));
bottles.push_back(*new WineBottle("Windows 10 (64bit)", true, BottleTypes::Windows10, BottleTypes::win64, "5.1", "~/.fadsad", "~/.sadasd", "07-07-2019 2:10AM", BottleTypes::AudioDriver::pulseaudio, "Disabled"));
bottles.push_back(*new WineBottle("Steam Bottle", false, BottleTypes::Windows7, BottleTypes::win32, "5.1", "~/.fadsad", "~/.sadasd", "07-07-2019 2:10AM", BottleTypes::AudioDriver::pulseaudio, "Disabled"));
SetWineBottles(bottles);
// Move this code to the controller as well!
SetDetailedInfo(*new WineBottle("Steam Bottle", true, BottleTypes::Windows10, BottleTypes::win64, "4.0.1", "~/.winegui/prefixes/win7_64", "~/.winegui/prefixes/win7_64/dosdevices/c:/", "07-07-2019 2:10AM", BottleTypes::AudioDriver::pulseaudio, "Disabled"));
// Using a Vertical box container
add(vbox);
......@@ -92,9 +84,9 @@ void MainWindow::on_hide_window()
* \brief Set a vector of bottles to the left panel
* \param[in] bottles - WineBottle vector array
*/
void MainWindow::SetWineBottles(std::vector<WineBottle> bottles)
void MainWindow::SetWineBottles(const std::vector<WineBottle>& bottles)
{
for (const WineBottle& bottle : bottles)
for(const WineBottle& bottle : bottles)
{
// To lower case
string windows = str_tolower(BottleTypes::toString(bottle.windows()));
......@@ -151,6 +143,8 @@ void MainWindow::SetWineBottles(std::vector<WineBottle> bottles)
listbox.add(*row);
row->show();
}
// Update show
show_all_children();
}
/**
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment