Changeset 38 for trunk/OpenYahtzee/src/MainFrame.cpp
- Timestamp:
- 09/01/07 20:56:05 (6 years ago)
- File:
-
- 1 edited
-
trunk/OpenYahtzee/src/MainFrame.cpp (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/OpenYahtzee/src/MainFrame.cpp
r37 r38 47 47 48 48 //include the icon file 49 #ifdef WIN32 50 #include "icon32.xpm" 51 #else 52 #include "icon.xpm" 53 #endif 49 #include "Icon.h" 54 50 55 51 //default values 56 52 #define SPACE_SIZE 1 57 53 #define DEF_HIGHSCORESIZE 16 54 #define OY_VERSION "1.6.0" 58 55 59 56 MainFrame::MainFrame(const wxString& title, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_FRAME_STYLE) … … 61 58 { 62 59 //give the frame an icon 63 #ifdef WIN32 64 SetIcon(wxIcon(icon32_xpm)); 65 #else 66 SetIcon(wxIcon(icon_xpm)); 67 #endif 60 SetIcon(wxIcon(ICON)); 61 68 62 69 63 std::ostringstream sstr; … … 102 96 103 97 //insert menu items into menu Help 98 helpMenu->Append(ID_CHECK_FOR_UPDATES, wxT("&Check for Updates"), 99 wxT("Check for new version of the game via the web")); 104 100 helpMenu->Append(wxID_ABOUT, wxT("&About...\tF1"), 105 101 wxT("Show about dialog")); … … 224 220 Connect(wxID_EXIT, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MainFrame::OnQuit)); 225 221 Connect(wxID_ABOUT, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MainFrame::OnAbout)); 222 Connect(ID_CHECK_FOR_UPDATES, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MainFrame::OnCheckForUpdates)); 226 223 Connect(ID_NEWGAME, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MainFrame::OnNewGame)); 227 224 Connect(ID_UNDO, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MainFrame::OnUndo)); … … 256 253 wxString msg; 257 254 wxString sqliteversion = wxString(sqlite3_version,wxConvUTF8); 258 msg.Printf(wxT("OpenYahtzee 1.6\nCopyright (C) 2006 by Guy Rutenberg\n\nThis program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.\n\nOpenYahtzee was built against:\nwxWidgets %i.%i\n"),wxMAJOR_VERSION,wxMINOR_VERSION);255 msg.Printf(wxT("OpenYahtzee %s\nCopyright (C) 2006 by Guy Rutenberg\n\nThis program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.\n\nOpenYahtzee was built against:\nwxWidgets %i.%i\n"),wxT(OY_VERSION),wxMAJOR_VERSION,wxMINOR_VERSION); 259 256 msg += wxT("SQLite ") + sqliteversion; 260 257 261 258 wxMessageBox(msg, wxT("About Yahtzee"), wxOK | wxICON_INFORMATION, this); 259 } 260 261 void MainFrame::OnCheckForUpdates (wxCommandEvent& event){ 262 263 wxString path; 264 wxPathList path_list; 265 wxString link = wxT("http://openyahtzee.sourceforge.net/update.php?version="); 266 267 link += wxT(OY_VERSION); 268 269 if (!wxLaunchDefaultBrowser(link)){ 270 //if builtin function doesn't work search for couple of browsers manually. see 271 //http://linux-consulting.buanzo.com.ar/2006/05/wxwidgets-code-to-launch-browser.html 272 273 // variable declarations 274 wxArrayString browsers; 275 wxPathList path_list; 276 bool BrowserWasFound = false; 277 unsigned int i = 0; 278 wxString path; 279 280 // Add directories to wxPathList's search path from PATH environment variable 281 path_list.AddEnvList(wxT("PATH")); 282 283 // Add browsers filenames. First item = most priority 284 browsers.Add(wxT("firefox")); 285 browsers.Add(wxT("firefox-bin")); 286 browsers.Add(wxT("mozilla")); 287 browsers.Add(wxT("mozilla-bin")); 288 browsers.Add(wxT("opera")); 289 browsers.Add(wxT("konqueror")); 290 browsers.Add(wxT("epiphany")); 291 292 for (i = 0; i < browsers.GetCount(); i++) { 293 path = path_list.FindAbsoluteValidPath(browsers[i]); 294 if (path.IsEmpty()) { 295 continue; 296 } else { 297 BrowserWasFound = true; 298 break; 299 } 300 } 301 302 browsers.Clear(); 303 304 if (BrowserWasFound) { 305 path += wxT(" "); 306 path += link; 307 ::wxExecute(path); 308 } else { 309 wxMessageBox(wxT("No browser has been found."),wxT("OpenYahtzee")); 310 } 311 } 312 313 262 314 } 263 315
Note: See TracChangeset
for help on using the changeset viewer.
