Resolved #4242 keep auto config name consistent

This commit is contained in:
Xinyu Hou 2014-11-28 10:51:52 +00:00
parent 1730258311
commit 216f0f160d
11 changed files with 89 additions and 91 deletions

View File

@ -241,9 +241,9 @@
<widget class="QLineEdit" name="m_pLineEditHostname"/> <widget class="QLineEdit" name="m_pLineEditHostname"/>
</item> </item>
<item row="3" column="0"> <item row="3" column="0">
<widget class="QCheckBox" name="m_pCheckBoxAutoConnect"> <widget class="QCheckBox" name="m_pCheckBoxAutoConfig">
<property name="text"> <property name="text">
<string>Auto connect</string> <string>Auto config</string>
</property> </property>
</widget> </widget>
</item> </item>

View File

@ -44,7 +44,7 @@
<string/> <string/>
</property> </property>
<property name="pixmap"> <property name="pixmap">
<pixmap resource="Synergy.qrc">:/res/icons/64x64/user-trash.png</pixmap> <pixmap>:/res/icons/64x64/user-trash.png</pixmap>
</property> </property>
</widget> </widget>
</item> </item>
@ -82,7 +82,7 @@
<string/> <string/>
</property> </property>
<property name="pixmap"> <property name="pixmap">
<pixmap resource="Synergy.qrc">:/res/icons/64x64/video-display.png</pixmap> <pixmap>:/res/icons/64x64/video-display.png</pixmap>
</property> </property>
</widget> </widget>
</item> </item>
@ -505,9 +505,9 @@ Double click on a screen to edit its settings.</string>
</spacer> </spacer>
</item> </item>
<item row="4" column="0"> <item row="4" column="0">
<widget class="QCheckBox" name="m_pCheckBoxIgnoreAutoConnectClient"> <widget class="QCheckBox" name="m_pCheckBoxIgnoreAutoConfigClient">
<property name="text"> <property name="text">
<string>Ignore auto connect clients</string> <string>Ignore auto config clients</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -644,9 +644,7 @@ Double click on a screen to edit its settings.</string>
<header>TrashScreenWidget.h</header> <header>TrashScreenWidget.h</header>
</customwidget> </customwidget>
</customwidgets> </customwidgets>
<resources> <resources/>
<include location="Synergy.qrc"/>
</resources>
<connections> <connections>
<connection> <connection>
<sender>m_pButtonBox</sender> <sender>m_pButtonBox</sender>

View File

@ -25,7 +25,7 @@ AddClientDialog::AddClientDialog(const QString& clientName, QWidget* parent) :
QDialog(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint), QDialog(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint),
Ui::AddClientDialog(), Ui::AddClientDialog(),
m_AddResult(kAddClientIgnore), m_AddResult(kAddClientIgnore),
m_IgnoreAutoConnectClient(false) m_IgnoreAutoConfigClient(false)
{ {
setupUi(this); setupUi(this);
@ -125,5 +125,5 @@ void AddClientDialog::handleButtonAdvanced()
void AddClientDialog::on_m_pCheckBoxIgnoreClient_toggled(bool checked) void AddClientDialog::on_m_pCheckBoxIgnoreClient_toggled(bool checked)
{ {
m_IgnoreAutoConnectClient = checked; m_IgnoreAutoConfigClient = checked;
} }

View File

@ -42,7 +42,7 @@ public:
~AddClientDialog(); ~AddClientDialog();
int addResult() { return m_AddResult; } int addResult() { return m_AddResult; }
bool ignoreAutoConnectClient() { return m_IgnoreAutoConnectClient; } bool ignoreAutoConfigClient() { return m_IgnoreAutoConfigClient; }
protected: protected:
void changeEvent(QEvent *e); void changeEvent(QEvent *e);
@ -62,7 +62,7 @@ private:
QPushButton* m_pButtonDown; QPushButton* m_pButtonDown;
QLabel* m_pLabelCenter; QLabel* m_pLabelCenter;
int m_AddResult; int m_AddResult;
bool m_IgnoreAutoConnectClient; bool m_IgnoreAutoConfigClient;
}; };
#endif // ADDCLIENTDIALOG_H #endif // ADDCLIENTDIALOG_H

View File

@ -54,9 +54,9 @@ AppConfig::AppConfig(QSettings* settings) :
m_WizardLastRun(0), m_WizardLastRun(0),
m_CryptoPass(), m_CryptoPass(),
m_ProcessMode(DEFAULT_PROCESS_MODE), m_ProcessMode(DEFAULT_PROCESS_MODE),
m_AutoConnect(false), m_AutoConfig(false),
m_ElevateMode(false), m_ElevateMode(false),
m_AutoConnectPrompted(false) m_AutoConfigPrompted(false)
{ {
Q_ASSERT(m_pSettings); Q_ASSERT(m_pSettings);
@ -124,9 +124,9 @@ void AppConfig::loadSettings()
m_CryptoEnabled = settings().value("cryptoEnabled", false).toBool(); m_CryptoEnabled = settings().value("cryptoEnabled", false).toBool();
m_Language = settings().value("language", QLocale::system().name()).toString(); m_Language = settings().value("language", QLocale::system().name()).toString();
m_StartedBefore = settings().value("startedBefore", false).toBool(); m_StartedBefore = settings().value("startedBefore", false).toBool();
m_AutoConnect = settings().value("autoConnect", false).toBool(); m_AutoConfig = settings().value("autoConfig", false).toBool();
m_ElevateMode = settings().value("elevateMode", false).toBool(); m_ElevateMode = settings().value("elevateMode", false).toBool();
m_AutoConnectPrompted = settings().value("autoConnectPrompted", false).toBool(); m_AutoConfigPrompted = settings().value("autoConfigPrompted", false).toBool();
} }
void AppConfig::saveSettings() void AppConfig::saveSettings()
@ -142,9 +142,9 @@ void AppConfig::saveSettings()
settings().setValue("cryptoEnabled", m_CryptoEnabled); settings().setValue("cryptoEnabled", m_CryptoEnabled);
settings().setValue("language", m_Language); settings().setValue("language", m_Language);
settings().setValue("startedBefore", m_StartedBefore); settings().setValue("startedBefore", m_StartedBefore);
settings().setValue("autoConnect", m_AutoConnect); settings().setValue("autoConfig", m_AutoConfig);
settings().setValue("elevateMode", m_ElevateMode); settings().setValue("elevateMode", m_ElevateMode);
settings().setValue("autoConnectPrompted", m_AutoConnectPrompted); settings().setValue("autoConfigPrompted", m_AutoConfigPrompted);
} }
void AppConfig::setCryptoPass(const QString &s) void AppConfig::setCryptoPass(const QString &s)
@ -163,14 +163,14 @@ void AppConfig::setCryptoPass(const QString &s)
} }
} }
void AppConfig::setAutoConnect(bool autoConnect) void AppConfig::setAutoConfig(bool autoConfig)
{ {
m_AutoConnect = autoConnect; m_AutoConfig = autoConfig;
} }
void AppConfig::setAutoConnectPrompted(bool prompted) void AppConfig::setAutoConfigPrompted(bool prompted)
{ {
m_AutoConnectPrompted = prompted; m_AutoConfigPrompted = prompted;
} }
bool AppConfig::elevateMode() bool AppConfig::elevateMode()

View File

@ -68,10 +68,10 @@ class AppConfig
bool wizardShouldRun() const { return m_WizardLastRun < kWizardVersion; } bool wizardShouldRun() const { return m_WizardLastRun < kWizardVersion; }
const QString& language() const { return m_Language; } const QString& language() const { return m_Language; }
bool startedBefore() const { return m_StartedBefore; } bool startedBefore() const { return m_StartedBefore; }
bool autoConnect() const { return m_AutoConnect; } bool autoConfig() const { return m_AutoConfig; }
void setAutoConnect(bool autoConnect); void setAutoConfig(bool autoConfig);
bool autoConnectPrompted() { return m_AutoConnectPrompted; } bool autoConfigPrompted() { return m_AutoConfigPrompted; }
void setAutoConnectPrompted(bool prompted); void setAutoConfigPrompted(bool prompted);
QString synergysName() const { return m_SynergysName; } QString synergysName() const { return m_SynergysName; }
QString synergycName() const { return m_SynergycName; } QString synergycName() const { return m_SynergycName; }
@ -115,9 +115,9 @@ class AppConfig
ProcessMode m_ProcessMode; ProcessMode m_ProcessMode;
QString m_Language; QString m_Language;
bool m_StartedBefore; bool m_StartedBefore;
bool m_AutoConnect; bool m_AutoConfig;
bool m_ElevateMode; bool m_ElevateMode;
bool m_AutoConnectPrompted; bool m_AutoConfigPrompted;
static const char m_SynergysName[]; static const char m_SynergysName[];
static const char m_SynergycName[]; static const char m_SynergycName[];

View File

@ -87,7 +87,7 @@ MainWindow::MainWindow(QSettings& settings, AppConfig& appConfig) :
m_pDataDownloader(NULL), m_pDataDownloader(NULL),
m_DownloadMessageBox(NULL), m_DownloadMessageBox(NULL),
m_pCancelButton(NULL), m_pCancelButton(NULL),
m_SuppressAutoConnectWarning(false) m_SuppressAutoConfigWarning(false)
{ {
setupUi(this); setupUi(this);
@ -117,9 +117,9 @@ MainWindow::MainWindow(QSettings& settings, AppConfig& appConfig) :
setMinimumSize(size()); setMinimumSize(size());
#endif #endif
m_SuppressAutoConnectWarning = true; m_SuppressAutoConfigWarning = true;
m_pCheckBoxAutoConnect->setChecked(appConfig.autoConnect()); m_pCheckBoxAutoConfig->setChecked(appConfig.autoConfig());
m_SuppressAutoConnectWarning = false; m_SuppressAutoConfigWarning = false;
m_pComboServerList->hide(); m_pComboServerList->hide();
} }
@ -147,8 +147,8 @@ void MainWindow::open()
m_VersionChecker.checkLatest(); m_VersionChecker.checkLatest();
if (!appConfig().autoConnectPrompted()) { if (!appConfig().autoConfigPrompted()) {
promptAutoConnect(); promptAutoConfig();
} }
// only start if user has previously started. this stops the gui from // only start if user has previously started. this stops the gui from
@ -524,9 +524,9 @@ bool MainWindow::clientArgs(QStringList& args, QString& app)
args << "--log" << appConfig().logFilenameCmd(); args << "--log" << appConfig().logFilenameCmd();
} }
// check auto connect first, if it is disabled or no server detected, // check auto config first, if it is disabled or no server detected,
// use line edit host name if it is not empty // use line edit host name if it is not empty
if (m_pCheckBoxAutoConnect->isChecked()) { if (m_pCheckBoxAutoConfig->isChecked()) {
if (m_pComboServerList->count() != 0) { if (m_pComboServerList->count() != 0) {
QString serverIp = m_pComboServerList->currentText(); QString serverIp = m_pComboServerList->currentText();
args << serverIp + ":" + QString::number(appConfig().port()); args << serverIp + ":" + QString::number(appConfig().port());
@ -823,7 +823,7 @@ void MainWindow::updateZeroconfService()
m_pZeroconfService = NULL; m_pZeroconfService = NULL;
} }
if (m_AppConfig.autoConnect() || synergyType() == synergyServer) { if (m_AppConfig.autoConfig() || synergyType() == synergyServer) {
m_pZeroconfService = new ZeroconfService(this); m_pZeroconfService = new ZeroconfService(this);
} }
} }
@ -925,7 +925,7 @@ void MainWindow::on_m_pActionSettings_triggered()
void MainWindow::autoAddScreen(const QString name) void MainWindow::autoAddScreen(const QString name)
{ {
if (!m_ServerConfig.ignoreAutoConnectClient()) { if (!m_ServerConfig.ignoreAutoConfigClient()) {
int r = m_ServerConfig.autoAddScreen(name); int r = m_ServerConfig.autoAddScreen(name);
if (r != kAutoAddScreenOk) { if (r != kAutoAddScreenOk) {
switch (r) { switch (r) {
@ -972,35 +972,6 @@ void MainWindow::on_m_pButtonApply_clicked()
startSynergy(); startSynergy();
} }
void MainWindow::on_m_pCheckBoxAutoConnect_toggled(bool checked)
{
if (!isBonjourRunning() && checked) {
if (!m_SuppressAutoConnectWarning) {
int r = QMessageBox::information(
this, tr("Synergy"),
tr("Auto connect feature requires Bonjour.\n\n"
"Do you want to install Bonjour?"),
QMessageBox::Yes | QMessageBox::No);
if (r == QMessageBox::Yes) {
downloadBonjour();
}
}
m_pCheckBoxAutoConnect->setChecked(false);
return;
}
m_pLineEditHostname->setDisabled(checked);
appConfig().setAutoConnect(checked);
updateZeroconfService();
if (!checked) {
m_pComboServerList->clear();
m_pComboServerList->hide();
}
}
bool MainWindow::isServiceRunning(QString name) bool MainWindow::isServiceRunning(QString name)
{ {
#if defined(Q_OS_WIN) #if defined(Q_OS_WIN)
@ -1137,42 +1108,42 @@ void MainWindow::installBonjour()
#endif #endif
} }
void MainWindow::promptAutoConnect() void MainWindow::promptAutoConfig()
{ {
if (isBonjourRunning()) { if (isBonjourRunning()) {
int r = QMessageBox::question( int r = QMessageBox::question(
this, tr("Synergy"), this, tr("Synergy"),
tr("Do you want to enable auto connect?\n\n" tr("Do you want to enable auto config?\n\n"
"This feature helps you establish the connection."), "This feature helps you establish the connection."),
QMessageBox::Yes | QMessageBox::No); QMessageBox::Yes | QMessageBox::No);
if (r == QMessageBox::Yes) { if (r == QMessageBox::Yes) {
m_AppConfig.setAutoConnect(true); m_AppConfig.setAutoConfig(true);
m_pCheckBoxAutoConnect->setChecked(true); m_pCheckBoxAutoConfig->setChecked(true);
} }
else { else {
m_AppConfig.setAutoConnect(false); m_AppConfig.setAutoConfig(false);
m_pCheckBoxAutoConnect->setChecked(false); m_pCheckBoxAutoConfig->setChecked(false);
} }
} }
else { else {
int r = QMessageBox::question( int r = QMessageBox::question(
this, tr("Synergy"), this, tr("Synergy"),
tr("Do you want to enable auto connect and install Bonjour?\n\n" tr("Do you want to enable auto config and install Bonjour?\n\n"
"This feature helps you establish the connection."), "This feature helps you establish the connection."),
QMessageBox::Yes | QMessageBox::No); QMessageBox::Yes | QMessageBox::No);
if (r == QMessageBox::Yes) { if (r == QMessageBox::Yes) {
m_AppConfig.setAutoConnect(true); m_AppConfig.setAutoConfig(true);
downloadBonjour(); downloadBonjour();
} }
else { else {
m_AppConfig.setAutoConnect(false); m_AppConfig.setAutoConfig(false);
m_pCheckBoxAutoConnect->setChecked(false); m_pCheckBoxAutoConfig->setChecked(false);
} }
} }
m_AppConfig.setAutoConnectPrompted(true); m_AppConfig.setAutoConfigPrompted(true);
} }
void MainWindow::on_m_pComboServerList_currentIndexChanged(QString ) void MainWindow::on_m_pComboServerList_currentIndexChanged(QString )
@ -1181,3 +1152,32 @@ void MainWindow::on_m_pComboServerList_currentIndexChanged(QString )
startSynergy(); startSynergy();
} }
} }
void MainWindow::on_m_pCheckBoxAutoConfig_toggled(bool checked)
{
if (!isBonjourRunning() && checked) {
if (!m_SuppressAutoConfigWarning) {
int r = QMessageBox::information(
this, tr("Synergy"),
tr("Auto config feature requires Bonjour.\n\n"
"Do you want to install Bonjour?"),
QMessageBox::Yes | QMessageBox::No);
if (r == QMessageBox::Yes) {
downloadBonjour();
}
}
m_pCheckBoxAutoConfig->setChecked(false);
return;
}
m_pLineEditHostname->setDisabled(checked);
appConfig().setAutoConfig(checked);
updateZeroconfService();
if (!checked) {
m_pComboServerList->clear();
m_pComboServerList->hide();
}
}

View File

@ -163,7 +163,7 @@ class MainWindow : public QMainWindow, public Ui::MainWindowBase
bool isServiceRunning(QString name); bool isServiceRunning(QString name);
bool isBonjourRunning(); bool isBonjourRunning();
void downloadBonjour(); void downloadBonjour();
void promptAutoConnect(); void promptAutoConfig();
private: private:
QSettings& m_Settings; QSettings& m_Settings;
@ -187,11 +187,11 @@ class MainWindow : public QMainWindow, public Ui::MainWindowBase
QMessageBox* m_DownloadMessageBox; QMessageBox* m_DownloadMessageBox;
QAbstractButton* m_pCancelButton; QAbstractButton* m_pCancelButton;
QMutex m_Mutex; QMutex m_Mutex;
bool m_SuppressAutoConnectWarning; bool m_SuppressAutoConfigWarning;
private slots: private slots:
void on_m_pCheckBoxAutoConfig_toggled(bool checked);
void on_m_pComboServerList_currentIndexChanged(QString ); void on_m_pComboServerList_currentIndexChanged(QString );
void on_m_pCheckBoxAutoConnect_toggled(bool checked);
void on_m_pButtonApply_clicked(); void on_m_pButtonApply_clicked();
void installBonjour(); void installBonjour();
}; };

View File

@ -49,7 +49,7 @@ ServerConfig::ServerConfig(QSettings* settings, int numColumns, int numRows ,
m_NumColumns(numColumns), m_NumColumns(numColumns),
m_NumRows(numRows), m_NumRows(numRows),
m_ServerName(serverName), m_ServerName(serverName),
m_IgnoreAutoConnectClient(false), m_IgnoreAutoConfigClient(false),
m_pMainWindow(mainWindow) m_pMainWindow(mainWindow)
{ {
Q_ASSERT(m_pSettings); Q_ASSERT(m_pSettings);
@ -113,7 +113,7 @@ void ServerConfig::saveSettings()
settings().setValue("hasSwitchDoubleTap", hasSwitchDoubleTap()); settings().setValue("hasSwitchDoubleTap", hasSwitchDoubleTap());
settings().setValue("switchDoubleTap", switchDoubleTap()); settings().setValue("switchDoubleTap", switchDoubleTap());
settings().setValue("switchCornerSize", switchCornerSize()); settings().setValue("switchCornerSize", switchCornerSize());
settings().setValue("ignoreAutoConnectClient", ignoreAutoConnectClient()); settings().setValue("ignoreAutoConfigClient", ignoreAutoConfigClient());
writeSettings(settings(), switchCorners(), "switchCorner"); writeSettings(settings(), switchCorners(), "switchCorner");
@ -156,7 +156,7 @@ void ServerConfig::loadSettings()
haveSwitchDoubleTap(settings().value("hasSwitchDoubleTap", false).toBool()); haveSwitchDoubleTap(settings().value("hasSwitchDoubleTap", false).toBool());
setSwitchDoubleTap(settings().value("switchDoubleTap", 250).toInt()); setSwitchDoubleTap(settings().value("switchDoubleTap", 250).toInt());
setSwitchCornerSize(settings().value("switchCornerSize").toInt()); setSwitchCornerSize(settings().value("switchCornerSize").toInt());
setIgnoreAutoConnectClient(settings().value("ignoreAutoConnectClient").toBool()); setIgnoreAutoConfigClient(settings().value("ignoreAutoConfigClient").toBool());
readSettings(settings(), switchCorners(), "switchCorner", false, NumSwitchCorners); readSettings(settings(), switchCorners(), "switchCorner", false, NumSwitchCorners);
@ -375,7 +375,7 @@ int ServerConfig::showAddClientDialog(const QString& clientName)
AddClientDialog addClientDialog(clientName, m_pMainWindow); AddClientDialog addClientDialog(clientName, m_pMainWindow);
addClientDialog.exec(); addClientDialog.exec();
int result = addClientDialog.addResult(); int result = addClientDialog.addResult();
m_IgnoreAutoConnectClient = addClientDialog.ignoreAutoConnectClient(); m_IgnoreAutoConfigClient = addClientDialog.ignoreAutoConfigClient();
return result; return result;
} }

View File

@ -60,7 +60,7 @@ class ServerConfig : public BaseConfig
int switchCornerSize() const { return m_SwitchCornerSize; } int switchCornerSize() const { return m_SwitchCornerSize; }
const QList<bool>& switchCorners() const { return m_SwitchCorners; } const QList<bool>& switchCorners() const { return m_SwitchCorners; }
const HotkeyList& hotkeys() const { return m_Hotkeys; } const HotkeyList& hotkeys() const { return m_Hotkeys; }
bool ignoreAutoConnectClient() const { return m_IgnoreAutoConnectClient; } bool ignoreAutoConfigClient() const { return m_IgnoreAutoConfigClient; }
void saveSettings(); void saveSettings();
void loadSettings(); void loadSettings();
@ -87,7 +87,7 @@ class ServerConfig : public BaseConfig
void setSwitchDoubleTap(int val) { m_SwitchDoubleTap = val; } void setSwitchDoubleTap(int val) { m_SwitchDoubleTap = val; }
void setSwitchCorner(int c, bool on) { m_SwitchCorners[c] = on; } void setSwitchCorner(int c, bool on) { m_SwitchCorners[c] = on; }
void setSwitchCornerSize(int val) { m_SwitchCornerSize = val; } void setSwitchCornerSize(int val) { m_SwitchCornerSize = val; }
void setIgnoreAutoConnectClient(bool on) { m_IgnoreAutoConnectClient = on; } void setIgnoreAutoConfigClient(bool on) { m_IgnoreAutoConfigClient = on; }
QList<bool>& switchCorners() { return m_SwitchCorners; } QList<bool>& switchCorners() { return m_SwitchCorners; }
HotkeyList& hotkeys() { return m_Hotkeys; } HotkeyList& hotkeys() { return m_Hotkeys; }
@ -118,7 +118,7 @@ class ServerConfig : public BaseConfig
QList<bool> m_SwitchCorners; QList<bool> m_SwitchCorners;
HotkeyList m_Hotkeys; HotkeyList m_Hotkeys;
QString m_ServerName; QString m_ServerName;
bool m_IgnoreAutoConnectClient; bool m_IgnoreAutoConfigClient;
MainWindow* m_pMainWindow; MainWindow* m_pMainWindow;
}; };

View File

@ -54,7 +54,7 @@ ServerConfigDialog::ServerConfigDialog(QWidget* parent, ServerConfig& config, co
m_pCheckBoxCornerBottomRight->setChecked(serverConfig().switchCorner(BaseConfig::BottomRight)); m_pCheckBoxCornerBottomRight->setChecked(serverConfig().switchCorner(BaseConfig::BottomRight));
m_pSpinBoxSwitchCornerSize->setValue(serverConfig().switchCornerSize()); m_pSpinBoxSwitchCornerSize->setValue(serverConfig().switchCornerSize());
m_pCheckBoxIgnoreAutoConnectClient->setChecked(serverConfig().ignoreAutoConnectClient()); m_pCheckBoxIgnoreAutoConfigClient->setChecked(serverConfig().ignoreAutoConfigClient());
foreach(const Hotkey& hotkey, serverConfig().hotkeys()) foreach(const Hotkey& hotkey, serverConfig().hotkeys())
m_pListHotkeys->addItem(hotkey.text()); m_pListHotkeys->addItem(hotkey.text());
@ -96,7 +96,7 @@ void ServerConfigDialog::accept()
serverConfig().setSwitchCorner(BaseConfig::BottomLeft, m_pCheckBoxCornerBottomLeft->isChecked()); serverConfig().setSwitchCorner(BaseConfig::BottomLeft, m_pCheckBoxCornerBottomLeft->isChecked());
serverConfig().setSwitchCorner(BaseConfig::BottomRight, m_pCheckBoxCornerBottomRight->isChecked()); serverConfig().setSwitchCorner(BaseConfig::BottomRight, m_pCheckBoxCornerBottomRight->isChecked());
serverConfig().setSwitchCornerSize(m_pSpinBoxSwitchCornerSize->value()); serverConfig().setSwitchCornerSize(m_pSpinBoxSwitchCornerSize->value());
serverConfig().setIgnoreAutoConnectClient(m_pCheckBoxIgnoreAutoConnectClient->isChecked()); serverConfig().setIgnoreAutoConfigClient(m_pCheckBoxIgnoreAutoConfigClient->isChecked());
// now that the dialog has been accepted, copy the new server config to the original one, // now that the dialog has been accepted, copy the new server config to the original one,
// which is a reference to the one in MainWindow. // which is a reference to the one in MainWindow.