After short code lookup, I decided to change the way CelestiaCore is communicating with UI interfaces. Now it's done by simulating input events (for example, below is part of current Qt main window code):
Code: Select all
void CelestiaAppWindow::selectSun()
{
m_appCore->charEntered("h");
}
void CelestiaAppWindow::centerSelection()
{
m_appCore->charEntered("c");
}
void CelestiaAppWindow::gotoSelection()
{
m_appCore->charEntered("g");
}
Main communication is done in CelestiaCore in one big switch (which is, by the way, very helpful in understand, how this communitation work). I found such a sollution as horrible design, so I started new branch, in which I begun to replace input event simulation by calls code corresponding to proper switch' entry, but encapsulated in new function. For example, cited above code is now as follows:
Code: Select all
void CelestiaAppWindow::selectSun()
{
//m_appCore->charEntered("h");
m_appCore->selectStar(0);
}
void CelestiaAppWindow::centerSelection()
{
//m_appCore->charEntered("c");
m_appCore->centerSelection();
}
void CelestiaAppWindow::gotoSelection()
{
//m_appCore->charEntered("g");
m_appCore->gotoSelection(0.5);
}
But I'm not sure, if such this will be proper way to go and will be accepted and merged with main branch. So I have a question to anybody interested in (especially Alexell, as main programmer): what do You think about current CelestiaCore communication "language"? Should it be maintained for some reasons, or should be mark as obsolete and eventually completely removed? I understand, that such a solution was done to keep input schema consistent independently of used UI. However, this is IMHO bad presumption, because input schema is what UI is about. Current solution will lost all sence when one try to add custom shortcuts, for example.
OK, in short: I propose to move away all input handling from CelestiaCore and move it to adequate UIs, because it's UI's job to handle user input after all.