file association for mac!
authorkoda
Sat, 18 Jun 2011 03:14:45 +0200
changeset 5252 ded882439548
parent 5251 f31d1073345e
child 5253 6a700868528b
file association for mac! associating file is done automatically when you move the app in your system but there is also a button to set it manually i had to disable argument parsing and to subclass qapplication to make this work please test
QTfrontend/CMakeLists.txt
QTfrontend/HWApplication.cpp
QTfrontend/HWApplication.h
QTfrontend/SDLs.cpp
QTfrontend/chatwidget.cpp
QTfrontend/drawmapwidget.cpp
QTfrontend/drawmapwidget.h
QTfrontend/gameuiconfig.cpp
QTfrontend/hwform.cpp
QTfrontend/hwform.h
QTfrontend/main.cpp
QTfrontend/mapContainer.cpp
QTfrontend/namegen.cpp
QTfrontend/pageeditteam.cpp
QTfrontend/pageoptions.cpp
QTfrontend/team.cpp
share/CMakeLists.txt
share/Info.plist.in
share/hwico.icns
--- a/QTfrontend/CMakeLists.txt	Wed Jun 15 23:59:44 2011 +0200
+++ b/QTfrontend/CMakeLists.txt	Sat Jun 18 03:14:45 2011 +0200
@@ -46,6 +46,7 @@
 configure_file(${CMAKE_CURRENT_SOURCE_DIR}/hwconsts.cpp.in ${CMAKE_CURRENT_BINARY_DIR}/hwconsts.cpp)
 
 set(hwfr_src
+    HWApplication.cpp
     game.cpp
     main.cpp
     hwform.cpp
@@ -130,6 +131,7 @@
 endif(MINGW)
 
 set(hwfr_moc_hdrs
+    HWApplication.h
     game.h
     hats.h
     hwform.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/QTfrontend/HWApplication.cpp	Sat Jun 18 03:14:45 2011 +0200
@@ -0,0 +1,45 @@
+/*
+ * Hedgewars, a free turn based strategy game
+ * Copyright (c) 2005-2011 Andrey Korotaev <unC0Rr@gmail.com>
+ *
+ * This 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; version 2 of the License
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ */
+
+#include "HWApplication.h"
+#include <QFileOpenEvent>
+
+#include "hwform.h"
+
+HWApplication::HWApplication(int argc,  char **argv):
+     QApplication(argc,argv)
+{
+
+}
+
+bool HWApplication::event(QEvent *event) {
+    QFileOpenEvent *openEvent;
+    switch (event->type()) {
+        case QEvent::FileOpen:
+            openEvent = (QFileOpenEvent *)event;
+            form->PlayDemoQuick(openEvent->file());
+
+            return true;
+            break;
+        default:
+            return QApplication::event(event);
+            break;
+    }
+}
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/QTfrontend/HWApplication.h	Sat Jun 18 03:14:45 2011 +0200
@@ -0,0 +1,42 @@
+/*
+ * Hedgewars, a free turn based strategy game
+ * Copyright (c) 2005-2011 Andrey Korotaev <unC0Rr@gmail.com>
+ *
+ * This 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; version 2 of the License
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ */
+
+#ifndef HWAPP_H
+#define HWAPP_H
+
+#include <QApplication>
+#include <QString>
+#include <QEvent>
+
+class HWForm;
+
+class HWApplication : public QApplication
+{
+    Q_OBJECT
+public:
+    HWApplication(int argc, char **argv);
+    ~HWApplication() {};
+
+    HWForm *form;
+    QString *fileToLoad;
+protected:
+    bool event(QEvent *);
+};
+
+#endif
+
--- a/QTfrontend/SDLs.cpp	Wed Jun 15 23:59:44 2011 +0200
+++ b/QTfrontend/SDLs.cpp	Sat Jun 18 03:14:45 2011 +0200
@@ -21,8 +21,7 @@
 #include "SDL.h"
 #include "SDL_mixer.h"
 #include "hwconsts.h"
-
-#include <QApplication>
+#include "HWApplication.h"
 
 
 extern char sdlkeys[1024][2][128];
@@ -101,38 +100,38 @@
         for(int aid = 0; aid < SDL_JoystickNumAxes(joy) && i < 1021; aid++)
         {
             // Again store the part of the string not changing for multiple uses
-            QString axis = prefix + QApplication::translate("binds (keys)", "Axis") + QString(" %1 ").arg(aid + 1);
+            QString axis = prefix + HWApplication::translate("binds (keys)", "Axis") + QString(" %1 ").arg(aid + 1);
 
             // Entry for "Axis Up"
             sprintf(sdlkeys[i][0], "j%da%du", jid, aid);
-            sprintf(sdlkeys[i++][1], "%s", ((isxb && aid < 5) ? (prefix + QApplication::translate("binds (keys)", xbox360axes[aid * 2])) : axis + QApplication::translate("binds (keys)", "(Up)")).toStdString().c_str());
+            sprintf(sdlkeys[i++][1], "%s", ((isxb && aid < 5) ? (prefix + HWApplication::translate("binds (keys)", xbox360axes[aid * 2])) : axis + HWApplication::translate("binds (keys)", "(Up)")).toStdString().c_str());
 
             // Entry for "Axis Down"
             sprintf(sdlkeys[i][0], "j%da%dd", jid, aid);
-            sprintf(sdlkeys[i++][1], "%s", ((isxb && aid < 5) ? (prefix + QApplication::translate("binds (keys)", xbox360axes[aid * 2 + 1])) : axis + QApplication::translate("binds (keys)", "(Down)")).toStdString().c_str());
+            sprintf(sdlkeys[i++][1], "%s", ((isxb && aid < 5) ? (prefix + HWApplication::translate("binds (keys)", xbox360axes[aid * 2 + 1])) : axis + HWApplication::translate("binds (keys)", "(Down)")).toStdString().c_str());
         }
 
         // Register entries for all coolie hats of this joystick/gamepad
         for(int hid = 0; hid < SDL_JoystickNumHats(joy) && i < 1019; hid++)
         {
             // Again store the part of the string not changing for multiple uses
-            QString hat = prefix + (isxb ? (QApplication::translate("binds (keys)", xb360dpad) + QString(" ")) : QApplication::translate("binds (keys)", "Hat") + QString(" %1 ").arg(hid + 1));
+            QString hat = prefix + (isxb ? (HWApplication::translate("binds (keys)", xb360dpad) + QString(" ")) : HWApplication::translate("binds (keys)", "Hat") + QString(" %1 ").arg(hid + 1));
 
             // Entry for "Hat Up"
             sprintf(sdlkeys[i][0], "j%dh%du", jid, hid);
-            sprintf(sdlkeys[i++][1], "%s", (hat + QApplication::translate("binds (keys)", "(Up)")).toStdString().c_str());
+            sprintf(sdlkeys[i++][1], "%s", (hat + HWApplication::translate("binds (keys)", "(Up)")).toStdString().c_str());
 
             // Entry for "Hat Down"
             sprintf(sdlkeys[i][0], "j%dh%dd", jid, hid);
-            sprintf(sdlkeys[i++][1], "%s", (hat + QApplication::translate("binds (keys)", "(Down)")).toStdString().c_str());
+            sprintf(sdlkeys[i++][1], "%s", (hat + HWApplication::translate("binds (keys)", "(Down)")).toStdString().c_str());
 
             // Entry for "Hat Left"
             sprintf(sdlkeys[i][0], "j%dh%dl", jid, hid);
-            sprintf(sdlkeys[i++][1], "%s", (hat + QApplication::translate("binds (keys)", "(Left)")).toStdString().c_str());
+            sprintf(sdlkeys[i++][1], "%s", (hat + HWApplication::translate("binds (keys)", "(Left)")).toStdString().c_str());
 
             // Entry for "Hat Right"
             sprintf(sdlkeys[i][0], "j%dh%dr", jid, hid);
-            sprintf(sdlkeys[i++][1], "%s", (hat + QApplication::translate("binds (keys)", "(Right)")).toStdString().c_str());
+            sprintf(sdlkeys[i++][1], "%s", (hat + HWApplication::translate("binds (keys)", "(Right)")).toStdString().c_str());
         }
 
         // Register entries for all buttons of this joystick/gamepad
@@ -140,7 +139,7 @@
         {
             // Buttons
             sprintf(sdlkeys[i][0], "j%db%d", jid, bid);
-            sprintf(sdlkeys[i++][1], "%s", (prefix + ((isxb && bid < 10) ? (QApplication::translate("binds (keys)", xb360buttons[bid]) + QString(" ")) : QApplication::translate("binds (keys)", "Button") + QString(" %1").arg(bid + 1))).toStdString().c_str());
+            sprintf(sdlkeys[i++][1], "%s", (prefix + ((isxb && bid < 10) ? (HWApplication::translate("binds (keys)", xb360buttons[bid]) + QString(" ")) : HWApplication::translate("binds (keys)", "Button") + QString(" %1").arg(bid + 1))).toStdString().c_str());
         }
         // Close the game controller as we no longer need it
         SDL_JoystickClose(joy);
--- a/QTfrontend/chatwidget.cpp	Wed Jun 15 23:59:44 2011 +0200
+++ b/QTfrontend/chatwidget.cpp	Sat Jun 18 03:14:45 2011 +0200
@@ -21,7 +21,6 @@
 #include <QTextBrowser>
 #include <QLineEdit>
 #include <QAction>
-#include <QApplication>
 #include <QTextDocument>
 #include <QDir>
 #include <QSettings>
--- a/QTfrontend/drawmapwidget.cpp	Wed Jun 15 23:59:44 2011 +0200
+++ b/QTfrontend/drawmapwidget.cpp	Sat Jun 18 03:14:45 2011 +0200
@@ -18,6 +18,7 @@
 
 #include <QFile>
 #include <QMessageBox>
+#include <QEvent>
 
 #include "drawmapwidget.h"
 
--- a/QTfrontend/drawmapwidget.h	Wed Jun 15 23:59:44 2011 +0200
+++ b/QTfrontend/drawmapwidget.h	Sat Jun 18 03:14:45 2011 +0200
@@ -23,7 +23,6 @@
 #include <QHBoxLayout>
 #include <QPushButton>
 #include <QGraphicsView>
-#include <QApplication>
 
 #include "qaspectratiolayout.h"
 #include "drawmapscene.h"
--- a/QTfrontend/gameuiconfig.cpp	Wed Jun 15 23:59:44 2011 +0200
+++ b/QTfrontend/gameuiconfig.cpp	Sat Jun 18 03:14:45 2011 +0200
@@ -20,7 +20,6 @@
 #include <QCheckBox>
 #include <QLineEdit>
 #include <QDesktopWidget>
-#include <QApplication>
 #include <QInputDialog>
 #include <QCryptographicHash>
 
@@ -30,6 +29,7 @@
 #include "pagenetserver.h"
 #include "hwconsts.h"
 #include "fpsedit.h"
+#include "HWApplication.h"
 
 GameUIConfig::GameUIConfig(HWForm * FormWidgets, const QString & fileName)
     : QSettings(fileName, QSettings::IniFormat)
@@ -97,7 +97,7 @@
 
     Form->ui.pageOptions->CBLanguage->setCurrentIndex(Form->ui.pageOptions->CBLanguage->findData(value("misc/locale", "").toString()));
 
-    depth = QApplication::desktop()->depth();
+    depth = HWApplication::desktop()->depth();
     if (depth < 16) depth = 16;
     else if (depth > 16) depth = 32;
 }
--- a/QTfrontend/hwform.cpp	Wed Jun 15 23:59:44 2011 +0200
+++ b/QTfrontend/hwform.cpp	Sat Jun 18 03:14:45 2011 +0200
@@ -182,9 +182,7 @@
     connect(ui.pageOptions->BtnDeleteTeam, SIGNAL(clicked()), this, SLOT(DeleteTeam()));
     connect(ui.pageOptions->BtnSaveOptions, SIGNAL(clicked()), config, SLOT(SaveOptions()));
     connect(ui.pageOptions->BtnSaveOptions, SIGNAL(clicked()), this, SLOT(GoBack()));
-#ifndef __APPLE__
     connect(ui.pageOptions->BtnAssociateFiles, SIGNAL(clicked()), this, SLOT(AssociateFiles()));
-#endif
 
     connect(ui.pageOptions->WeaponEdit, SIGNAL(clicked()), this, SLOT(GoToSelectWeapon()));
     connect(ui.pageOptions->WeaponNew, SIGNAL(clicked()), this, SLOT(GoToSelectNewWeapon()));
@@ -713,12 +711,18 @@
                 tr("Error"),
                 tr("Please select record from the list above"),
                 tr("OK"));
-        return ;
+        return;
     }
     CreateGame(0, 0, 0);
     game->PlayDemo(curritem->data(Qt::UserRole).toString());
 }
 
+void HWForm::PlayDemoQuick(const QString & demofilename)
+{
+    CreateGame(0, 0, 0);
+    game->PlayDemo(demofilename);
+}
+
 void HWForm::NetConnectServer(const QString & host, quint16 port)
 {
     _NetConnect(host, port, ui.pageOptions->editNetNick->text().trimmed());
@@ -1253,8 +1257,10 @@
     registry_hkcr.setValue("Hedgewars.Demo/Shell/Open/Command/Default", "\"" + bindir->absolutePath().replace("/", "\\") + "\\hwengine.exe\" \"" + cfgdir->absolutePath().replace("/","\\") + "\" \"" + datadir->absolutePath().replace("/", "\\") + "\" \"%1\" --set-everything "+arguments);
     registry_hkcr.setValue("Hedgewars.Save/Shell/Open/Command/Default", "\"" + bindir->absolutePath().replace("/", "\\") + "\\hwengine.exe\" \"" + cfgdir->absolutePath().replace("/","\\") + "\" \"" + datadir->absolutePath().replace("/", "\\") + "\" \"%1\" --set-everything "+arguments);
 #elif defined __APPLE__
-    success = false;
-    // TODO; also enable button in pages.cpp and signal in hwform.cpp
+    // only useful when other apps have taken precedence over our file extensions and you want to reset it
+    system("defaults write com.apple.LaunchServices LSHandlers -array-add '<dict><key>LSHandlerContentTag</key><string>hwd</string><key>LSHandlerContentTagClass</key><string>public.filename-extension</string><key>LSHandlerRoleAll</key><string>org.hedgewars.desktop</string></dict>'");
+    system("defaults write com.apple.LaunchServices LSHandlers -array-add '<dict><key>LSHandlerContentTag</key><string>hws</string><key>LSHandlerContentTagClass</key><string>public.filename-extension</string><key>LSHandlerRoleAll</key><string>org.hedgewars.desktop</string></dict>'");
+    system("/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -kill -domain local -domain system -domain user");
 #else
     // this is a little silly due to all the system commands below anyway - just use mkdir -p ?  Does have the advantage of the alert I guess
     if (success) success = checkForDir(QDir::home().absolutePath() + "/.local");
--- a/QTfrontend/hwform.h	Wed Jun 15 23:59:44 2011 +0200
+++ b/QTfrontend/hwform.h	Sat Jun 18 03:14:45 2011 +0200
@@ -58,6 +58,7 @@
     GameUIConfig * config;
     QSettings * gameSettings; // Same file GameUIConfig points to but without the baggage.  Needs sync() calls if you want to get GameUIConfig changes though
     void updateXfire();
+    void PlayDemoQuick(const QString & demofilename);
 
 private slots:
     void GoToSaves();
@@ -161,7 +162,7 @@
     QSignalMapper * pageSwitchMapper;
 
 #ifdef __APPLE__
-        InstallController * panel;
+    InstallController * panel;
 #endif
 
     void OnPageShown(quint8 id, quint8 lastid=0);
--- a/QTfrontend/main.cpp	Wed Jun 15 23:59:44 2011 +0200
+++ b/QTfrontend/main.cpp	Sat Jun 18 03:14:45 2011 +0200
@@ -16,7 +16,8 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
  */
 
-#include <QApplication>
+#include "HWApplication.h"
+
 #include <QTranslator>
 #include <QLocale>
 #include <QMessageBox>
@@ -51,11 +52,14 @@
 }
 
 int main(int argc, char *argv[]) {
-    QApplication app(argc, argv);
+    HWApplication app(argc, argv);
     app.setAttribute(Qt::AA_DontShowIconsInMenus,false);
 
     QStringList arguments = app.arguments();
     QMap<QString, QString> parsedArgs;
+#ifndef __APPLE__
+//HACK: it's difficult/rarely done to use command line args on macs anyways
+//      but why does this section of code make the app crash when opening a file?
     {
         QList<QString>::iterator i = arguments.begin();
         while(i != arguments.end()) {
@@ -70,6 +74,7 @@
             }
         }
     }
+#endif
 
     if(parsedArgs.contains("data-dir")) {
         QFileInfo f(parsedArgs["data-dir"]);
@@ -455,8 +460,8 @@
     CocoaInitializer initializer;
 #endif
 
-    HWForm *Form = new HWForm();
+    app.form = new HWForm();
 
-    Form->show();
+    app.form->show();
     return app.exec();
 }
--- a/QTfrontend/mapContainer.cpp	Wed Jun 15 23:59:44 2011 +0200
+++ b/QTfrontend/mapContainer.cpp	Sat Jun 18 03:14:45 2011 +0200
@@ -24,7 +24,6 @@
 #include <QLinearGradient>
 #include <QColor>
 #include <QTextStream>
-#include <QApplication>
 #include <QLabel>
 #include <QListWidget>
 #include <QVBoxLayout>
@@ -35,6 +34,7 @@
 #include "hwconsts.h"
 #include "mapContainer.h"
 #include "igbox.h"
+#include "HWApplication.h"
 
 HWMapContainer::HWMapContainer(QWidget * parent) :
     QWidget(parent),
@@ -46,10 +46,10 @@
     hhLimit = 18;
     templateFilter = 0;
 
-    mainLayout.setContentsMargins(QApplication::style()->pixelMetric(QStyle::PM_LayoutLeftMargin),
+    mainLayout.setContentsMargins(HWApplication::style()->pixelMetric(QStyle::PM_LayoutLeftMargin),
         1,
-        QApplication::style()->pixelMetric(QStyle::PM_LayoutRightMargin),
-        QApplication::style()->pixelMetric(QStyle::PM_LayoutBottomMargin));
+        HWApplication::style()->pixelMetric(QStyle::PM_LayoutRightMargin),
+        HWApplication::style()->pixelMetric(QStyle::PM_LayoutBottomMargin));
 
     QWidget* mapWidget = new QWidget(this);
     mainLayout.addWidget(mapWidget, 0, 0, Qt::AlignHCenter);
--- a/QTfrontend/namegen.cpp	Wed Jun 15 23:59:44 2011 +0200
+++ b/QTfrontend/namegen.cpp	Sat Jun 18 03:14:45 2011 +0200
@@ -19,7 +19,6 @@
 
 #include <QFile>
 #include <QTextStream>
-#include <QApplication>
 #include <QStringList>
 #include <QLineEdit>
 #include "namegen.h"
--- a/QTfrontend/pageeditteam.cpp	Wed Jun 15 23:59:44 2011 +0200
+++ b/QTfrontend/pageeditteam.cpp	Sat Jun 18 03:14:45 2011 +0200
@@ -24,13 +24,13 @@
 #include <QTabWidget>
 #include <QGroupBox>
 #include <QToolBox>
-#include <QApplication>
 
 #include "pageeditteam.h"
 #include "sdlkeys.h"
 #include "hwconsts.h"
 #include "SquareLabel.h"
 #include "hats.h"
+#include "HWApplication.h"
 
 PageEditTeam::PageEditTeam(QWidget* parent, SDLInteraction * sdli) :
   AbstractPage(parent)
@@ -315,24 +315,24 @@
                 pagelayout->addWidget(l, num++, 0, 1, 2);
             }
             curW = new QWidget(this);
-            BindsBox->addItem(curW, QApplication::translate("binds (categories)", cbinds[i].category));
+            BindsBox->addItem(curW, HWApplication::translate("binds (categories)", cbinds[i].category));
             pagelayout = new QGridLayout(curW);
             num = 0;
         }
         if(cbinds[i].description != NULL)
         {
             l = new QLabel(curW);
-            l->setText((num > 0 ? QString("\n") : QString("")) + QApplication::translate("binds (descriptions)", cbinds[i].description));
+            l->setText((num > 0 ? QString("\n") : QString("")) + HWApplication::translate("binds (descriptions)", cbinds[i].description));
             pagelayout->addWidget(l, num++, 0, 1, 2);
         }
 
         l = new QLabel(curW);
-        l->setText(QApplication::translate("binds", cbinds[i].name));
+        l->setText(HWApplication::translate("binds", cbinds[i].name));
         l->setAlignment(Qt::AlignRight);
         pagelayout->addWidget(l, num, 0);
         CBBind[i] = new QComboBox(curW);
         for(int j = 0; sdlkeys[j][1][0] != '\0'; j++)
-            CBBind[i]->addItem(QApplication::translate("binds (keys)", sdlkeys[j][1]).contains(": ") ? QApplication::translate("binds (keys)", sdlkeys[j][1]) : QApplication::translate("binds (keys)", "Keyboard") + QString(": ") + QApplication::translate("binds (keys)", sdlkeys[j][1]), sdlkeys[j][0]);
+            CBBind[i]->addItem(HWApplication::translate("binds (keys)", sdlkeys[j][1]).contains(": ") ? HWApplication::translate("binds (keys)", sdlkeys[j][1]) : HWApplication::translate("binds (keys)", "Keyboard") + QString(": ") + HWApplication::translate("binds (keys)", sdlkeys[j][1]), sdlkeys[j][0]);
         pagelayout->addWidget(CBBind[i++], num++, 1);
     }
 }
--- a/QTfrontend/pageoptions.cpp	Wed Jun 15 23:59:44 2011 +0200
+++ b/QTfrontend/pageoptions.cpp	Sat Jun 18 03:14:45 2011 +0200
@@ -239,16 +239,15 @@
             CBNameWithDate->setText(QCheckBox::tr("Append date and time to record file name"));
             MiscLayout->addWidget(CBNameWithDate, 4, 0, 1, 2);
 
-#ifdef SPARKLE_ENABLED
-            CBAutoUpdate = new QCheckBox(groupMisc);
-            CBAutoUpdate->setText(QCheckBox::tr("Check for updates at startup"));
-            MiscLayout->addWidget(CBAutoUpdate, 5, 0, 1, 2);
-#endif
-#ifndef __APPLE__
             BtnAssociateFiles = new QPushButton(groupMisc);
             BtnAssociateFiles->setText(QPushButton::tr("Associate file extensions"));
             BtnAssociateFiles->setEnabled(!custom_data && !custom_config);
             MiscLayout->addWidget(BtnAssociateFiles, 5, 0, 1, 2);
+
+#ifdef __APPLE__ && SPARKLE_ENABLED
+            CBAutoUpdate = new QCheckBox(groupMisc);
+            CBAutoUpdate->setText(QCheckBox::tr("Check for updates at startup"));
+            MiscLayout->addWidget(CBAutoUpdate, 6, 0, 1, 3);
 #endif
             gbTBLayout->addWidget(groupMisc, 2, 0);
         }
--- a/QTfrontend/team.cpp	Wed Jun 15 23:59:44 2011 +0200
+++ b/QTfrontend/team.cpp	Sat Jun 18 03:14:45 2011 +0200
@@ -18,11 +18,11 @@
 
 #include <QFile>
 #include <QTextStream>
-#include <QApplication>
 #include <QStringList>
 #include <QLineEdit>
 #include <QCryptographicHash>
 #include <QSettings>
+
 #include "team.h"
 #include "hwform.h"
 #include "pageeditteam.h"
--- a/share/CMakeLists.txt	Wed Jun 15 23:59:44 2011 +0200
+++ b/share/CMakeLists.txt	Sat Jun 18 03:14:45 2011 +0200
@@ -20,6 +20,8 @@
 		DESTINATION ../)
 	install(PROGRAMS "${hedgewars_SOURCE_DIR}/share/Icon.icns"
 		DESTINATION ../Resources/)
+	install(PROGRAMS "${hedgewars_SOURCE_DIR}/share/hwico.icns"
+		DESTINATION ../Resources/)
 	install(PROGRAMS "${hedgewars_SOURCE_DIR}/share/dsa_pub.pem"
 		DESTINATION ../Resources/)
 ENDIF(APPLE)
--- a/share/Info.plist.in	Wed Jun 15 23:59:44 2011 +0200
+++ b/share/Info.plist.in	Sat Jun 18 03:14:45 2011 +0200
@@ -75,5 +75,81 @@
 		<string>zh_CN</string>
 		<string>zh_TW</string>
 	</array>
+	<key>UTExportedTypeDeclarations</key>
+	<array>
+		<dict>
+			<key>UTTypeIdentifier</key>
+			<string>org.hedgewars.desktop.hws</string>
+			<key>UTTypeReferenceURL</key>
+			<string>http://www.hedgewars.org/demos/</string>
+			<key>UTTypeDescription</key>
+			<string>Hedgewars Save Game</string>
+			<key>UTTypeIconFile</key>
+			<string>public.text.icns</string>
+			<key>UTTypeConformsTo</key>
+			<array>
+				<string>public.data</string>
+			</array>
+			<key>UTTypeTagSpecification</key>
+			<dict>
+				<key>public.filename-extension</key>
+				<array>
+					<string>hws</string>
+				</array>
+				<key>public.mime-type</key>
+				<string>application/x-hedgewars-save</string>
+			</dict>
+		</dict>
+		<dict>
+			<key>UTTypeIdentifier</key>
+			<string>org.hedgewars.desktop.hwd</string>
+			<key>UTTypeReferenceURL</key>
+			<string>http://www.hedgewars.org/demos/</string>
+			<key>UTTypeIconFile</key>
+			<string>public.text.icns</string>
+			<key>UTTypeDescription</key>
+			<string>Hedgewars Demo Game</string>
+			<key>UTTypeConformsTo</key>
+			<array>
+				<string>public.data</string>
+			</array>
+			<key>UTTypeTagSpecification</key>
+			<dict>
+				<key>public.filename-extension</key>
+				<array>
+					<string>hwd</string>
+				</array>
+				<key>public.mime-type</key>
+				<string>application/x-hedgewars-demo</string>
+			</dict>
+		</dict>
+	</array>
+	<key>CFBundleDocumentTypes</key>
+	<array>
+		<dict>
+			<key>CFBundleTypeIconFile</key>
+			<string>hwico.icns</string>
+			<key>CFBundleTypeName</key>
+			<string>Hedgewars Savefile</string>
+			<key>LSItemContentTypes</key>
+			<array>
+				<string>org.hedgewars.desktop.hws</string>
+			</array>
+			<key>CFBundleTypeRole</key>
+			<string>Editor</string>
+		</dict>
+		<dict>
+			<key>CFBundleTypeIconFile</key>
+			<string>hwico.icns</string>
+			<key>CFBundleTypeName</key>
+			<string>Hedgewars Demofile</string>
+			<key>LSItemContentTypes</key>
+			<array>
+				<string>org.hedgewars.desktop.hwd</string>
+			</array>
+			<key>CFBundleTypeRole</key>
+			<string>Viewer</string>
+		</dict>
+	</array>
 </dict>
 </plist>
Binary file share/hwico.icns has changed