This adds the ability to select previous servers from a list to connect to. You can remove items from the drop down by selecting them and pressing delete. If you connect to a new host it will be added to the previous hosts. It will remember the last host connected to in the dropdown.
43 lines
1.1 KiB
C++
43 lines
1.1 KiB
C++
#ifndef DLG_CONNECT_H
|
|
#define DLG_CONNECT_H
|
|
|
|
#include <QDialog>
|
|
#include <QLineEdit>
|
|
|
|
class QLabel;
|
|
class QPushButton;
|
|
class QCheckBox;
|
|
class QComboBox;
|
|
class QRadioButton;
|
|
|
|
class DeleteHighlightedItemWhenShiftDelPressedEventFilter : public QObject
|
|
{
|
|
Q_OBJECT
|
|
protected:
|
|
bool eventFilter(QObject *obj, QEvent *event);
|
|
};
|
|
|
|
|
|
class DlgConnect : public QDialog {
|
|
Q_OBJECT
|
|
public:
|
|
DlgConnect(QWidget *parent = 0);
|
|
QString getHost() const;
|
|
int getPort() const { return portEdit->text().toInt(); }
|
|
QString getPlayerName() const { return playernameEdit->text(); }
|
|
QString getPassword() const { return passwordEdit->text(); }
|
|
private slots:
|
|
void actOk();
|
|
void actCancel();
|
|
void passwordSaved(int state);
|
|
void previousHostSelected(bool state);
|
|
void newHostSelected(bool state);
|
|
private:
|
|
QLabel *hostLabel, *portLabel, *playernameLabel, *passwordLabel;
|
|
QLineEdit *hostEdit, *portEdit, *playernameEdit, *passwordEdit;
|
|
QCheckBox *savePasswordCheckBox, *autoConnectCheckBox;
|
|
QComboBox *previousHosts;
|
|
QRadioButton *newHostButton, *previousHostButton;
|
|
};
|
|
|
|
#endif
|