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_GAMESAVED=Spiel gespeichert.
|
||||
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_INTERNAL=Intern
|
||||
IDS_CNS_INVALID=Ungültig
|
||||
|
@ -542,6 +544,7 @@ IDS_MNU_NEWVIEWPORT=Neues Sichtfenster
|
|||
IDS_MNU_NEXTVIEWPORT=Nächstes Sichtfenster auswählen
|
||||
IDS_MNU_OPEN=Öffnen...
|
||||
IDS_MNU_OPENMATERIALSELECTION=Materialauswahl öffnen
|
||||
IDS_MNU_OPENNET=Öffnen als Netzwerkspiel...
|
||||
IDS_MNU_OPENWPLRS=Öffnen mit Spielern...
|
||||
IDS_MNU_OPTIONS=Optionen
|
||||
IDS_MNU_OPTIONSINFO=Einstellungen ändern.
|
||||
|
|
|
@ -59,6 +59,8 @@ IDS_CNS_GAMECLOSED=Game cleared.
|
|||
IDS_CNS_GAMEMODE=Game mode
|
||||
IDS_CNS_GAMESAVED=Game saved.
|
||||
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_INTERNAL=Internal
|
||||
IDS_CNS_INVALID=Invalid
|
||||
|
@ -542,6 +544,7 @@ IDS_MNU_NEW=New...
|
|||
IDS_MNU_NEWVIEWPORT=New viewport
|
||||
IDS_MNU_OPEN=Open...
|
||||
IDS_MNU_OPENMATERIALSELECTION=Popup material selection
|
||||
IDS_MNU_OPENNET=Open as network game...
|
||||
IDS_MNU_OPENWPLRS=Open with players...
|
||||
IDS_MNU_OPTIONS=Options
|
||||
IDS_MNU_OPTIONSINFO=Change program options.
|
||||
|
|
|
@ -260,9 +260,15 @@ bool C4Console::FileNew()
|
|||
{
|
||||
StdCopyStrBuf filename;
|
||||
#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();
|
||||
::Config.Developer.AddRecentlyEditedScenario(filename.getData());
|
||||
if (host_in_network)
|
||||
{
|
||||
Game.NetworkActive = true;
|
||||
Game.fLobby = true;
|
||||
}
|
||||
Application.OpenGame(filename.getData());
|
||||
return true;
|
||||
#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
|
||||
StdCopyStrBuf c4sfile("");
|
||||
|
@ -285,6 +291,11 @@ bool C4Console::FileOpen(const char *filename)
|
|||
}
|
||||
Application.ClearCommandLine();
|
||||
::Config.Developer.AddRecentlyEditedScenario(filename);
|
||||
if (host_in_network)
|
||||
{
|
||||
Game.NetworkActive = true;
|
||||
Game.fLobby = true;
|
||||
}
|
||||
// Open game
|
||||
Application.OpenGame(filename);
|
||||
return true;
|
||||
|
|
|
@ -77,7 +77,7 @@ public:
|
|||
bool FileSaveAs(bool fSaveGame);
|
||||
bool FileSave();
|
||||
bool FileNew();
|
||||
bool FileOpen(const char *filename=nullptr);
|
||||
bool FileOpen(const char *filename=nullptr, bool host_in_network=false);
|
||||
bool FileOpenWPlrs();
|
||||
bool FileCommand();
|
||||
bool FileClose();
|
||||
|
|
|
@ -92,7 +92,7 @@ public:
|
|||
void AddViewport(C4ViewportWindow *cvp);
|
||||
void RemoveViewport(C4ViewportWindow *cvp);
|
||||
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 ClearGamePointers();
|
||||
void EnsureDefinitionListInitialized();
|
||||
|
@ -111,6 +111,7 @@ public:
|
|||
void AddViewport(C4ViewportWindow *cvp) { }
|
||||
void RemoveViewport(C4ViewportWindow *cvp) { }
|
||||
void OnObjectSelectionChanged(class C4EditCursorSelection &selection) { }
|
||||
bool CreateNewScenario(StdStrBuf *out_filename, bool *out_host_as_network) {}
|
||||
void OnStartGame() { }
|
||||
void EnsureDefinitionListInitialized() { }
|
||||
void CloseConsoleWindow() {}
|
||||
|
|
|
@ -346,10 +346,10 @@ void C4ConsoleGUI::UpdateMenuText(HMENU hMenu) { /* Translation done through QTr
|
|||
state->RemoveViewport(cvp);
|
||||
}
|
||||
|
||||
bool C4ConsoleGUI::CreateNewScenario(StdStrBuf *out_filename)
|
||||
bool C4ConsoleGUI::CreateNewScenario(StdStrBuf *out_filename, bool *out_host_as_network)
|
||||
{
|
||||
#ifdef WITH_QT_EDITOR
|
||||
return state->CreateNewScenario(out_filename);
|
||||
return state->CreateNewScenario(out_filename, out_host_as_network);
|
||||
#else
|
||||
return false
|
||||
#endif
|
||||
|
|
|
@ -339,6 +339,7 @@
|
|||
</property>
|
||||
<addaction name="actionFileNew"/>
|
||||
<addaction name="actionFileOpen"/>
|
||||
<addaction name="actionFileOpenInNetwork"/>
|
||||
<addaction name="actionFileOpenWithPlayers"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionFileRecord"/>
|
||||
|
@ -1247,6 +1248,17 @@
|
|||
<string>-</string>
|
||||
</property>
|
||||
</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>
|
||||
<resources>
|
||||
<include location="resource.qrc"/>
|
||||
|
@ -1451,8 +1463,8 @@
|
|||
<slot>DrawSizeChanged(int)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>499</x>
|
||||
<y>69</y>
|
||||
<x>685</x>
|
||||
<y>78</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>477</x>
|
||||
|
@ -1707,8 +1719,8 @@
|
|||
<slot>WelcomeLinkActivated(QString)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>591</x>
|
||||
<y>216</y>
|
||||
<x>676</x>
|
||||
<y>234</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>477</x>
|
||||
|
@ -1723,8 +1735,8 @@
|
|||
<slot>WelcomeLinkActivated(QString)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>591</x>
|
||||
<y>235</y>
|
||||
<x>676</x>
|
||||
<y>253</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>477</x>
|
||||
|
@ -1739,8 +1751,8 @@
|
|||
<slot>WelcomeLinkActivated(QString)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>445</x>
|
||||
<y>248</y>
|
||||
<x>676</x>
|
||||
<y>272</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>477</x>
|
||||
|
@ -1988,6 +2000,22 @@
|
|||
</hint>
|
||||
</hints>
|
||||
</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>
|
||||
<slots>
|
||||
<slot>PlayPressed(bool)</slot>
|
||||
|
@ -2035,5 +2063,6 @@
|
|||
<slot>FocusNextViewport()</slot>
|
||||
<slot>GradeUp()</slot>
|
||||
<slot>GradeDown()</slot>
|
||||
<slot>FileOpenInNetwork()</slot>
|
||||
</slots>
|
||||
</ui>
|
||||
|
|
|
@ -243,6 +243,11 @@ C4ConsoleQtNewScenarioDlg::C4ConsoleQtNewScenarioDlg(class QMainWindow *parent_w
|
|||
delete m;
|
||||
}
|
||||
|
||||
bool C4ConsoleQtNewScenarioDlg::IsHostAsNetwork() const
|
||||
{
|
||||
return ui.startInNetworkCheckbox->isChecked();
|
||||
}
|
||||
|
||||
bool C4ConsoleQtNewScenarioDlg::SaveScenario(C4Group &grp)
|
||||
{
|
||||
// Save c4s
|
||||
|
|
|
@ -90,6 +90,7 @@ class C4ConsoleQtNewScenarioDlg : public QDialog
|
|||
public:
|
||||
C4ConsoleQtNewScenarioDlg(class QMainWindow *parent_window);
|
||||
const char *GetFilename() const { return filename.getData(); }
|
||||
bool IsHostAsNetwork() const;
|
||||
|
||||
private:
|
||||
bool SaveScenario(class C4Group &grp);
|
||||
|
|
|
@ -335,6 +335,16 @@
|
|||
</property>
|
||||
</spacer>
|
||||
</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>
|
||||
<widget class="QPushButton" name="okButton">
|
||||
<property name="text">
|
||||
|
|
|
@ -335,7 +335,8 @@ void C4ConsoleQtMainWindow::DrawSizeChanged(int newval)
|
|||
|
||||
// File menu
|
||||
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::FileRecord() { ::Console.FileRecord(); }
|
||||
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
|
||||
}
|
||||
|
||||
bool C4ConsoleGUIState::CreateNewScenario(StdStrBuf *out_filename)
|
||||
bool C4ConsoleGUIState::CreateNewScenario(StdStrBuf *out_filename, bool *out_host_as_network)
|
||||
{
|
||||
// Show dialogue
|
||||
std::unique_ptr<C4ConsoleQtNewScenarioDlg> dlg(new C4ConsoleQtNewScenarioDlg(window.get()));
|
||||
if (!dlg->exec()) return false;
|
||||
// Dlg said OK! Scenario created
|
||||
out_filename->Copy(dlg->GetFilename());
|
||||
*out_host_as_network = dlg->IsHostAsNetwork();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -129,6 +129,7 @@ public slots:
|
|||
// File menu
|
||||
void FileNew();
|
||||
void FileOpen();
|
||||
void FileOpenInNetwork();
|
||||
void FileOpenWithPlayers();
|
||||
void FileRecord();
|
||||
void FileSave();
|
||||
|
@ -254,7 +255,7 @@ public:
|
|||
void OnCreatorCurrentChanged(const QModelIndex & current, const QModelIndex & previous);
|
||||
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
|
||||
bool HandleWin32KeyboardMessage(MSG *msg);
|
||||
|
|
Loading…
Reference in New Issue