forked from Mirrors/openclonk
Editor: Add "open in network" to file menu and to new scenario dialogue
parent
4b508134f8
commit
04b5f82080
|
@ -59,6 +59,8 @@ IDS_CNS_GAMECLOSED=Spiel deinitialisiert.
|
||||||
IDS_CNS_GAMEMODE=Spielmodus
|
IDS_CNS_GAMEMODE=Spielmodus
|
||||||
IDS_CNS_GAMESAVED=Spiel gespeichert.
|
IDS_CNS_GAMESAVED=Spiel gespeichert.
|
||||||
IDS_CNS_HEIGHT=Höhe
|
IDS_CNS_HEIGHT=Höhe
|
||||||
|
IDS_CNS_HOSTASNETWORKGAME=Als Netzwerkspiel hosten
|
||||||
|
IDS_CNS_HOSTASNETWORKGAMEDESC=Started das Spiel in einer Netzwerklobby, so dass andere Spieler beitreten und mit editieren koennen.
|
||||||
IDS_CNS_INDEXSHORT=Idx
|
IDS_CNS_INDEXSHORT=Idx
|
||||||
IDS_CNS_INTERNAL=Intern
|
IDS_CNS_INTERNAL=Intern
|
||||||
IDS_CNS_INVALID=Ungültig
|
IDS_CNS_INVALID=Ungültig
|
||||||
|
@ -542,6 +544,7 @@ IDS_MNU_NEWVIEWPORT=Neues Sichtfenster
|
||||||
IDS_MNU_NEXTVIEWPORT=Nächstes Sichtfenster auswählen
|
IDS_MNU_NEXTVIEWPORT=Nächstes Sichtfenster auswählen
|
||||||
IDS_MNU_OPEN=Öffnen...
|
IDS_MNU_OPEN=Öffnen...
|
||||||
IDS_MNU_OPENMATERIALSELECTION=Materialauswahl öffnen
|
IDS_MNU_OPENMATERIALSELECTION=Materialauswahl öffnen
|
||||||
|
IDS_MNU_OPENNET=Öffnen als Netzwerkspiel...
|
||||||
IDS_MNU_OPENWPLRS=Öffnen mit Spielern...
|
IDS_MNU_OPENWPLRS=Öffnen mit Spielern...
|
||||||
IDS_MNU_OPTIONS=Optionen
|
IDS_MNU_OPTIONS=Optionen
|
||||||
IDS_MNU_OPTIONSINFO=Einstellungen ändern.
|
IDS_MNU_OPTIONSINFO=Einstellungen ändern.
|
||||||
|
|
|
@ -59,6 +59,8 @@ IDS_CNS_GAMECLOSED=Game cleared.
|
||||||
IDS_CNS_GAMEMODE=Game mode
|
IDS_CNS_GAMEMODE=Game mode
|
||||||
IDS_CNS_GAMESAVED=Game saved.
|
IDS_CNS_GAMESAVED=Game saved.
|
||||||
IDS_CNS_HEIGHT=Height
|
IDS_CNS_HEIGHT=Height
|
||||||
|
IDS_CNS_HOSTASNETWORKGAME=Host as network game
|
||||||
|
IDS_CNS_HOSTASNETWORKGAMEDESC=Starts the scenario in a network lobby, allowing other clients to join.
|
||||||
IDS_CNS_INDEXSHORT=Idx
|
IDS_CNS_INDEXSHORT=Idx
|
||||||
IDS_CNS_INTERNAL=Internal
|
IDS_CNS_INTERNAL=Internal
|
||||||
IDS_CNS_INVALID=Invalid
|
IDS_CNS_INVALID=Invalid
|
||||||
|
@ -542,6 +544,7 @@ IDS_MNU_NEW=New...
|
||||||
IDS_MNU_NEWVIEWPORT=New viewport
|
IDS_MNU_NEWVIEWPORT=New viewport
|
||||||
IDS_MNU_OPEN=Open...
|
IDS_MNU_OPEN=Open...
|
||||||
IDS_MNU_OPENMATERIALSELECTION=Popup material selection
|
IDS_MNU_OPENMATERIALSELECTION=Popup material selection
|
||||||
|
IDS_MNU_OPENNET=Open as network game...
|
||||||
IDS_MNU_OPENWPLRS=Open with players...
|
IDS_MNU_OPENWPLRS=Open with players...
|
||||||
IDS_MNU_OPTIONS=Options
|
IDS_MNU_OPTIONS=Options
|
||||||
IDS_MNU_OPTIONSINFO=Change program options.
|
IDS_MNU_OPTIONSINFO=Change program options.
|
||||||
|
|
|
@ -260,9 +260,15 @@ bool C4Console::FileNew()
|
||||||
{
|
{
|
||||||
StdCopyStrBuf filename;
|
StdCopyStrBuf filename;
|
||||||
#ifdef WITH_QT_EDITOR
|
#ifdef WITH_QT_EDITOR
|
||||||
if (!C4ConsoleGUI::CreateNewScenario(&filename)) return false;
|
bool host_in_network = false;
|
||||||
|
if (!C4ConsoleGUI::CreateNewScenario(&filename, &host_in_network)) return false;
|
||||||
Application.ClearCommandLine();
|
Application.ClearCommandLine();
|
||||||
::Config.Developer.AddRecentlyEditedScenario(filename.getData());
|
::Config.Developer.AddRecentlyEditedScenario(filename.getData());
|
||||||
|
if (host_in_network)
|
||||||
|
{
|
||||||
|
Game.NetworkActive = true;
|
||||||
|
Game.fLobby = true;
|
||||||
|
}
|
||||||
Application.OpenGame(filename.getData());
|
Application.OpenGame(filename.getData());
|
||||||
return true;
|
return true;
|
||||||
#endif
|
#endif
|
||||||
|
@ -271,7 +277,7 @@ bool C4Console::FileNew()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool C4Console::FileOpen(const char *filename)
|
bool C4Console::FileOpen(const char *filename, bool host_in_network)
|
||||||
{
|
{
|
||||||
// Get scenario file name
|
// Get scenario file name
|
||||||
StdCopyStrBuf c4sfile("");
|
StdCopyStrBuf c4sfile("");
|
||||||
|
@ -285,6 +291,11 @@ bool C4Console::FileOpen(const char *filename)
|
||||||
}
|
}
|
||||||
Application.ClearCommandLine();
|
Application.ClearCommandLine();
|
||||||
::Config.Developer.AddRecentlyEditedScenario(filename);
|
::Config.Developer.AddRecentlyEditedScenario(filename);
|
||||||
|
if (host_in_network)
|
||||||
|
{
|
||||||
|
Game.NetworkActive = true;
|
||||||
|
Game.fLobby = true;
|
||||||
|
}
|
||||||
// Open game
|
// Open game
|
||||||
Application.OpenGame(filename);
|
Application.OpenGame(filename);
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -77,7 +77,7 @@ public:
|
||||||
bool FileSaveAs(bool fSaveGame);
|
bool FileSaveAs(bool fSaveGame);
|
||||||
bool FileSave();
|
bool FileSave();
|
||||||
bool FileNew();
|
bool FileNew();
|
||||||
bool FileOpen(const char *filename=nullptr);
|
bool FileOpen(const char *filename=nullptr, bool host_in_network=false);
|
||||||
bool FileOpenWPlrs();
|
bool FileOpenWPlrs();
|
||||||
bool FileCommand();
|
bool FileCommand();
|
||||||
bool FileClose();
|
bool FileClose();
|
||||||
|
|
|
@ -92,7 +92,7 @@ public:
|
||||||
void AddViewport(C4ViewportWindow *cvp);
|
void AddViewport(C4ViewportWindow *cvp);
|
||||||
void RemoveViewport(C4ViewportWindow *cvp);
|
void RemoveViewport(C4ViewportWindow *cvp);
|
||||||
void OnObjectSelectionChanged(class C4EditCursorSelection &selection); // selection changed (through other means than creator or object list view)
|
void OnObjectSelectionChanged(class C4EditCursorSelection &selection); // selection changed (through other means than creator or object list view)
|
||||||
bool CreateNewScenario(StdStrBuf *out_filename);
|
bool CreateNewScenario(StdStrBuf *out_filename, bool *out_host_as_network);
|
||||||
void OnStartGame();
|
void OnStartGame();
|
||||||
void ClearGamePointers();
|
void ClearGamePointers();
|
||||||
void EnsureDefinitionListInitialized();
|
void EnsureDefinitionListInitialized();
|
||||||
|
@ -111,6 +111,7 @@ public:
|
||||||
void AddViewport(C4ViewportWindow *cvp) { }
|
void AddViewport(C4ViewportWindow *cvp) { }
|
||||||
void RemoveViewport(C4ViewportWindow *cvp) { }
|
void RemoveViewport(C4ViewportWindow *cvp) { }
|
||||||
void OnObjectSelectionChanged(class C4EditCursorSelection &selection) { }
|
void OnObjectSelectionChanged(class C4EditCursorSelection &selection) { }
|
||||||
|
bool CreateNewScenario(StdStrBuf *out_filename, bool *out_host_as_network) {}
|
||||||
void OnStartGame() { }
|
void OnStartGame() { }
|
||||||
void EnsureDefinitionListInitialized() { }
|
void EnsureDefinitionListInitialized() { }
|
||||||
void CloseConsoleWindow() {}
|
void CloseConsoleWindow() {}
|
||||||
|
|
|
@ -346,10 +346,10 @@ void C4ConsoleGUI::UpdateMenuText(HMENU hMenu) { /* Translation done through QTr
|
||||||
state->RemoveViewport(cvp);
|
state->RemoveViewport(cvp);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool C4ConsoleGUI::CreateNewScenario(StdStrBuf *out_filename)
|
bool C4ConsoleGUI::CreateNewScenario(StdStrBuf *out_filename, bool *out_host_as_network)
|
||||||
{
|
{
|
||||||
#ifdef WITH_QT_EDITOR
|
#ifdef WITH_QT_EDITOR
|
||||||
return state->CreateNewScenario(out_filename);
|
return state->CreateNewScenario(out_filename, out_host_as_network);
|
||||||
#else
|
#else
|
||||||
return false
|
return false
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -339,6 +339,7 @@
|
||||||
</property>
|
</property>
|
||||||
<addaction name="actionFileNew"/>
|
<addaction name="actionFileNew"/>
|
||||||
<addaction name="actionFileOpen"/>
|
<addaction name="actionFileOpen"/>
|
||||||
|
<addaction name="actionFileOpenInNetwork"/>
|
||||||
<addaction name="actionFileOpenWithPlayers"/>
|
<addaction name="actionFileOpenWithPlayers"/>
|
||||||
<addaction name="separator"/>
|
<addaction name="separator"/>
|
||||||
<addaction name="actionFileRecord"/>
|
<addaction name="actionFileRecord"/>
|
||||||
|
@ -1247,6 +1248,17 @@
|
||||||
<string>-</string>
|
<string>-</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
|
<action name="actionFileOpenInNetwork">
|
||||||
|
<property name="text">
|
||||||
|
<string comment="res">IDS_MNU_OPENNET</string>
|
||||||
|
</property>
|
||||||
|
<property name="iconText">
|
||||||
|
<string comment="res">IDS_MNU_OPENNET</string>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string comment="res">IDS_MNU_OPENNET</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
</widget>
|
</widget>
|
||||||
<resources>
|
<resources>
|
||||||
<include location="resource.qrc"/>
|
<include location="resource.qrc"/>
|
||||||
|
@ -1451,8 +1463,8 @@
|
||||||
<slot>DrawSizeChanged(int)</slot>
|
<slot>DrawSizeChanged(int)</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
||||||
<x>499</x>
|
<x>685</x>
|
||||||
<y>69</y>
|
<y>78</y>
|
||||||
</hint>
|
</hint>
|
||||||
<hint type="destinationlabel">
|
<hint type="destinationlabel">
|
||||||
<x>477</x>
|
<x>477</x>
|
||||||
|
@ -1707,8 +1719,8 @@
|
||||||
<slot>WelcomeLinkActivated(QString)</slot>
|
<slot>WelcomeLinkActivated(QString)</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
||||||
<x>591</x>
|
<x>676</x>
|
||||||
<y>216</y>
|
<y>234</y>
|
||||||
</hint>
|
</hint>
|
||||||
<hint type="destinationlabel">
|
<hint type="destinationlabel">
|
||||||
<x>477</x>
|
<x>477</x>
|
||||||
|
@ -1723,8 +1735,8 @@
|
||||||
<slot>WelcomeLinkActivated(QString)</slot>
|
<slot>WelcomeLinkActivated(QString)</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
||||||
<x>591</x>
|
<x>676</x>
|
||||||
<y>235</y>
|
<y>253</y>
|
||||||
</hint>
|
</hint>
|
||||||
<hint type="destinationlabel">
|
<hint type="destinationlabel">
|
||||||
<x>477</x>
|
<x>477</x>
|
||||||
|
@ -1739,8 +1751,8 @@
|
||||||
<slot>WelcomeLinkActivated(QString)</slot>
|
<slot>WelcomeLinkActivated(QString)</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel">
|
<hint type="sourcelabel">
|
||||||
<x>445</x>
|
<x>676</x>
|
||||||
<y>248</y>
|
<y>272</y>
|
||||||
</hint>
|
</hint>
|
||||||
<hint type="destinationlabel">
|
<hint type="destinationlabel">
|
||||||
<x>477</x>
|
<x>477</x>
|
||||||
|
@ -1988,6 +2000,22 @@
|
||||||
</hint>
|
</hint>
|
||||||
</hints>
|
</hints>
|
||||||
</connection>
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>actionFileOpenInNetwork</sender>
|
||||||
|
<signal>triggered()</signal>
|
||||||
|
<receiver>MainWindow</receiver>
|
||||||
|
<slot>FileOpenInNetwork()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>-1</x>
|
||||||
|
<y>-1</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>477</x>
|
||||||
|
<y>312</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
</connections>
|
</connections>
|
||||||
<slots>
|
<slots>
|
||||||
<slot>PlayPressed(bool)</slot>
|
<slot>PlayPressed(bool)</slot>
|
||||||
|
@ -2035,5 +2063,6 @@
|
||||||
<slot>FocusNextViewport()</slot>
|
<slot>FocusNextViewport()</slot>
|
||||||
<slot>GradeUp()</slot>
|
<slot>GradeUp()</slot>
|
||||||
<slot>GradeDown()</slot>
|
<slot>GradeDown()</slot>
|
||||||
|
<slot>FileOpenInNetwork()</slot>
|
||||||
</slots>
|
</slots>
|
||||||
</ui>
|
</ui>
|
||||||
|
|
|
@ -243,6 +243,11 @@ C4ConsoleQtNewScenarioDlg::C4ConsoleQtNewScenarioDlg(class QMainWindow *parent_w
|
||||||
delete m;
|
delete m;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool C4ConsoleQtNewScenarioDlg::IsHostAsNetwork() const
|
||||||
|
{
|
||||||
|
return ui.startInNetworkCheckbox->isChecked();
|
||||||
|
}
|
||||||
|
|
||||||
bool C4ConsoleQtNewScenarioDlg::SaveScenario(C4Group &grp)
|
bool C4ConsoleQtNewScenarioDlg::SaveScenario(C4Group &grp)
|
||||||
{
|
{
|
||||||
// Save c4s
|
// Save c4s
|
||||||
|
|
|
@ -90,6 +90,7 @@ class C4ConsoleQtNewScenarioDlg : public QDialog
|
||||||
public:
|
public:
|
||||||
C4ConsoleQtNewScenarioDlg(class QMainWindow *parent_window);
|
C4ConsoleQtNewScenarioDlg(class QMainWindow *parent_window);
|
||||||
const char *GetFilename() const { return filename.getData(); }
|
const char *GetFilename() const { return filename.getData(); }
|
||||||
|
bool IsHostAsNetwork() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool SaveScenario(class C4Group &grp);
|
bool SaveScenario(class C4Group &grp);
|
||||||
|
|
|
@ -335,6 +335,16 @@
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="startInNetworkCheckbox">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string comment="res">IDS_CNS_HOSTASNETWORKGAMEDESC</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string comment="res">IDS_CNS_HOSTASNETWORKGAME</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="okButton">
|
<widget class="QPushButton" name="okButton">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
|
|
@ -335,7 +335,8 @@ void C4ConsoleQtMainWindow::DrawSizeChanged(int newval)
|
||||||
|
|
||||||
// File menu
|
// File menu
|
||||||
void C4ConsoleQtMainWindow::FileNew() { ::Console.FileNew(); }
|
void C4ConsoleQtMainWindow::FileNew() { ::Console.FileNew(); }
|
||||||
void C4ConsoleQtMainWindow::FileOpen() { ::Console.FileOpen(); }
|
void C4ConsoleQtMainWindow::FileOpen() { ::Console.FileOpen(nullptr, false); }
|
||||||
|
void C4ConsoleQtMainWindow::FileOpenInNetwork() { ::Console.FileOpen(nullptr, true); }
|
||||||
void C4ConsoleQtMainWindow::FileOpenWithPlayers() { Console.FileOpenWPlrs(); }
|
void C4ConsoleQtMainWindow::FileOpenWithPlayers() { Console.FileOpenWPlrs(); }
|
||||||
void C4ConsoleQtMainWindow::FileRecord() { ::Console.FileRecord(); }
|
void C4ConsoleQtMainWindow::FileRecord() { ::Console.FileRecord(); }
|
||||||
void C4ConsoleQtMainWindow::FileSave() { ::Console.FileSave(); }
|
void C4ConsoleQtMainWindow::FileSave() { ::Console.FileSave(); }
|
||||||
|
@ -1068,13 +1069,14 @@ void C4ConsoleGUIState::OnCreatorCurrentChanged(const QModelIndex & current, con
|
||||||
::Console.EditCursor.SetCreatorDef(new_def); // set or clear def in EditCursor
|
::Console.EditCursor.SetCreatorDef(new_def); // set or clear def in EditCursor
|
||||||
}
|
}
|
||||||
|
|
||||||
bool C4ConsoleGUIState::CreateNewScenario(StdStrBuf *out_filename)
|
bool C4ConsoleGUIState::CreateNewScenario(StdStrBuf *out_filename, bool *out_host_as_network)
|
||||||
{
|
{
|
||||||
// Show dialogue
|
// Show dialogue
|
||||||
std::unique_ptr<C4ConsoleQtNewScenarioDlg> dlg(new C4ConsoleQtNewScenarioDlg(window.get()));
|
std::unique_ptr<C4ConsoleQtNewScenarioDlg> dlg(new C4ConsoleQtNewScenarioDlg(window.get()));
|
||||||
if (!dlg->exec()) return false;
|
if (!dlg->exec()) return false;
|
||||||
// Dlg said OK! Scenario created
|
// Dlg said OK! Scenario created
|
||||||
out_filename->Copy(dlg->GetFilename());
|
out_filename->Copy(dlg->GetFilename());
|
||||||
|
*out_host_as_network = dlg->IsHostAsNetwork();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -129,6 +129,7 @@ public slots:
|
||||||
// File menu
|
// File menu
|
||||||
void FileNew();
|
void FileNew();
|
||||||
void FileOpen();
|
void FileOpen();
|
||||||
|
void FileOpenInNetwork();
|
||||||
void FileOpenWithPlayers();
|
void FileOpenWithPlayers();
|
||||||
void FileRecord();
|
void FileRecord();
|
||||||
void FileSave();
|
void FileSave();
|
||||||
|
@ -254,7 +255,7 @@ public:
|
||||||
void OnCreatorCurrentChanged(const QModelIndex & current, const QModelIndex & previous);
|
void OnCreatorCurrentChanged(const QModelIndex & current, const QModelIndex & previous);
|
||||||
void UpdateActionObject(C4Object *new_action_object);
|
void UpdateActionObject(C4Object *new_action_object);
|
||||||
|
|
||||||
bool CreateNewScenario(StdStrBuf *out_filename); // show "new scenario" dialogue; return true if new scenario is created
|
bool CreateNewScenario(StdStrBuf *out_filename, bool *out_host_as_network); // show "new scenario" dialogue; return true if new scenario is created
|
||||||
|
|
||||||
#ifdef USE_WIN32_WINDOWS
|
#ifdef USE_WIN32_WINDOWS
|
||||||
bool HandleWin32KeyboardMessage(MSG *msg);
|
bool HandleWin32KeyboardMessage(MSG *msg);
|
||||||
|
|
Loading…
Reference in New Issue