blob: ba12b861400bd1afb7411035e1f31264485685eb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
  | 
/*
 * Copyright (c) 2010 Isode Limited.
 * All rights reserved.
 * See the COPYING file for more information.
 */
#pragma once
#include <QValidator>
#include <string>
#include "QtSwiftUtil.h"
#include <Swift/Controllers/UIInterfaces/JoinMUCWindow.h>
#include <Swift/QtUI/ui_QtJoinMUCWindow.h>
namespace Swift {
	class UIEventStream;
	class NickValidator : public QValidator {
		Q_OBJECT
		public:
			NickValidator(QObject* parent) : QValidator(parent) {
			}
			virtual QValidator::State validate(QString& input, int& /*pos*/) const {
				if (input.isEmpty()) {
					return QValidator::Acceptable;
				}
				JID test("alice", "wonderland.lit", Q2PSTRING(input));
				return test.isValid() ? QValidator::Acceptable : QValidator::Invalid;
			}
	};
	class QtJoinMUCWindow : public QWidget, public JoinMUCWindow {
			Q_OBJECT
		public:
			QtJoinMUCWindow(UIEventStream* uiEventStream);
			virtual void setNick(const std::string& nick);
			virtual void setMUC(const std::string& nick);
			virtual void show();
		private slots:
			void handleJoin();
			void handleSearch();
		private:
			Ui::QtJoinMUCWindow ui;
			std::string lastSetNick;
			UIEventStream* uiEventStream;
	};
}
  |