26 |
27 | QT_BEGIN_NAMESPACE
28 |
29 | class Ui_Register
30 | {
31 | public:
32 | QSplitter *splitter_3;
33 | QSplitter *splitter_5;
34 | QRadioButton *Button_accept;
35 | QRadioButton *Button_reject;
36 | QPushButton *Button_reg;
37 | QTextBrowser *text_note;
38 | QFrame *verticalFrame1;
39 | QVBoxLayout *verticalLayout;
40 | QLabel *label;
41 | QLabel *label_2;
42 | QLabel *label_3;
43 | QLabel *label_4;
44 | QFrame *verticalFrame;
45 | QVBoxLayout *verticalLayout_2;
46 | QLineEdit *le_user;
47 | QLineEdit *le_password;
48 | QLineEdit *le_question;
49 | QLineEdit *le_answer;
50 |
51 | void setupUi(QDialog *Register)
52 | {
53 | if (Register->objectName().isEmpty())
54 | Register->setObjectName(QStringLiteral("Register"));
55 | Register->resize(538, 398);
56 | splitter_3 = new QSplitter(Register);
57 | splitter_3->setObjectName(QStringLiteral("splitter_3"));
58 | splitter_3->setGeometry(QRect(190, 250, 125, 70));
59 | QSizePolicy sizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
60 | sizePolicy.setHorizontalStretch(0);
61 | sizePolicy.setVerticalStretch(0);
62 | sizePolicy.setHeightForWidth(splitter_3->sizePolicy().hasHeightForWidth());
63 | splitter_3->setSizePolicy(sizePolicy);
64 | splitter_3->setMinimumSize(QSize(125, 70));
65 | splitter_3->setMaximumSize(QSize(125, 71));
66 | splitter_3->setAutoFillBackground(true);
67 | splitter_3->setStyleSheet(QStringLiteral(""));
68 | splitter_3->setOrientation(Qt::Vertical);
69 | splitter_5 = new QSplitter(splitter_3);
70 | splitter_5->setObjectName(QStringLiteral("splitter_5"));
71 | splitter_5->setMinimumSize(QSize(125, 30));
72 | splitter_5->setOrientation(Qt::Horizontal);
73 | Button_accept = new QRadioButton(splitter_5);
74 | Button_accept->setObjectName(QStringLiteral("Button_accept"));
75 | sizePolicy.setHeightForWidth(Button_accept->sizePolicy().hasHeightForWidth());
76 | Button_accept->setSizePolicy(sizePolicy);
77 | Button_accept->setMinimumSize(QSize(60, 30));
78 | Button_accept->setMaximumSize(QSize(60, 30));
79 | Button_accept->setStyleSheet(QStringLiteral(""));
80 | splitter_5->addWidget(Button_accept);
81 | Button_reject = new QRadioButton(splitter_5);
82 | Button_reject->setObjectName(QStringLiteral("Button_reject"));
83 | sizePolicy.setHeightForWidth(Button_reject->sizePolicy().hasHeightForWidth());
84 | Button_reject->setSizePolicy(sizePolicy);
85 | Button_reject->setMinimumSize(QSize(60, 30));
86 | Button_reject->setMaximumSize(QSize(60, 30));
87 | splitter_5->addWidget(Button_reject);
88 | splitter_3->addWidget(splitter_5);
89 | Button_reg = new QPushButton(splitter_3);
90 | Button_reg->setObjectName(QStringLiteral("Button_reg"));
91 | sizePolicy.setHeightForWidth(Button_reg->sizePolicy().hasHeightForWidth());
92 | Button_reg->setSizePolicy(sizePolicy);
93 | Button_reg->setMinimumSize(QSize(84, 35));
94 | Button_reg->setMaximumSize(QSize(125, 35));
95 | Button_reg->setStyleSheet(QLatin1String("QPushButton {\n"
96 | " border: 2px solid #8f8f91;\n"
97 | " border-radius: 6px;\n"
98 | " background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,\n"
99 | " stop: 0 #f6f7fa, stop: 1 #dadbde);\n"
100 | " min-width: 80px;\n"
101 | "}\n"
102 | "\n"
103 | "QPushButton:pressed {\n"
104 | " background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,\n"
105 | " stop: 0 #dadbde, stop: 1 #f6f7fa);\n"
106 | "}\n"
107 | "\n"
108 | "QPushButton:flat {\n"
109 | " border: none; /* no border for a flat push button */\n"
110 | "}\n"
111 | "\n"
112 | "QPushButton:default {\n"
113 | " border-color: navy; /* make the default button prominent */\n"
114 | "}"));
115 | splitter_3->addWidget(Button_reg);
116 | text_note = new QTextBrowser(Register);
117 | text_note->setObjectName(QStringLiteral("text_note"));
118 | text_note->setGeometry(QRect(300, 50, 211, 151));
119 | text_note->setStyleSheet(QString::fromUtf8("font: 25 11pt \"\347\255\211\347\272\277 Light\";"));
120 | verticalFrame1 = new QFrame(Register);
121 | verticalFrame1->setObjectName(QStringLiteral("verticalFrame1"));
122 | verticalFrame1->setGeometry(QRect(30, 50, 81, 161));
123 | verticalLayout = new QVBoxLayout(verticalFrame1);
124 | verticalLayout->setObjectName(QStringLiteral("verticalLayout"));
125 | label = new QLabel(verticalFrame1);
126 | label->setObjectName(QStringLiteral("label"));
127 |
128 | verticalLayout->addWidget(label);
129 |
130 | label_2 = new QLabel(verticalFrame1);
131 | label_2->setObjectName(QStringLiteral("label_2"));
132 |
133 | verticalLayout->addWidget(label_2);
134 |
135 | label_3 = new QLabel(verticalFrame1);
136 | label_3->setObjectName(QStringLiteral("label_3"));
137 |
138 | verticalLayout->addWidget(label_3);
139 |
140 | label_4 = new QLabel(verticalFrame1);
141 | label_4->setObjectName(QStringLiteral("label_4"));
142 |
143 | verticalLayout->addWidget(label_4);
144 |
145 | verticalFrame = new QFrame(Register);
146 | verticalFrame->setObjectName(QStringLiteral("verticalFrame"));
147 | verticalFrame->setGeometry(QRect(120, 50, 151, 161));
148 | verticalLayout_2 = new QVBoxLayout(verticalFrame);
149 | verticalLayout_2->setObjectName(QStringLiteral("verticalLayout_2"));
150 | le_user = new QLineEdit(verticalFrame);
151 | le_user->setObjectName(QStringLiteral("le_user"));
152 |
153 | verticalLayout_2->addWidget(le_user);
154 |
155 | le_password = new QLineEdit(verticalFrame);
156 | le_password->setObjectName(QStringLiteral("le_password"));
157 | le_password->setEchoMode(QLineEdit::Password);
158 |
159 | verticalLayout_2->addWidget(le_password);
160 |
161 | le_question = new QLineEdit(verticalFrame);
162 | le_question->setObjectName(QStringLiteral("le_question"));
163 |
164 | verticalLayout_2->addWidget(le_question);
165 |
166 | le_answer = new QLineEdit(verticalFrame);
167 | le_answer->setObjectName(QStringLiteral("le_answer"));
168 |
169 | verticalLayout_2->addWidget(le_answer);
170 |
171 |
172 | retranslateUi(Register);
173 |
174 | QMetaObject::connectSlotsByName(Register);
175 | } // setupUi
176 |
177 | void retranslateUi(QDialog *Register)
178 | {
179 | Register->setWindowTitle(QApplication::translate("Register", "Dialog", Q_NULLPTR));
180 | Button_accept->setText(QApplication::translate("Register", "\345\220\214\346\204\217", Q_NULLPTR));
181 | Button_reject->setText(QApplication::translate("Register", "\346\213\222\347\273\235", Q_NULLPTR));
182 | Button_reg->setText(QApplication::translate("Register", "\346\263\250\345\206\214", Q_NULLPTR));
183 | text_note->setHtml(QApplication::translate("Register", "\n"
184 | "\n"
187 | "\346\263\250\345\206\214\351\241\273\347\237\245\357\274\232
\n"
188 | "\345\220\214\345\255\246\346\202\250\345\245\275\357\274\201\346\254\242\350\277\216\345\212\240\345\205\245\345\222\232\345\222\232\343\200\202
\n"
189 | "
\n"
191 | "\344\273\245\344\270\212\344\276\277\346\230\257\346\202\250\351\234\200\350\246\201\351\201\265\345\276\252\347\232\204\344\275\277\347\224\250\350\247\204\345\210\231\357\274\214\345\220\214\346\204\217\346\235\241\346\226\207\357\274\214\346\211\215\345\217\257\347\273\247\347\273\255\346\263\250\345\206\214\357\274\201
", Q_NULLPTR));
192 | label->setText(QApplication::translate("Register", "\347\224\250\346\210\267\345\220\215", Q_NULLPTR));
193 | label_2->setText(QApplication::translate("Register", "\345\257\206\347\240\201", Q_NULLPTR));
194 | label_3->setText(QApplication::translate("Register", "\345\257\206\347\240\201\351\227\256\351\242\230", Q_NULLPTR));
195 | label_4->setText(QApplication::translate("Register", "\345\257\206\347\240\201\347\255\224\346\241\210", Q_NULLPTR));
196 | } // retranslateUi
197 |
198 | };
199 |
200 | namespace Ui {
201 | class Register: public Ui_Register {};
202 | } // namespace Ui
203 |
204 | QT_END_NAMESPACE
205 |
206 | #endif // UI_REGISTER_H
207 |
--------------------------------------------------------------------------------
/Client/release/moc_predefs.h:
--------------------------------------------------------------------------------
1 | #define __DBL_MIN_EXP__ (-1021)
2 | #define __cpp_attributes 200809
3 | #define __pentiumpro__ 1
4 | #define __UINT_LEAST16_MAX__ 0xffff
5 | #define __ATOMIC_ACQUIRE 2
6 | #define __FLT_MIN__ 1.17549435082228750797e-38F
7 | #define __GCC_IEC_559_COMPLEX 2
8 | #define __UINT_LEAST8_TYPE__ unsigned char
9 | #define __SIZEOF_FLOAT80__ 12
10 | #define _WIN32 1
11 | #define __INTMAX_C(c) c ## LL
12 | #define __CHAR_BIT__ 8
13 | #define __UINT8_MAX__ 0xff
14 | #define __WINT_MAX__ 0xffff
15 | #define __cpp_static_assert 200410
16 | #define __ORDER_LITTLE_ENDIAN__ 1234
17 | #define __SIZE_MAX__ 0xffffffffU
18 | #define __WCHAR_MAX__ 0xffff
19 | #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 1
20 | #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_2 1
21 | #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 1
22 | #define __DBL_DENORM_MIN__ double(4.94065645841246544177e-324L)
23 | #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8 1
24 | #define __GCC_ATOMIC_CHAR_LOCK_FREE 2
25 | #define __GCC_IEC_559 2
26 | #define __FLT_EVAL_METHOD__ 2
27 | #define __cpp_binary_literals 201304
28 | #define __GCC_ATOMIC_CHAR32_T_LOCK_FREE 2
29 | #define __cpp_variadic_templates 200704
30 | #define __UINT_FAST64_MAX__ 0xffffffffffffffffULL
31 | #define __SIG_ATOMIC_TYPE__ int
32 | #define __DBL_MIN_10_EXP__ (-307)
33 | #define __FINITE_MATH_ONLY__ 0
34 | #define __GNUC_PATCHLEVEL__ 0
35 | #define __UINT_FAST8_MAX__ 0xff
36 | #define __has_include(STR) __has_include__(STR)
37 | #define _stdcall __attribute__((__stdcall__))
38 | #define __DEC64_MAX_EXP__ 385
39 | #define __INT8_C(c) c
40 | #define __UINT_LEAST64_MAX__ 0xffffffffffffffffULL
41 | #define __SHRT_MAX__ 0x7fff
42 | #define __LDBL_MAX__ 1.18973149535723176502e+4932L
43 | #define __UINT_LEAST8_MAX__ 0xff
44 | #define __GCC_ATOMIC_BOOL_LOCK_FREE 2
45 | #define __UINTMAX_TYPE__ long long unsigned int
46 | #define __DEC32_EPSILON__ 1E-6DF
47 | #define __OPTIMIZE__ 1
48 | #define __UINT32_MAX__ 0xffffffffU
49 | #define __GXX_EXPERIMENTAL_CXX0X__ 1
50 | #define __LDBL_MAX_EXP__ 16384
51 | #define __WINT_MIN__ 0
52 | #define __SCHAR_MAX__ 0x7f
53 | #define __WCHAR_MIN__ 0
54 | #define __INT64_C(c) c ## LL
55 | #define __DBL_DIG__ 15
56 | #define __GCC_ATOMIC_POINTER_LOCK_FREE 2
57 | #define __SIZEOF_INT__ 4
58 | #define __SIZEOF_POINTER__ 4
59 | #define __GCC_ATOMIC_CHAR16_T_LOCK_FREE 2
60 | #define __USER_LABEL_PREFIX__ _
61 | #define __STDC_HOSTED__ 1
62 | #define __WIN32 1
63 | #define __LDBL_HAS_INFINITY__ 1
64 | #define __FLT_EPSILON__ 1.19209289550781250000e-7F
65 | #define __GXX_WEAK__ 1
66 | #define __LDBL_MIN__ 3.36210314311209350626e-4932L
67 | #define __DEC32_MAX__ 9.999999E96DF
68 | #define __MINGW32__ 1
69 | #define __INT32_MAX__ 0x7fffffff
70 | #define __SIZEOF_LONG__ 4
71 | #define __UINT16_C(c) c
72 | #define __DECIMAL_DIG__ 21
73 | #define __has_include_next(STR) __has_include_next__(STR)
74 | #define __LDBL_HAS_QUIET_NAN__ 1
75 | #define _REENTRANT 1
76 | #define __GNUC__ 5
77 | #define _cdecl __attribute__((__cdecl__))
78 | #define __GXX_RTTI 1
79 | #define __cpp_delegating_constructors 200604
80 | #define __FLT_HAS_DENORM__ 1
81 | #define __SIZEOF_LONG_DOUBLE__ 12
82 | #define __BIGGEST_ALIGNMENT__ 16
83 | #define __STDC_UTF_16__ 1
84 | #define __i686 1
85 | #define __DBL_MAX__ double(1.79769313486231570815e+308L)
86 | #define _thiscall __attribute__((__thiscall__))
87 | #define __cpp_raw_strings 200710
88 | #define __INT_FAST32_MAX__ 0x7fffffff
89 | #define __WINNT 1
90 | #define __DBL_HAS_INFINITY__ 1
91 | #define __INT64_MAX__ 0x7fffffffffffffffLL
92 | #define __WINNT__ 1
93 | #define __DEC32_MIN_EXP__ (-94)
94 | #define __INT_FAST16_TYPE__ short int
95 | #define _fastcall __attribute__((__fastcall__))
96 | #define __LDBL_HAS_DENORM__ 1
97 | #define __cplusplus 201103L
98 | #define __cpp_ref_qualifiers 200710
99 | #define __DEC128_MAX__ 9.999999999999999999999999999999999E6144DL
100 | #define __INT_LEAST32_MAX__ 0x7fffffff
101 | #define __DEC32_MIN__ 1E-95DF
102 | #define __DEPRECATED 1
103 | #define __DBL_MAX_EXP__ 1024
104 | #define __DEC128_EPSILON__ 1E-33DL
105 | #define __ATOMIC_HLE_RELEASE 131072
106 | #define __WIN32__ 1
107 | #define __PTRDIFF_MAX__ 0x7fffffff
108 | #define __ATOMIC_HLE_ACQUIRE 65536
109 | #define __GNUG__ 5
110 | #define __LONG_LONG_MAX__ 0x7fffffffffffffffLL
111 | #define __SIZEOF_SIZE_T__ 4
112 | #define __cpp_rvalue_reference 200610
113 | #define __cpp_nsdmi 200809
114 | #define __SIZEOF_WINT_T__ 2
115 | #define __cpp_initializer_lists 200806
116 | #define __GCC_HAVE_DWARF2_CFI_ASM 1
117 | #define __GXX_ABI_VERSION 1009
118 | #define __FLT_MIN_EXP__ (-125)
119 | #define __i686__ 1
120 | #define __cpp_lambdas 200907
121 | #define __INT_FAST64_TYPE__ long long int
122 | #define __DBL_MIN__ double(2.22507385850720138309e-308L)
123 | #define __FLT_MIN_10_EXP__ (-37)
124 | #define __DECIMAL_BID_FORMAT__ 1
125 | #define __GXX_TYPEINFO_EQUALITY_INLINE 0
126 | #define __DEC128_MIN__ 1E-6143DL
127 | #define __REGISTER_PREFIX__
128 | #define __UINT16_MAX__ 0xffff
129 | #define __DBL_HAS_DENORM__ 1
130 | #define __cdecl __attribute__((__cdecl__))
131 | #define __UINT8_TYPE__ unsigned char
132 | #define __i386 1
133 | #define __FLT_MANT_DIG__ 24
134 | #define __VERSION__ "5.3.0"
135 | #define __UINT64_C(c) c ## ULL
136 | #define __cpp_unicode_characters 200704
137 | #define __GCC_ATOMIC_INT_LOCK_FREE 2
138 | #define _X86_ 1
139 | #define __FLOAT_WORD_ORDER__ __ORDER_LITTLE_ENDIAN__
140 | #define __INT32_C(c) c
141 | #define __DEC64_EPSILON__ 1E-15DD
142 | #define __ORDER_PDP_ENDIAN__ 3412
143 | #define __DEC128_MIN_EXP__ (-6142)
144 | #define __code_model_32__ 1
145 | #define __INT_FAST32_TYPE__ int
146 | #define __UINT_LEAST16_TYPE__ short unsigned int
147 | #define __INT16_MAX__ 0x7fff
148 | #define __i386__ 1
149 | #define __cpp_rtti 199711
150 | #define __SIZE_TYPE__ unsigned int
151 | #define __UINT64_MAX__ 0xffffffffffffffffULL
152 | #define __INT8_TYPE__ signed char
153 | #define __FLT_RADIX__ 2
154 | #define __INT_LEAST16_TYPE__ short int
155 | #define __LDBL_EPSILON__ 1.08420217248550443401e-19L
156 | #define __UINTMAX_C(c) c ## ULL
157 | #define __SIG_ATOMIC_MAX__ 0x7fffffff
158 | #define __GCC_ATOMIC_WCHAR_T_LOCK_FREE 2
159 | #define __SIZEOF_PTRDIFF_T__ 4
160 | #define __DEC32_SUBNORMAL_MIN__ 0.000001E-95DF
161 | #define __pentiumpro 1
162 | #define __MSVCRT__ 1
163 | #define __INT_FAST16_MAX__ 0x7fff
164 | #define __UINT_FAST32_MAX__ 0xffffffffU
165 | #define __UINT_LEAST64_TYPE__ long long unsigned int
166 | #define __FLT_HAS_QUIET_NAN__ 1
167 | #define __FLT_MAX_10_EXP__ 38
168 | #define __LONG_MAX__ 0x7fffffffL
169 | #define __DEC128_SUBNORMAL_MIN__ 0.000000000000000000000000000000001E-6143DL
170 | #define __FLT_HAS_INFINITY__ 1
171 | #define __cpp_unicode_literals 200710
172 | #define __UINT_FAST16_TYPE__ short unsigned int
173 | #define __DEC64_MAX__ 9.999999999999999E384DD
174 | #define __CHAR16_TYPE__ short unsigned int
175 | #define __PRAGMA_REDEFINE_EXTNAME 1
176 | #define __INT_LEAST16_MAX__ 0x7fff
177 | #define __DEC64_MANT_DIG__ 16
178 | #define __UINT_LEAST32_MAX__ 0xffffffffU
179 | #define __GCC_ATOMIC_LONG_LOCK_FREE 2
180 | #define __INT_LEAST64_TYPE__ long long int
181 | #define __INT16_TYPE__ short int
182 | #define __INT_LEAST8_TYPE__ signed char
183 | #define __DEC32_MAX_EXP__ 97
184 | #define __INT_FAST8_MAX__ 0x7f
185 | #define __INTPTR_MAX__ 0x7fffffff
186 | #define __GXX_MERGED_TYPEINFO_NAMES 0
187 | #define __cpp_range_based_for 200907
188 | #define __stdcall __attribute__((__stdcall__))
189 | #define __EXCEPTIONS 1
190 | #define __LDBL_MANT_DIG__ 64
191 | #define __DBL_HAS_QUIET_NAN__ 1
192 | #define __SIG_ATOMIC_MIN__ (-__SIG_ATOMIC_MAX__ - 1)
193 | #define __INTPTR_TYPE__ int
194 | #define __UINT16_TYPE__ short unsigned int
195 | #define __WCHAR_TYPE__ short unsigned int
196 | #define __SIZEOF_FLOAT__ 4
197 | #define __UINTPTR_MAX__ 0xffffffffU
198 | #define __DEC64_MIN_EXP__ (-382)
199 | #define __cpp_decltype 200707
200 | #define __INT_FAST64_MAX__ 0x7fffffffffffffffLL
201 | #define __GCC_ATOMIC_TEST_AND_SET_TRUEVAL 1
202 | #define __FLT_DIG__ 6
203 | #define __UINT_FAST64_TYPE__ long long unsigned int
204 | #define __INT_MAX__ 0x7fffffff
205 | #define WIN32 1
206 | #define __INT64_TYPE__ long long int
207 | #define __FLT_MAX_EXP__ 128
208 | #define __DBL_MANT_DIG__ 53
209 | #define __cpp_inheriting_constructors 200802
210 | #define __SIZEOF_FLOAT128__ 16
211 | #define __INT_LEAST64_MAX__ 0x7fffffffffffffffLL
212 | #define __DEC64_MIN__ 1E-383DD
213 | #define __WINT_TYPE__ short unsigned int
214 | #define __UINT_LEAST32_TYPE__ unsigned int
215 | #define __SIZEOF_SHORT__ 2
216 | #define __LDBL_MIN_EXP__ (-16381)
217 | #define __INT_LEAST8_MAX__ 0x7f
218 | #define __WCHAR_UNSIGNED__ 1
219 | #define __LDBL_MAX_10_EXP__ 4932
220 | #define __ATOMIC_RELAXED 0
221 | #define __DBL_EPSILON__ double(2.22044604925031308085e-16L)
222 | #define __thiscall __attribute__((__thiscall__))
223 | #define __UINT8_C(c) c
224 | #define __INT_LEAST32_TYPE__ int
225 | #define __SIZEOF_WCHAR_T__ 2
226 | #define __UINT64_TYPE__ long long unsigned int
227 | #define __INT_FAST8_TYPE__ signed char
228 | #define __fastcall __attribute__((__fastcall__))
229 | #define __GNUC_STDC_INLINE__ 1
230 | #define __DBL_DECIMAL_DIG__ 17
231 | #define __STDC_UTF_32__ 1
232 | #define __DEC_EVAL_METHOD__ 2
233 | #define __ORDER_BIG_ENDIAN__ 4321
234 | #define __cpp_runtime_arrays 198712
235 | #define __UINT32_C(c) c ## U
236 | #define __INTMAX_MAX__ 0x7fffffffffffffffLL
237 | #define __cpp_alias_templates 200704
238 | #define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__
239 | #define WINNT 1
240 | #define __FLT_DENORM_MIN__ 1.40129846432481707092e-45F
241 | #define __INT8_MAX__ 0x7f
242 | #define __UINT_FAST32_TYPE__ unsigned int
243 | #define __CHAR32_TYPE__ unsigned int
244 | #define __FLT_MAX__ 3.40282346638528859812e+38F
245 | #define __cpp_constexpr 200704
246 | #define __INT32_TYPE__ int
247 | #define __SIZEOF_DOUBLE__ 8
248 | #define __cpp_exceptions 199711
249 | #define __INTMAX_TYPE__ long long int
250 | #define i386 1
251 | #define _INTEGRAL_MAX_BITS 64
252 | #define __DEC128_MAX_EXP__ 6145
253 | #define __ATOMIC_CONSUME 1
254 | #define __GNUC_MINOR__ 3
255 | #define __UINTMAX_MAX__ 0xffffffffffffffffULL
256 | #define __DEC32_MANT_DIG__ 7
257 | #define __DBL_MAX_10_EXP__ 308
258 | #define __LDBL_DENORM_MIN__ 3.64519953188247460253e-4951L
259 | #define __INT16_C(c) c
260 | #define __STDC__ 1
261 | #define __PTRDIFF_TYPE__ int
262 | #define __ATOMIC_SEQ_CST 5
263 | #define __UINT32_TYPE__ unsigned int
264 | #define __UINTPTR_TYPE__ unsigned int
265 | #define __DEC64_SUBNORMAL_MIN__ 0.000000000000001E-383DD
266 | #define __DEC128_MANT_DIG__ 34
267 | #define __LDBL_MIN_10_EXP__ (-4931)
268 | #define __SIZEOF_LONG_LONG__ 8
269 | #define __cpp_user_defined_literals 200809
270 | #define __GCC_ATOMIC_LLONG_LOCK_FREE 2
271 | #define __LDBL_DIG__ 18
272 | #define __FLT_DECIMAL_DIG__ 9
273 | #define __UINT_FAST16_MAX__ 0xffff
274 | #define __GCC_ATOMIC_SHORT_LOCK_FREE 2
275 | #define __UINT_FAST8_TYPE__ unsigned char
276 | #define __ATOMIC_ACQ_REL 4
277 | #define __ATOMIC_RELEASE 3
278 | #define __declspec(x) __attribute__((x))
279 |
--------------------------------------------------------------------------------
/Server/release/moc_predefs.h:
--------------------------------------------------------------------------------
1 | #define __DBL_MIN_EXP__ (-1021)
2 | #define __cpp_attributes 200809
3 | #define __pentiumpro__ 1
4 | #define __UINT_LEAST16_MAX__ 0xffff
5 | #define __ATOMIC_ACQUIRE 2
6 | #define __FLT_MIN__ 1.17549435082228750797e-38F
7 | #define __GCC_IEC_559_COMPLEX 2
8 | #define __UINT_LEAST8_TYPE__ unsigned char
9 | #define __SIZEOF_FLOAT80__ 12
10 | #define _WIN32 1
11 | #define __INTMAX_C(c) c ## LL
12 | #define __CHAR_BIT__ 8
13 | #define __UINT8_MAX__ 0xff
14 | #define __WINT_MAX__ 0xffff
15 | #define __cpp_static_assert 200410
16 | #define __ORDER_LITTLE_ENDIAN__ 1234
17 | #define __SIZE_MAX__ 0xffffffffU
18 | #define __WCHAR_MAX__ 0xffff
19 | #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 1
20 | #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_2 1
21 | #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 1
22 | #define __DBL_DENORM_MIN__ double(4.94065645841246544177e-324L)
23 | #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8 1
24 | #define __GCC_ATOMIC_CHAR_LOCK_FREE 2
25 | #define __GCC_IEC_559 2
26 | #define __FLT_EVAL_METHOD__ 2
27 | #define __cpp_binary_literals 201304
28 | #define __GCC_ATOMIC_CHAR32_T_LOCK_FREE 2
29 | #define __cpp_variadic_templates 200704
30 | #define __UINT_FAST64_MAX__ 0xffffffffffffffffULL
31 | #define __SIG_ATOMIC_TYPE__ int
32 | #define __DBL_MIN_10_EXP__ (-307)
33 | #define __FINITE_MATH_ONLY__ 0
34 | #define __GNUC_PATCHLEVEL__ 0
35 | #define __UINT_FAST8_MAX__ 0xff
36 | #define __has_include(STR) __has_include__(STR)
37 | #define _stdcall __attribute__((__stdcall__))
38 | #define __DEC64_MAX_EXP__ 385
39 | #define __INT8_C(c) c
40 | #define __UINT_LEAST64_MAX__ 0xffffffffffffffffULL
41 | #define __SHRT_MAX__ 0x7fff
42 | #define __LDBL_MAX__ 1.18973149535723176502e+4932L
43 | #define __UINT_LEAST8_MAX__ 0xff
44 | #define __GCC_ATOMIC_BOOL_LOCK_FREE 2
45 | #define __UINTMAX_TYPE__ long long unsigned int
46 | #define __DEC32_EPSILON__ 1E-6DF
47 | #define __OPTIMIZE__ 1
48 | #define __UINT32_MAX__ 0xffffffffU
49 | #define __GXX_EXPERIMENTAL_CXX0X__ 1
50 | #define __LDBL_MAX_EXP__ 16384
51 | #define __WINT_MIN__ 0
52 | #define __SCHAR_MAX__ 0x7f
53 | #define __WCHAR_MIN__ 0
54 | #define __INT64_C(c) c ## LL
55 | #define __DBL_DIG__ 15
56 | #define __GCC_ATOMIC_POINTER_LOCK_FREE 2
57 | #define __SIZEOF_INT__ 4
58 | #define __SIZEOF_POINTER__ 4
59 | #define __GCC_ATOMIC_CHAR16_T_LOCK_FREE 2
60 | #define __USER_LABEL_PREFIX__ _
61 | #define __STDC_HOSTED__ 1
62 | #define __WIN32 1
63 | #define __LDBL_HAS_INFINITY__ 1
64 | #define __FLT_EPSILON__ 1.19209289550781250000e-7F
65 | #define __GXX_WEAK__ 1
66 | #define __LDBL_MIN__ 3.36210314311209350626e-4932L
67 | #define __DEC32_MAX__ 9.999999E96DF
68 | #define __MINGW32__ 1
69 | #define __INT32_MAX__ 0x7fffffff
70 | #define __SIZEOF_LONG__ 4
71 | #define __UINT16_C(c) c
72 | #define __DECIMAL_DIG__ 21
73 | #define __has_include_next(STR) __has_include_next__(STR)
74 | #define __LDBL_HAS_QUIET_NAN__ 1
75 | #define _REENTRANT 1
76 | #define __GNUC__ 5
77 | #define _cdecl __attribute__((__cdecl__))
78 | #define __GXX_RTTI 1
79 | #define __cpp_delegating_constructors 200604
80 | #define __FLT_HAS_DENORM__ 1
81 | #define __SIZEOF_LONG_DOUBLE__ 12
82 | #define __BIGGEST_ALIGNMENT__ 16
83 | #define __STDC_UTF_16__ 1
84 | #define __i686 1
85 | #define __DBL_MAX__ double(1.79769313486231570815e+308L)
86 | #define _thiscall __attribute__((__thiscall__))
87 | #define __cpp_raw_strings 200710
88 | #define __INT_FAST32_MAX__ 0x7fffffff
89 | #define __WINNT 1
90 | #define __DBL_HAS_INFINITY__ 1
91 | #define __INT64_MAX__ 0x7fffffffffffffffLL
92 | #define __WINNT__ 1
93 | #define __DEC32_MIN_EXP__ (-94)
94 | #define __INT_FAST16_TYPE__ short int
95 | #define _fastcall __attribute__((__fastcall__))
96 | #define __LDBL_HAS_DENORM__ 1
97 | #define __cplusplus 201103L
98 | #define __cpp_ref_qualifiers 200710
99 | #define __DEC128_MAX__ 9.999999999999999999999999999999999E6144DL
100 | #define __INT_LEAST32_MAX__ 0x7fffffff
101 | #define __DEC32_MIN__ 1E-95DF
102 | #define __DEPRECATED 1
103 | #define __DBL_MAX_EXP__ 1024
104 | #define __DEC128_EPSILON__ 1E-33DL
105 | #define __ATOMIC_HLE_RELEASE 131072
106 | #define __WIN32__ 1
107 | #define __PTRDIFF_MAX__ 0x7fffffff
108 | #define __ATOMIC_HLE_ACQUIRE 65536
109 | #define __GNUG__ 5
110 | #define __LONG_LONG_MAX__ 0x7fffffffffffffffLL
111 | #define __SIZEOF_SIZE_T__ 4
112 | #define __cpp_rvalue_reference 200610
113 | #define __cpp_nsdmi 200809
114 | #define __SIZEOF_WINT_T__ 2
115 | #define __cpp_initializer_lists 200806
116 | #define __GCC_HAVE_DWARF2_CFI_ASM 1
117 | #define __GXX_ABI_VERSION 1009
118 | #define __FLT_MIN_EXP__ (-125)
119 | #define __i686__ 1
120 | #define __cpp_lambdas 200907
121 | #define __INT_FAST64_TYPE__ long long int
122 | #define __DBL_MIN__ double(2.22507385850720138309e-308L)
123 | #define __FLT_MIN_10_EXP__ (-37)
124 | #define __DECIMAL_BID_FORMAT__ 1
125 | #define __GXX_TYPEINFO_EQUALITY_INLINE 0
126 | #define __DEC128_MIN__ 1E-6143DL
127 | #define __REGISTER_PREFIX__
128 | #define __UINT16_MAX__ 0xffff
129 | #define __DBL_HAS_DENORM__ 1
130 | #define __cdecl __attribute__((__cdecl__))
131 | #define __UINT8_TYPE__ unsigned char
132 | #define __i386 1
133 | #define __FLT_MANT_DIG__ 24
134 | #define __VERSION__ "5.3.0"
135 | #define __UINT64_C(c) c ## ULL
136 | #define __cpp_unicode_characters 200704
137 | #define __GCC_ATOMIC_INT_LOCK_FREE 2
138 | #define _X86_ 1
139 | #define __FLOAT_WORD_ORDER__ __ORDER_LITTLE_ENDIAN__
140 | #define __INT32_C(c) c
141 | #define __DEC64_EPSILON__ 1E-15DD
142 | #define __ORDER_PDP_ENDIAN__ 3412
143 | #define __DEC128_MIN_EXP__ (-6142)
144 | #define __code_model_32__ 1
145 | #define __INT_FAST32_TYPE__ int
146 | #define __UINT_LEAST16_TYPE__ short unsigned int
147 | #define __INT16_MAX__ 0x7fff
148 | #define __i386__ 1
149 | #define __cpp_rtti 199711
150 | #define __SIZE_TYPE__ unsigned int
151 | #define __UINT64_MAX__ 0xffffffffffffffffULL
152 | #define __INT8_TYPE__ signed char
153 | #define __FLT_RADIX__ 2
154 | #define __INT_LEAST16_TYPE__ short int
155 | #define __LDBL_EPSILON__ 1.08420217248550443401e-19L
156 | #define __UINTMAX_C(c) c ## ULL
157 | #define __SIG_ATOMIC_MAX__ 0x7fffffff
158 | #define __GCC_ATOMIC_WCHAR_T_LOCK_FREE 2
159 | #define __SIZEOF_PTRDIFF_T__ 4
160 | #define __DEC32_SUBNORMAL_MIN__ 0.000001E-95DF
161 | #define __pentiumpro 1
162 | #define __MSVCRT__ 1
163 | #define __INT_FAST16_MAX__ 0x7fff
164 | #define __UINT_FAST32_MAX__ 0xffffffffU
165 | #define __UINT_LEAST64_TYPE__ long long unsigned int
166 | #define __FLT_HAS_QUIET_NAN__ 1
167 | #define __FLT_MAX_10_EXP__ 38
168 | #define __LONG_MAX__ 0x7fffffffL
169 | #define __DEC128_SUBNORMAL_MIN__ 0.000000000000000000000000000000001E-6143DL
170 | #define __FLT_HAS_INFINITY__ 1
171 | #define __cpp_unicode_literals 200710
172 | #define __UINT_FAST16_TYPE__ short unsigned int
173 | #define __DEC64_MAX__ 9.999999999999999E384DD
174 | #define __CHAR16_TYPE__ short unsigned int
175 | #define __PRAGMA_REDEFINE_EXTNAME 1
176 | #define __INT_LEAST16_MAX__ 0x7fff
177 | #define __DEC64_MANT_DIG__ 16
178 | #define __UINT_LEAST32_MAX__ 0xffffffffU
179 | #define __GCC_ATOMIC_LONG_LOCK_FREE 2
180 | #define __INT_LEAST64_TYPE__ long long int
181 | #define __INT16_TYPE__ short int
182 | #define __INT_LEAST8_TYPE__ signed char
183 | #define __DEC32_MAX_EXP__ 97
184 | #define __INT_FAST8_MAX__ 0x7f
185 | #define __INTPTR_MAX__ 0x7fffffff
186 | #define __GXX_MERGED_TYPEINFO_NAMES 0
187 | #define __cpp_range_based_for 200907
188 | #define __stdcall __attribute__((__stdcall__))
189 | #define __EXCEPTIONS 1
190 | #define __LDBL_MANT_DIG__ 64
191 | #define __DBL_HAS_QUIET_NAN__ 1
192 | #define __SIG_ATOMIC_MIN__ (-__SIG_ATOMIC_MAX__ - 1)
193 | #define __INTPTR_TYPE__ int
194 | #define __UINT16_TYPE__ short unsigned int
195 | #define __WCHAR_TYPE__ short unsigned int
196 | #define __SIZEOF_FLOAT__ 4
197 | #define __UINTPTR_MAX__ 0xffffffffU
198 | #define __DEC64_MIN_EXP__ (-382)
199 | #define __cpp_decltype 200707
200 | #define __INT_FAST64_MAX__ 0x7fffffffffffffffLL
201 | #define __GCC_ATOMIC_TEST_AND_SET_TRUEVAL 1
202 | #define __FLT_DIG__ 6
203 | #define __UINT_FAST64_TYPE__ long long unsigned int
204 | #define __INT_MAX__ 0x7fffffff
205 | #define WIN32 1
206 | #define __INT64_TYPE__ long long int
207 | #define __FLT_MAX_EXP__ 128
208 | #define __DBL_MANT_DIG__ 53
209 | #define __cpp_inheriting_constructors 200802
210 | #define __SIZEOF_FLOAT128__ 16
211 | #define __INT_LEAST64_MAX__ 0x7fffffffffffffffLL
212 | #define __DEC64_MIN__ 1E-383DD
213 | #define __WINT_TYPE__ short unsigned int
214 | #define __UINT_LEAST32_TYPE__ unsigned int
215 | #define __SIZEOF_SHORT__ 2
216 | #define __LDBL_MIN_EXP__ (-16381)
217 | #define __INT_LEAST8_MAX__ 0x7f
218 | #define __WCHAR_UNSIGNED__ 1
219 | #define __LDBL_MAX_10_EXP__ 4932
220 | #define __ATOMIC_RELAXED 0
221 | #define __DBL_EPSILON__ double(2.22044604925031308085e-16L)
222 | #define __thiscall __attribute__((__thiscall__))
223 | #define __UINT8_C(c) c
224 | #define __INT_LEAST32_TYPE__ int
225 | #define __SIZEOF_WCHAR_T__ 2
226 | #define __UINT64_TYPE__ long long unsigned int
227 | #define __INT_FAST8_TYPE__ signed char
228 | #define __fastcall __attribute__((__fastcall__))
229 | #define __GNUC_STDC_INLINE__ 1
230 | #define __DBL_DECIMAL_DIG__ 17
231 | #define __STDC_UTF_32__ 1
232 | #define __DEC_EVAL_METHOD__ 2
233 | #define __ORDER_BIG_ENDIAN__ 4321
234 | #define __cpp_runtime_arrays 198712
235 | #define __UINT32_C(c) c ## U
236 | #define __INTMAX_MAX__ 0x7fffffffffffffffLL
237 | #define __cpp_alias_templates 200704
238 | #define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__
239 | #define WINNT 1
240 | #define __FLT_DENORM_MIN__ 1.40129846432481707092e-45F
241 | #define __INT8_MAX__ 0x7f
242 | #define __UINT_FAST32_TYPE__ unsigned int
243 | #define __CHAR32_TYPE__ unsigned int
244 | #define __FLT_MAX__ 3.40282346638528859812e+38F
245 | #define __cpp_constexpr 200704
246 | #define __INT32_TYPE__ int
247 | #define __SIZEOF_DOUBLE__ 8
248 | #define __cpp_exceptions 199711
249 | #define __INTMAX_TYPE__ long long int
250 | #define i386 1
251 | #define _INTEGRAL_MAX_BITS 64
252 | #define __DEC128_MAX_EXP__ 6145
253 | #define __ATOMIC_CONSUME 1
254 | #define __GNUC_MINOR__ 3
255 | #define __UINTMAX_MAX__ 0xffffffffffffffffULL
256 | #define __DEC32_MANT_DIG__ 7
257 | #define __DBL_MAX_10_EXP__ 308
258 | #define __LDBL_DENORM_MIN__ 3.64519953188247460253e-4951L
259 | #define __INT16_C(c) c
260 | #define __STDC__ 1
261 | #define __PTRDIFF_TYPE__ int
262 | #define __ATOMIC_SEQ_CST 5
263 | #define __UINT32_TYPE__ unsigned int
264 | #define __UINTPTR_TYPE__ unsigned int
265 | #define __DEC64_SUBNORMAL_MIN__ 0.000000000000001E-383DD
266 | #define __DEC128_MANT_DIG__ 34
267 | #define __LDBL_MIN_10_EXP__ (-4931)
268 | #define __SIZEOF_LONG_LONG__ 8
269 | #define __cpp_user_defined_literals 200809
270 | #define __GCC_ATOMIC_LLONG_LOCK_FREE 2
271 | #define __LDBL_DIG__ 18
272 | #define __FLT_DECIMAL_DIG__ 9
273 | #define __UINT_FAST16_MAX__ 0xffff
274 | #define __GCC_ATOMIC_SHORT_LOCK_FREE 2
275 | #define __UINT_FAST8_TYPE__ unsigned char
276 | #define __ATOMIC_ACQ_REL 4
277 | #define __ATOMIC_RELEASE 3
278 | #define __declspec(x) __attribute__((x))
279 |
--------------------------------------------------------------------------------
/Client/clientwidget - 副本 (2).ui:
--------------------------------------------------------------------------------
1 |
2 |
3 | clientwidget
4 |
5 |
6 |
7 | 0
8 | 0
9 | 828
10 | 530
11 |
12 |
13 |
14 | clientwidget
15 |
16 |
17 | false
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 | 0
26 | 0
27 | 831
28 | 531
29 |
30 |
31 |
32 | #frame {background-image: url(:/new/prefix1/image/back.jpg);}
33 |
34 |
35 | QFrame::StyledPanel
36 |
37 |
38 | QFrame::Raised
39 |
40 |
41 |
42 |
43 | 240
44 | 10
45 | 231
46 | 111
47 |
48 |
49 |
50 | QFrame::StyledPanel
51 |
52 |
53 | QFrame::Raised
54 |
55 |
56 |
57 |
58 | 10
59 | 80
60 | 72
61 | 15
62 |
63 |
64 |
65 | 端口号:
66 |
67 |
68 |
69 |
70 |
71 | 70
72 | 10
73 | 151
74 | 21
75 |
76 |
77 |
78 |
79 |
80 |
81 | 70
82 | 80
83 | 151
84 | 21
85 |
86 |
87 |
88 |
89 |
90 |
91 | 10
92 | 10
93 | 31
94 | 21
95 |
96 |
97 |
98 | ip:
99 |
100 |
101 |
102 |
103 |
104 | 100
105 | 40
106 | 91
107 | 31
108 |
109 |
110 |
111 | 连接服务器
112 |
113 |
114 |
115 |
116 |
117 |
118 | 70
119 | 290
120 | 101
121 | 41
122 |
123 |
124 |
125 | font: 75 18pt "Agency FB";
126 |
127 |
128 | 客户端
129 |
130 |
131 |
132 |
133 |
134 | 110
135 | 10
136 | 101
137 | 131
138 |
139 |
140 |
141 | QFrame::StyledPanel
142 |
143 |
144 | QFrame::Raised
145 |
146 |
147 |
148 |
149 | 0
150 | 30
151 | 101
152 | 21
153 |
154 |
155 | -
156 |
157 | (无)
158 |
159 |
160 |
161 |
162 |
163 | false
164 |
165 |
166 |
167 | 0
168 | 0
169 | 101
170 | 21
171 |
172 |
173 |
174 |
175 |
176 |
177 | 0
178 | 60
179 | 101
180 | 31
181 |
182 |
183 |
184 | 私聊
185 |
186 |
187 |
188 |
189 |
190 |
191 | 400
192 | 130
193 | 391
194 | 341
195 |
196 |
197 |
198 | QFrame::StyledPanel
199 |
200 |
201 | QFrame::Raised
202 |
203 |
204 |
205 |
206 | 0
207 | 0
208 | 391
209 | 291
210 |
211 |
212 |
213 | selection-color: rgb(85, 255, 127);
214 | background-image: url(:/new/prefix1/image/766971.jpg);
215 | font: 12pt "楷体";
216 |
217 |
218 |
219 |
220 |
221 | 260
222 | 310
223 | 93
224 | 28
225 |
226 |
227 |
228 | 发送消息
229 |
230 |
231 |
232 |
233 |
234 | 0
235 | 310
236 | 221
237 | 31
238 |
239 |
240 |
241 |
242 |
243 |
244 |
245 | 110
246 | 150
247 | 101
248 | 51
249 |
250 |
251 |
252 | QFrame::StyledPanel
253 |
254 |
255 | QFrame::Raised
256 |
257 |
258 |
259 |
260 | 0
261 | 30
262 | 101
263 | 21
264 |
265 |
266 | -
267 |
268 | (无)
269 |
270 |
271 |
272 |
273 |
274 | false
275 |
276 |
277 |
278 | 0
279 | 0
280 | 101
281 | 21
282 |
283 |
284 |
285 |
286 |
287 |
288 |
289 | 470
290 | 10
291 | 351
292 | 111
293 |
294 |
295 |
296 | QFrame::StyledPanel
297 |
298 |
299 | QFrame::Raised
300 |
301 |
302 |
303 | false
304 |
305 |
306 |
307 | 140
308 | 10
309 | 91
310 | 21
311 |
312 |
313 |
314 |
315 |
316 | false
317 |
318 |
319 |
320 | 140
321 | 40
322 | 91
323 | 21
324 |
325 |
326 |
327 |
328 |
329 |
330 | 0
331 | 10
332 | 111
333 | 21
334 |
335 |
336 |
337 | 服务器连接状态:
338 |
339 |
340 |
341 |
342 |
343 | 240
344 | 10
345 | 111
346 | 21
347 |
348 |
349 |
350 | 断开服务器连接
351 |
352 |
353 |
354 |
355 |
356 | 10
357 | 40
358 | 72
359 | 15
360 |
361 |
362 |
363 | 用户名:
364 |
365 |
366 |
367 |
368 |
369 |
370 | 10
371 | 10
372 | 101
373 | 20
374 |
375 |
376 |
377 | 在线用户数量:
378 |
379 |
380 |
381 |
382 |
383 | 10
384 | 150
385 | 101
386 | 20
387 |
388 |
389 |
390 | 离线用户数量:
391 |
392 |
393 |
394 |
395 |
396 |
397 |
398 |
399 |
--------------------------------------------------------------------------------
/Client/ui_clientwidget.h:
--------------------------------------------------------------------------------
1 | /********************************************************************************
2 | ** Form generated from reading UI file 'clientwidget.ui'
3 | **
4 | ** Created by: Qt User Interface Compiler version 5.8.0
5 | **
6 | ** WARNING! All changes made in this file will be lost when recompiling UI file!
7 | ********************************************************************************/
8 |
9 | #ifndef UI_CLIENTWIDGET_H
10 | #define UI_CLIENTWIDGET_H
11 |
12 | #include
13 | #include
14 | #include
15 | #include
16 | #include
17 | #include
18 | #include
19 | #include
20 | #include
21 | #include
22 | #include
23 | #include
24 |
25 | QT_BEGIN_NAMESPACE
26 |
27 | class Ui_clientwidget
28 | {
29 | public:
30 | QFrame *frame;
31 | QFrame *frame_ip;
32 | QLabel *label_3;
33 | QLineEdit *lineEditIp;
34 | QLineEdit *lineEditPort;
35 | QLabel *label_2;
36 | QPushButton *buttonConnect;
37 | QLabel *label;
38 | QPushButton *bt_file_send;
39 | QFrame *frame_client_on;
40 | QComboBox *cb_client_on;
41 | QLineEdit *le_usernum_on;
42 | QPushButton *bt_connect_client;
43 | QPushButton *bt_disconnect_client;
44 | QFrame *frame_message;
45 | QTextBrowser *textBrowser;
46 | QPushButton *bt_message_send;
47 | QLineEdit *le_message;
48 | QFrame *frame_client_off;
49 | QComboBox *cb_client_off;
50 | QLineEdit *le_usernum_off;
51 | QFrame *frame_state;
52 | QLineEdit *le_state;
53 | QLineEdit *le_username;
54 | QLabel *label_5;
55 | QPushButton *buttonClose;
56 | QLabel *label_6;
57 | QLabel *label_9;
58 | QLineEdit *le_file_permission;
59 | QLabel *label_7;
60 | QLabel *label_8;
61 |
62 | void setupUi(QWidget *clientwidget)
63 | {
64 | if (clientwidget->objectName().isEmpty())
65 | clientwidget->setObjectName(QStringLiteral("clientwidget"));
66 | clientwidget->resize(828, 530);
67 | clientwidget->setAutoFillBackground(false);
68 | clientwidget->setStyleSheet(QStringLiteral(""));
69 | frame = new QFrame(clientwidget);
70 | frame->setObjectName(QStringLiteral("frame"));
71 | frame->setGeometry(QRect(0, 0, 831, 531));
72 | frame->setStyleSheet(QStringLiteral("#frame {background-image: url(:/new/prefix1/image/back.jpg);}"));
73 | frame->setFrameShape(QFrame::StyledPanel);
74 | frame->setFrameShadow(QFrame::Raised);
75 | frame_ip = new QFrame(frame);
76 | frame_ip->setObjectName(QStringLiteral("frame_ip"));
77 | frame_ip->setGeometry(QRect(240, 10, 231, 111));
78 | frame_ip->setFrameShape(QFrame::StyledPanel);
79 | frame_ip->setFrameShadow(QFrame::Raised);
80 | label_3 = new QLabel(frame_ip);
81 | label_3->setObjectName(QStringLiteral("label_3"));
82 | label_3->setGeometry(QRect(10, 80, 72, 15));
83 | lineEditIp = new QLineEdit(frame_ip);
84 | lineEditIp->setObjectName(QStringLiteral("lineEditIp"));
85 | lineEditIp->setGeometry(QRect(70, 10, 151, 21));
86 | lineEditPort = new QLineEdit(frame_ip);
87 | lineEditPort->setObjectName(QStringLiteral("lineEditPort"));
88 | lineEditPort->setGeometry(QRect(70, 80, 151, 21));
89 | label_2 = new QLabel(frame_ip);
90 | label_2->setObjectName(QStringLiteral("label_2"));
91 | label_2->setGeometry(QRect(10, 10, 31, 21));
92 | buttonConnect = new QPushButton(frame_ip);
93 | buttonConnect->setObjectName(QStringLiteral("buttonConnect"));
94 | buttonConnect->setGeometry(QRect(100, 40, 91, 31));
95 | label = new QLabel(frame);
96 | label->setObjectName(QStringLiteral("label"));
97 | label->setGeometry(QRect(70, 290, 101, 41));
98 | label->setStyleSheet(QStringLiteral("font: 75 18pt \"Agency FB\";"));
99 | bt_file_send = new QPushButton(frame);
100 | bt_file_send->setObjectName(QStringLiteral("bt_file_send"));
101 | bt_file_send->setGeometry(QRect(660, 480, 93, 28));
102 | frame_client_on = new QFrame(frame);
103 | frame_client_on->setObjectName(QStringLiteral("frame_client_on"));
104 | frame_client_on->setGeometry(QRect(110, 10, 101, 131));
105 | frame_client_on->setFrameShape(QFrame::StyledPanel);
106 | frame_client_on->setFrameShadow(QFrame::Raised);
107 | cb_client_on = new QComboBox(frame_client_on);
108 | cb_client_on->setObjectName(QStringLiteral("cb_client_on"));
109 | cb_client_on->setGeometry(QRect(0, 30, 101, 21));
110 | le_usernum_on = new QLineEdit(frame_client_on);
111 | le_usernum_on->setObjectName(QStringLiteral("le_usernum_on"));
112 | le_usernum_on->setEnabled(false);
113 | le_usernum_on->setGeometry(QRect(0, 0, 101, 21));
114 | bt_connect_client = new QPushButton(frame_client_on);
115 | bt_connect_client->setObjectName(QStringLiteral("bt_connect_client"));
116 | bt_connect_client->setGeometry(QRect(0, 60, 101, 31));
117 | bt_disconnect_client = new QPushButton(frame_client_on);
118 | bt_disconnect_client->setObjectName(QStringLiteral("bt_disconnect_client"));
119 | bt_disconnect_client->setGeometry(QRect(0, 100, 101, 31));
120 | frame_message = new QFrame(frame);
121 | frame_message->setObjectName(QStringLiteral("frame_message"));
122 | frame_message->setGeometry(QRect(400, 130, 391, 341));
123 | frame_message->setFrameShape(QFrame::StyledPanel);
124 | frame_message->setFrameShadow(QFrame::Raised);
125 | textBrowser = new QTextBrowser(frame_message);
126 | textBrowser->setObjectName(QStringLiteral("textBrowser"));
127 | textBrowser->setGeometry(QRect(0, 0, 391, 291));
128 | textBrowser->setStyleSheet(QString::fromUtf8("selection-color: rgb(85, 255, 127);\n"
129 | "background-image: url(:/new/prefix1/image/766971.jpg);\n"
130 | "font: 12pt \"\346\245\267\344\275\223\";"));
131 | bt_message_send = new QPushButton(frame_message);
132 | bt_message_send->setObjectName(QStringLiteral("bt_message_send"));
133 | bt_message_send->setGeometry(QRect(260, 310, 93, 28));
134 | le_message = new QLineEdit(frame_message);
135 | le_message->setObjectName(QStringLiteral("le_message"));
136 | le_message->setGeometry(QRect(0, 310, 221, 31));
137 | frame_client_off = new QFrame(frame);
138 | frame_client_off->setObjectName(QStringLiteral("frame_client_off"));
139 | frame_client_off->setGeometry(QRect(110, 150, 101, 51));
140 | frame_client_off->setFrameShape(QFrame::StyledPanel);
141 | frame_client_off->setFrameShadow(QFrame::Raised);
142 | cb_client_off = new QComboBox(frame_client_off);
143 | cb_client_off->setObjectName(QStringLiteral("cb_client_off"));
144 | cb_client_off->setGeometry(QRect(0, 30, 101, 21));
145 | le_usernum_off = new QLineEdit(frame_client_off);
146 | le_usernum_off->setObjectName(QStringLiteral("le_usernum_off"));
147 | le_usernum_off->setEnabled(false);
148 | le_usernum_off->setGeometry(QRect(0, 0, 101, 21));
149 | frame_state = new QFrame(frame);
150 | frame_state->setObjectName(QStringLiteral("frame_state"));
151 | frame_state->setGeometry(QRect(470, 10, 351, 111));
152 | frame_state->setFrameShape(QFrame::StyledPanel);
153 | frame_state->setFrameShadow(QFrame::Raised);
154 | le_state = new QLineEdit(frame_state);
155 | le_state->setObjectName(QStringLiteral("le_state"));
156 | le_state->setEnabled(false);
157 | le_state->setGeometry(QRect(140, 10, 91, 21));
158 | le_username = new QLineEdit(frame_state);
159 | le_username->setObjectName(QStringLiteral("le_username"));
160 | le_username->setEnabled(false);
161 | le_username->setGeometry(QRect(140, 40, 91, 21));
162 | label_5 = new QLabel(frame_state);
163 | label_5->setObjectName(QStringLiteral("label_5"));
164 | label_5->setGeometry(QRect(0, 10, 111, 21));
165 | buttonClose = new QPushButton(frame_state);
166 | buttonClose->setObjectName(QStringLiteral("buttonClose"));
167 | buttonClose->setGeometry(QRect(240, 10, 111, 21));
168 | label_6 = new QLabel(frame_state);
169 | label_6->setObjectName(QStringLiteral("label_6"));
170 | label_6->setGeometry(QRect(10, 40, 72, 15));
171 | label_9 = new QLabel(frame_state);
172 | label_9->setObjectName(QStringLiteral("label_9"));
173 | label_9->setGeometry(QRect(0, 70, 91, 16));
174 | le_file_permission = new QLineEdit(frame_state);
175 | le_file_permission->setObjectName(QStringLiteral("le_file_permission"));
176 | le_file_permission->setEnabled(false);
177 | le_file_permission->setGeometry(QRect(140, 70, 91, 21));
178 | label_7 = new QLabel(frame);
179 | label_7->setObjectName(QStringLiteral("label_7"));
180 | label_7->setGeometry(QRect(10, 10, 101, 20));
181 | label_8 = new QLabel(frame);
182 | label_8->setObjectName(QStringLiteral("label_8"));
183 | label_8->setGeometry(QRect(10, 150, 101, 20));
184 | frame_ip->raise();
185 | label->raise();
186 | bt_file_send->raise();
187 | frame_client_on->raise();
188 | frame_message->raise();
189 | frame_client_off->raise();
190 | frame_state->raise();
191 | label_7->raise();
192 | label_8->raise();
193 | label_8->raise();
194 |
195 | retranslateUi(clientwidget);
196 |
197 | QMetaObject::connectSlotsByName(clientwidget);
198 | } // setupUi
199 |
200 | void retranslateUi(QWidget *clientwidget)
201 | {
202 | clientwidget->setWindowTitle(QApplication::translate("clientwidget", "clientwidget", Q_NULLPTR));
203 | label_3->setText(QApplication::translate("clientwidget", "\347\253\257\345\217\243\345\217\267:", Q_NULLPTR));
204 | label_2->setText(QApplication::translate("clientwidget", "ip:", Q_NULLPTR));
205 | buttonConnect->setText(QApplication::translate("clientwidget", "\350\277\236\346\216\245\346\234\215\345\212\241\345\231\250", Q_NULLPTR));
206 | label->setText(QApplication::translate("clientwidget", "\345\256\242\346\210\267\347\253\257", Q_NULLPTR));
207 | bt_file_send->setText(QApplication::translate("clientwidget", "\345\217\221\351\200\201\346\226\207\344\273\266", Q_NULLPTR));
208 | cb_client_on->clear();
209 | cb_client_on->insertItems(0, QStringList()
210 | << QApplication::translate("clientwidget", "\357\274\210\346\227\240\357\274\211", Q_NULLPTR)
211 | );
212 | bt_connect_client->setText(QApplication::translate("clientwidget", "\350\277\236\346\216\245\345\234\250\347\272\277\347\224\250\346\210\267", Q_NULLPTR));
213 | bt_disconnect_client->setText(QApplication::translate("clientwidget", "\346\226\255\345\274\200\345\234\250\347\272\277\350\277\236\346\216\245", Q_NULLPTR));
214 | bt_message_send->setText(QApplication::translate("clientwidget", "\345\217\221\351\200\201\346\266\210\346\201\257", Q_NULLPTR));
215 | cb_client_off->clear();
216 | cb_client_off->insertItems(0, QStringList()
217 | << QApplication::translate("clientwidget", "\357\274\210\346\227\240\357\274\211", Q_NULLPTR)
218 | );
219 | label_5->setText(QApplication::translate("clientwidget", "\346\234\215\345\212\241\345\231\250\350\277\236\346\216\245\347\212\266\346\200\201\357\274\232", Q_NULLPTR));
220 | buttonClose->setText(QApplication::translate("clientwidget", "\346\226\255\345\274\200\346\234\215\345\212\241\345\231\250\350\277\236\346\216\245", Q_NULLPTR));
221 | label_6->setText(QApplication::translate("clientwidget", "\347\224\250\346\210\267\345\220\215\357\274\232", Q_NULLPTR));
222 | label_9->setText(QApplication::translate("clientwidget", "\347\202\271\345\257\271\347\202\271\350\277\236\346\216\245\357\274\232", Q_NULLPTR));
223 | label_7->setText(QApplication::translate("clientwidget", "\345\234\250\347\272\277\347\224\250\346\210\267\346\225\260\351\207\217\357\274\232", Q_NULLPTR));
224 | label_8->setText(QApplication::translate("clientwidget", "\347\246\273\347\272\277\347\224\250\346\210\267\346\225\260\351\207\217\357\274\232", Q_NULLPTR));
225 | } // retranslateUi
226 |
227 | };
228 |
229 | namespace Ui {
230 | class clientwidget: public Ui_clientwidget {};
231 | } // namespace Ui
232 |
233 | QT_END_NAMESPACE
234 |
235 | #endif // UI_CLIENTWIDGET_H
236 |
--------------------------------------------------------------------------------
/Client/clientwidget.ui:
--------------------------------------------------------------------------------
1 |
2 |
3 | clientwidget
4 |
5 |
6 |
7 | 0
8 | 0
9 | 828
10 | 530
11 |
12 |
13 |
14 | clientwidget
15 |
16 |
17 | false
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 | 0
26 | 0
27 | 831
28 | 531
29 |
30 |
31 |
32 | #frame {background-image: url(:/new/prefix1/image/back.jpg);}
33 |
34 |
35 | QFrame::StyledPanel
36 |
37 |
38 | QFrame::Raised
39 |
40 |
41 |
42 |
43 | 240
44 | 10
45 | 231
46 | 111
47 |
48 |
49 |
50 | QFrame::StyledPanel
51 |
52 |
53 | QFrame::Raised
54 |
55 |
56 |
57 |
58 | 10
59 | 80
60 | 72
61 | 15
62 |
63 |
64 |
65 | 端口号:
66 |
67 |
68 |
69 |
70 |
71 | 70
72 | 10
73 | 151
74 | 21
75 |
76 |
77 |
78 |
79 |
80 |
81 | 70
82 | 80
83 | 151
84 | 21
85 |
86 |
87 |
88 |
89 |
90 |
91 | 10
92 | 10
93 | 31
94 | 21
95 |
96 |
97 |
98 | ip:
99 |
100 |
101 |
102 |
103 |
104 | 100
105 | 40
106 | 91
107 | 31
108 |
109 |
110 |
111 | 连接服务器
112 |
113 |
114 |
115 |
116 |
117 |
118 | 70
119 | 290
120 | 101
121 | 41
122 |
123 |
124 |
125 | font: 75 18pt "Agency FB";
126 |
127 |
128 | 客户端
129 |
130 |
131 |
132 |
133 |
134 | 660
135 | 480
136 | 93
137 | 28
138 |
139 |
140 |
141 | 发送文件
142 |
143 |
144 |
145 |
146 |
147 | 110
148 | 10
149 | 101
150 | 131
151 |
152 |
153 |
154 | QFrame::StyledPanel
155 |
156 |
157 | QFrame::Raised
158 |
159 |
160 |
161 |
162 | 0
163 | 30
164 | 101
165 | 21
166 |
167 |
168 | -
169 |
170 | (无)
171 |
172 |
173 |
174 |
175 |
176 | false
177 |
178 |
179 |
180 | 0
181 | 0
182 | 101
183 | 21
184 |
185 |
186 |
187 |
188 |
189 |
190 | 0
191 | 60
192 | 101
193 | 31
194 |
195 |
196 |
197 | 连接在线用户
198 |
199 |
200 |
201 |
202 |
203 | 0
204 | 100
205 | 101
206 | 31
207 |
208 |
209 |
210 | 断开在线连接
211 |
212 |
213 |
214 |
215 |
216 |
217 | 400
218 | 130
219 | 391
220 | 341
221 |
222 |
223 |
224 | QFrame::StyledPanel
225 |
226 |
227 | QFrame::Raised
228 |
229 |
230 |
231 |
232 | 0
233 | 0
234 | 391
235 | 291
236 |
237 |
238 |
239 | selection-color: rgb(85, 255, 127);
240 | background-image: url(:/new/prefix1/image/766971.jpg);
241 | font: 12pt "楷体";
242 |
243 |
244 |
245 |
246 |
247 | 260
248 | 310
249 | 93
250 | 28
251 |
252 |
253 |
254 | 发送消息
255 |
256 |
257 |
258 |
259 |
260 | 0
261 | 310
262 | 221
263 | 31
264 |
265 |
266 |
267 |
268 |
269 |
270 |
271 | 110
272 | 150
273 | 101
274 | 51
275 |
276 |
277 |
278 | QFrame::StyledPanel
279 |
280 |
281 | QFrame::Raised
282 |
283 |
284 |
285 |
286 | 0
287 | 30
288 | 101
289 | 21
290 |
291 |
292 | -
293 |
294 | (无)
295 |
296 |
297 |
298 |
299 |
300 | false
301 |
302 |
303 |
304 | 0
305 | 0
306 | 101
307 | 21
308 |
309 |
310 |
311 |
312 |
313 |
314 |
315 | 470
316 | 10
317 | 351
318 | 111
319 |
320 |
321 |
322 | QFrame::StyledPanel
323 |
324 |
325 | QFrame::Raised
326 |
327 |
328 |
329 | false
330 |
331 |
332 |
333 | 140
334 | 10
335 | 91
336 | 21
337 |
338 |
339 |
340 |
341 |
342 | false
343 |
344 |
345 |
346 | 140
347 | 40
348 | 91
349 | 21
350 |
351 |
352 |
353 |
354 |
355 |
356 | 0
357 | 10
358 | 111
359 | 21
360 |
361 |
362 |
363 | 服务器连接状态:
364 |
365 |
366 |
367 |
368 |
369 | 240
370 | 10
371 | 111
372 | 21
373 |
374 |
375 |
376 | 断开服务器连接
377 |
378 |
379 |
380 |
381 |
382 | 10
383 | 40
384 | 72
385 | 15
386 |
387 |
388 |
389 | 用户名:
390 |
391 |
392 |
393 |
394 |
395 | 0
396 | 70
397 | 91
398 | 16
399 |
400 |
401 |
402 | 点对点连接:
403 |
404 |
405 |
406 |
407 | false
408 |
409 |
410 |
411 | 140
412 | 70
413 | 91
414 | 21
415 |
416 |
417 |
418 |
419 |
420 |
421 |
422 | 10
423 | 10
424 | 101
425 | 20
426 |
427 |
428 |
429 | 在线用户数量:
430 |
431 |
432 |
433 |
434 |
435 | 10
436 | 150
437 | 101
438 | 20
439 |
440 |
441 |
442 | 离线用户数量:
443 |
444 |
445 | frame_ip
446 | label
447 | bt_file_send
448 | frame_client_on
449 | frame_message
450 | frame_client_off
451 | frame_state
452 | label_7
453 | label_8
454 | label_8
455 |
456 |
457 |
458 |
459 |
460 |
461 |
--------------------------------------------------------------------------------
/Server/server.cpp:
--------------------------------------------------------------------------------
1 | #include "server.h"
2 | #include "ui_server.h"
3 | #include
4 | #include
5 | #include
6 | #include
7 | #include "user_information.h"
8 | #include "messagequeue.h"
9 |
10 |
11 | int currentsize; //总的下标位置
12 |
13 | struct user_data
14 | {
15 | user_imformation *v[M];
16 | int size; //用户数
17 | }*User_data;
18 |
19 | messageQueue* Me;
20 |
21 | bool isfirst =false;
22 |
23 | int mode[M];
24 | enum {Acceptlogin=0, Chat}; //登录交流和离线消息发送
25 |
26 | int indexofv;
27 |
28 | server::server(QWidget *parent) :
29 | QWidget(parent),
30 | ui(new Ui::server)
31 | {
32 | ui->setupUi(this);
33 | User_data = new user_data();
34 | for (int i=0; iv[i] = NULL;
37 | mode[i] = Chat;
38 | }
39 | indexofv = 0;
40 | User_data->size = 0;
41 | currentsize = 0;
42 | Me = NULL;
43 | isfirst = true;
44 | userload(); //加载用户信息
45 | userstateupdate();
46 | QTime t = QTime::currentTime();
47 | qsrand(t.msec()+t.second()*1000);
48 |
49 | QString localHostName = QHostInfo::localHostName();
50 | qDebug() <<"localHostName: "<textBrowser->append(address.toString());
58 | }
59 | }
60 | for(int i=0;i listen(QHostAddress::Any,8888);
68 | setWindowTitle(QString("服务器端口:8888"));
69 | ui->bt_save->hide();
70 | connect(tcpServer,&QTcpServer::newConnection,
71 | [=]()
72 | {
73 | //获取通信套接字
74 | int index = currentsize;//currentsize为1的时候只有一个套接字
75 | tcpSocket[index] = tcpServer->nextPendingConnection();
76 |
77 | currentsize++; //每次总个数总要发生变化,但是单独的下标不发生变化
78 |
79 | //获取对方IP、port
80 | QString ip = tcpSocket[index]->peerAddress().toString().section(":",3,3);
81 | // QString ip = tcpSocket[index]->peerAddress().toString();
82 | quint16 port = tcpSocket[index]->peerPort();
83 |
84 | QString str = QString("[%1:%2]:成功连接").arg(ip).arg(port);
85 | ui->textBrowser->append(str);
86 |
87 |
88 | connect(tcpSocket[index], &QTcpSocket::connected, //连接上的处理操作
89 | [=]()
90 | {
91 |
92 | //消息队列处理
93 |
94 | ui->bt_save->setEnabled(false);//此时不能保存
95 |
96 | });
97 |
98 | connect(tcpSocket[index], &QTcpSocket::disconnected, //断开连接的操作
99 | [=]()
100 | {
101 | QString str2 = QString("[%1:%2]:断开连接").arg(ip).arg(port);
102 | ui->textBrowser->append(str2);
103 | for(int i=0; isize; i++)
104 | {
105 | // if(User_data->v[i]->ip == ip && User_data->v[i]->port == port)
106 | if(User_data->v[i]->ip == ip)
107 | {
108 | ui->textBrowser->append(QString("%1离线了").arg(User_data->v[i]->username));
109 | User_data->v[i]->state = 0; //离线
110 | break;
111 | }
112 | }
113 | if(index < currentsize-1) //不是在最后一个,需要改变指针数组里面元素的值
114 | {
115 | for(int i=index; ireadAll();
128 | //采用回射信息进行粘包处理
129 |
130 | if(mode[index] == Acceptlogin)
131 | {
132 | if("login" == QString(buf).section("##",0,0)) //login
133 | {
134 | //比较密码
135 | qDebug() << "login";
136 | bool ispass=false;
137 | for(int i=0; isize; i++)
138 | {
139 | if(User_data->v[i]->username == QString(buf).section("##",1,1)
140 | && User_data->v[i]->password == QString(buf).section("##",2,2))
141 | {
142 | ispass = true; //通过
143 | ui->textBrowser->append(QString("%1上线了").arg(User_data->v[i]->username));
144 | User_data->v[i]->state = 1; //在线
145 | User_data->v[i]->ip = ip;
146 | User_data->v[i]->port = qrand()%10000+10000; //存储 客户端服务器port信息 的地方,由自己定
147 |
148 | break;
149 | }
150 | }
151 | if(ispass) //##login successed##dingding
152 | {
153 | //发送离线消息
154 |
155 | tcpSocket[index]->write(QString("##login successed##%1").arg(QString(buf).section("##",1,1)).toUtf8());
156 | qDebug() << "##login successed##%1";
157 | }
158 | else
159 | {
160 | tcpSocket[index]->write(QString("##login fail##%1").arg(QString(buf).section("##",1,1)).toUtf8());
161 | mode[index] = Chat;
162 | }
163 |
164 | }
165 | else if("register" == QString(buf).section("##",0,0) )//注册
166 | {
167 | qDebug() << "regsiter";
168 | QString myname = QString(buf).section("##",1,1);
169 | QString mypassword = QString(buf).section("##",2,2);
170 | QString myquestion = QString(buf).section("##",3,3);
171 | QString myanswer = QString(buf).section("##",4,4);
172 | bool islogined=false;
173 | for(int i=0; isize; i++)
174 | {
175 | if(User_data->v[i]->username == myname)
176 | {
177 | islogined = true; //注册过
178 | break;
179 | }
180 | }
181 | if(!islogined) //未注册过
182 | {
183 | int newport = qrand()%10000+10000; //存储 客户端服务器port信息 的地方,由自己定
184 | User_data->v[User_data->size] = new user_imformation(myname, mypassword, myquestion, myanswer,1, ip, newport);
185 | User_data->size++; //需要改变大小
186 |
187 | tcpSocket[index]->write(QString("##register successed##%1").arg(myname).toUtf8());
188 | on_bt_save_clicked(); //保存数据
189 | qDebug() << "##register successed##%1";
190 | }
191 |
192 | else //已经注册过
193 | {
194 | tcpSocket[index]->write("register failed! 重复用户名");
195 | mode[index] = Chat;
196 | }
197 | }
198 | else if("find" == QString(buf).section("##",0,0) ) //找回密码
199 | {
200 | qDebug() << "find";
201 | QString findname = QString(buf).section("##",1,1);
202 | bool isreturnquestion =false;
203 | for(int i=0; isize; i++)
204 | {
205 | if(User_data->v[i]->username == findname)
206 | {
207 | indexofv = i; //存下此时的i
208 | isreturnquestion = true;
209 | tcpSocket[index]->write(QString("##question##%1").arg(User_data->v[i]->question).toUtf8()); //发送问题
210 | qDebug() << "##question##%1";
211 | }
212 |
213 | }
214 | if(!isreturnquestion) //问题返回
215 | {
216 | tcpSocket[index]->write("user don't exist"); //不存在用户
217 | mode[index] = Chat;
218 | }
219 | }
220 | else if("answer" == QString(buf).section("##",0,0))//传输回来的问题答案
221 | {
222 | QString answer = QString(buf).section("##",1,1);
223 | if(User_data->v[indexofv]->answer == answer) //##answer is right##dingding##123
224 | {
225 | ui->textBrowser->append(QString("%1上线了").arg(User_data->v[indexofv]->username));
226 | User_data->v[indexofv]->state = 1; //在线
227 | User_data->v[indexofv]->ip = ip;
228 | User_data->v[indexofv]->port = qrand()%10000+10000; //存储 客户端服务器port信息 的地方,由自己定
229 | tcpSocket[index]->write(QString("##answer is right##%1##%2").
230 | arg(User_data->v[indexofv]->username).arg(User_data->v[indexofv]->password).toUtf8());
231 |
232 | qDebug() << "##answer is right##%1##%2";
233 | }
234 | else
235 | {
236 | tcpSocket[index]->write("the answer is wrong");
237 | mode[index] = Chat;
238 | }
239 |
240 | }
241 | else if("##login succeed, request for user_imformation" == QString(buf))
242 | {
243 | userstateupdate();
244 | ui->bt_save->setEnabled(true);
245 | }
246 | else if("Offline message" == QString(buf).section("##",0,0))
247 | {
248 | qDebug() << "开始传递离线消息";
249 | handlemessage(QString(buf).section("##",1,1),tcpSocket[index]);
250 | mode[index] = Chat;
251 | }
252 | else
253 | {
254 | ui->textBrowser->append(QString("登录失败"));
255 | tcpSocket[index]->disconnectFromHost(); //服务器断开连接
256 | mode[index] = Chat; //登录失败
257 |
258 | }
259 | }
260 | else if(mode[index] == Chat)
261 | {
262 | if("##request for login" == QString(buf)) //登录类请求
263 | {
264 | qDebug() << "##request for login";
265 | tcpSocket[index]->write("##permission for login");
266 | qDebug() << "##permission for login";
267 | mode[index] = Acceptlogin;
268 | }
269 | else //离线消息队列
270 | {
271 | qDebug() << "普通消息:" << QString(buf);
272 | QString recvname = QString(buf).section("##",2,2);
273 | for(int i=0; isize; i++)
274 | {
275 | qDebug() << i << " " << User_data->size << " " << User_data->v[i]->username;
276 | if(recvname == User_data->v[i]->username)
277 | {
278 | if(User_data->v[i]->state == 1) //在线
279 | {
280 | for(int j=0; jpeerAddress().toString().section(":",3,3)
283 | if(tcpSocket[j]->peerAddress().toString().section(":",3,3) == User_data->v[i]->ip) //找到相等的ip说明发给这个人
284 | {
285 | tcpSocket[j]->write(buf);
286 | break;
287 | }
288 | }
289 | }
290 | else //离线
291 | {
292 | messageQueue* m = Me;
293 | if(Me == NULL) //如果首队列为空
294 | {
295 | Me = new messageQueue(QString(buf), QString(buf).section("##",2,2));
296 | }
297 | else //添加最后一个为空的队列
298 | {
299 | while(m->next != NULL)
300 | {
301 | m = m->next;
302 | }
303 | m->next = new messageQueue(QString(buf), QString(buf).section("##",2,2));
304 | }
305 | }
306 | break;
307 | }
308 | }
309 | }
310 | }
311 | }); //函数完毕
312 | });
313 |
314 | }
315 |
316 | server::~server()
317 | {
318 | delete User_data;
319 | User_data =NULL;
320 | delete ui;
321 | }
322 |
323 | void server::userload()
324 | {
325 | QFile myfile("NP.txt");
326 | qDebug() << "读取数据";
327 | if(myfile.open(QIODevice::ReadOnly | QIODevice :: Text))
328 | {
329 | /*文本输出流,用于保存数据*/
330 | QByteArray a = QByteArray::fromBase64(myfile.readAll());
331 | QString b = QString(a);
332 | QTextStream in(&b);
333 | QString username = "";
334 | QString password = "";
335 | QString question = "";
336 | QString answer = "";
337 | User_data->size = 0;
338 | while( !in.atEnd()) //未到文件尾
339 | {
340 | in >> username;
341 | if(username != "")
342 | {
343 | qDebug() << username;
344 | in >> password;
345 | in >> question;
346 | in >> answer;
347 | User_data->v[User_data->size] = new user_imformation(username, password, question, answer);
348 | User_data->size++;
349 | }
350 | else
351 | {
352 | break;
353 | }
354 | }
355 | myfile.close();
356 |
357 | }
358 | else //用户密码文件打开失败
359 | {
360 | QMessageBox::warning(this, "Warning!", "用户密码文件打开失败", QMessageBox::Yes);
361 | close(); //退出
362 | }
363 | }
364 |
365 | void server::userstateupdate()
366 | {
367 | qDebug() << "状态更新,用户数:" << User_data->size;
368 | ui->le_usernum_off->clear();
369 | ui->le_usernum_on->clear();
370 | ui->tb_off->clear();
371 | ui->tb_on->clear();
372 | int num_on=0, num_off=0;
373 | QString updatemessage = QString("load users' states##%1##").arg(User_data->size);
374 | for(int i=0; isize; i++)
375 | {
376 | updatemessage = updatemessage.append(User_data->v[i]->toString());
377 | // ui->textBrowser->append(QString::number(User_data->v[i]->state) +" " + User_data->v[i]->username);
378 | if(User_data->v[i]->state == 1) //在线
379 | {
380 | ui->tb_on->append(User_data->v[i]->username);
381 | num_on ++;
382 | }
383 | else
384 | {
385 | ui->tb_off->append(User_data->v[i]->username);
386 | num_off ++;
387 | }
388 | }
389 | ui->le_usernum_on->setText(QString::number(num_on, 10));
390 | ui->le_usernum_off->setText(QString::number(num_off, 10));
391 | if(isfirst) //第一次加载不需要发送
392 | {
393 | isfirst = false;
394 | }
395 | else
396 | {
397 | for(int i=0; iisOpen())
400 | {
401 | qDebug() << "状态信息发送给的客户端下标:" << i;
402 | tcpSocket[i]->write(updatemessage.toUtf8()); //发送更新消息
403 | }
404 | else
405 | {
406 | break;
407 | }
408 | }
409 | }
410 |
411 | }
412 |
413 | void server::handlemessage(QString myname, QTcpSocket* socket) //用户发出离线消息请求
414 | {
415 | messageQueue *a=Me;
416 | QString sendmessage = "";
417 | int count = 0;
418 | while(a) //不为空
419 | {
420 | if(a->recvname == myname) //要发送给的对象一样选择发送
421 | {
422 | // socket->write(a->message.toUtf8()); //发送消息
423 | sendmessage.append(QString("&&%1").arg(a->message));
424 | count ++;
425 | a->issended = true; //已经被发送
426 | }
427 | a = a->next;
428 | }
429 | if(count != 0)
430 | {
431 | QString sendmessage2 = QString("offline message&&%1").arg(count).append(sendmessage);
432 | socket->write(sendmessage2.toUtf8());
433 | }
434 | // QMessageBox::information(this, "提示!", "离线消息发送完毕", QMessageBox::Yes);
435 | ui->textBrowser->append("离线消息发送完毕");
436 | //开始清理已经发送过的消息
437 | messageQueue* head = Me;
438 | while(head!=NULL && head->issended) //找到第一个未被发送的信息
439 | {
440 | messageQueue* pre = head;
441 | head = head->next;
442 | delete pre; //销毁空间
443 | pre = NULL;
444 | }
445 | if(head == NULL)
446 | {
447 | Me = NULL; //头结点为空
448 | }
449 | else
450 | {
451 | Me = head; //头结点重新定位
452 | messageQueue* p = Me; //定位未发送节点
453 | messageQueue* q = Me->next; //定位未发送节点的下一位
454 | while(q != NULL)
455 | {
456 | if(q->issended) //发送过了
457 | {
458 | while(q!= NULL && q->issended) //寻找下一个未发送的节点
459 | {
460 | messageQueue* later = q;
461 | q = q->next;
462 | delete later; //销毁空间
463 | later = NULL;
464 | }
465 | if(q == NULL) //全部发送了
466 | {
467 | //不做啥
468 | }
469 | else
470 | {
471 | p = q; //q此时未发送
472 | q = p->next;
473 | }
474 | } //q未发送
475 | else
476 | {
477 | p = q;
478 | q = p->next;
479 | }
480 | }
481 | }
482 |
483 | }
484 |
485 | void server::on_bt_save_clicked()
486 | {
487 | //文件保存
488 | QFile myfile("NP.txt");
489 | if(myfile.open(QIODevice::WriteOnly)) //以文本文式写入
490 | {
491 | QByteArray in;
492 | for(int i=0; isize; i++)
493 | {
494 | in.append(User_data->v[i]->username.toUtf8());
495 | in.append(QString(" ").toUtf8());
496 | in.append(User_data->v[i]->password.toUtf8());
497 | in.append(QString(" ").toUtf8());
498 | in.append(User_data->v[i]->question.toUtf8());
499 | in.append(QString(" ").toUtf8());
500 | in.append(User_data->v[i]->answer.toUtf8());
501 | in.append(QString(" ").toUtf8());
502 | }
503 | myfile.write(in.toBase64());
504 | myfile.close();
505 | }
506 | else
507 | {
508 | QMessageBox::warning(this, "Warning!", "用户密码文件打开失败", QMessageBox::Yes);
509 | close(); //退出
510 | }
511 | }
512 |
513 |
--------------------------------------------------------------------------------
/Client/clientwidget - 副本 (2).cpp:
--------------------------------------------------------------------------------
1 | #include "clientwidget.h"
2 | #include "ui_clientwidget.h"
3 | #include "logindialog.h"
4 | #include "findpassword.h"
5 | #include "user_imformation.h"
6 | #include "chat.h"
7 |
8 | #include
9 | #include
10 | #include
11 | #include
12 | #include
13 |
14 |
15 |
16 | bool isfind =false; //设置是否找回密码的标志
17 | bool isquestionreturned; // 问题是否返回
18 |
19 | QString loginmessage = ""; //这是要发送给服务器的信息,确定是登录还是注册还是找回。
20 | QString myquestion, myanswer; //服务器交流的内容
21 |
22 |
23 | const int M=20;//先假定最多用户数
24 | user_imformation *v[M];
25 | int mysize; //当前用户数
26 |
27 | int mode; //设置消息处理的类型
28 | enum { Login=0, Send, Recv, Chatting, Client};
29 | bool isoffline; //指示上线时是否需要接收离线消息
30 | bool istititleseted; //指示窗口名称不需要设置
31 |
32 |
33 |
34 | //被下面界面引用的变量
35 | QString connected_ip; //尝试连接本机的ip
36 | quint16 Port_number; //这个服务器的小型客户端监听端口!
37 | QString name; //本机用户名
38 | QString try_connect_ip;
39 | quint16 try_connect_port;
40 | bool isAttempToConnect; //指示此时是尝试发起私聊连接还是被连接的
41 |
42 |
43 |
44 | ClientWidget::ClientWidget(QWidget *parent) :
45 | QWidget(parent),
46 | ui(new Ui::clientwidget)
47 | {
48 | ui->setupUi(this);
49 |
50 | //初始化一些变量
51 | for (int i=0; iframe_client_off->setEnabled(false);
78 | ui->frame_client_on->setEnabled(false);
79 | ui->buttonClose->setEnabled(false); //一开始不能断开吧
80 | ui->frame_message->setEnabled(false);
81 | ui->lineEditIp->setText("222.20.104.4");
82 | ui->lineEditPort->setText("8888"); //默认端口
83 |
84 | tcpSocket = new QTcpSocket(this); //与服务器交流
85 | //绑定监听
86 |
87 |
88 | connect(tcpSocket, &QTcpSocket::connected,
89 | [=]()
90 | {
91 | isoffline = false; //连接服务器需要离线数据
92 | ui->le_state->setText("已经连接!");
93 | ui->frame_client_off->setEnabled(true);
94 | ui->frame_client_on->setEnabled(true);
95 | ui->frame_message->setEnabled(true); //可以发送消息
96 | ui->frame_ip->setEnabled(false); //ip不能由用户修改
97 | ui->buttonClose->setEnabled(true); //可以断开啊
98 | ui->bt_connect_client->setEnabled(true); //一开始允许连接
99 | mode = Chatting;
100 | });
101 |
102 | connect(tcpSocket, &QTcpSocket::disconnected,
103 | [=]()
104 | {
105 | setWindowTitle(QString("客户端端口:%1").arg(Port_number)); //窗口名称复原
106 | istititleseted = false; //需要设置窗口
107 | ui->le_state->setText("未连接!");
108 | ui->le_username->clear();
109 | ui->frame_client_off->setEnabled(false);
110 | ui->frame_client_on->setEnabled(false);
111 | ui->frame_message->setEnabled(false);
112 | ui->frame_ip->setEnabled(true); //ip能再由用户修改
113 | ui->buttonClose->setEnabled(false); //不能断开吧
114 | //用户列表清除
115 | ui->le_usernum_off->setText("0");
116 | ui->le_usernum_on->setText("0");
117 | ui->cb_client_off->clear();//清除用户列表
118 | ui->cb_client_off->addItem(QString("无"));
119 | ui->cb_client_on->clear();//清除用户列表
120 | ui->cb_client_on->addItem(QString("无"));
121 | ui->lineEditIp->setText("222.20.104.4");
122 | ui->lineEditPort->setText("8888"); //默认端口
123 | loginmessage.clear(); //清空本用户信息
124 | });
125 | connect(tcpSocket,&QTcpSocket::readyRead,
126 | [=]()
127 | {
128 | QByteArray buf = tcpSocket->readAll(); //接收消息种类
129 | if (mode == Login) //登录
130 | {
131 | if(!isfind) //不是找回密码
132 | {
133 | if("login successed" == QString(buf).section("##",1,1) ) //登录注册成功 "##login successed##dingding"
134 | {
135 | name = QString(buf).section("##",2,2);
136 | QMessageBox::information(NULL,"恭喜",QString("%1,登录成功").arg(name));
137 | tcpSocket->write("##login succeed, request for user_imformation");
138 |
139 | mode = Chatting;
140 | ui->frame_message->setEnabled(true); //用户能发送消息
141 | ui->le_username->setText(name);//设置用户名
142 | }
143 | else if ("register successed" == QString(buf).section("##",1,1)) //"##register successed##dingding"
144 | {
145 | name = QString(buf).section("##",2,2);
146 | QMessageBox::information(NULL,"恭喜",QString("%1,注册并登录成功").arg(name)); //用户名放最后
147 | tcpSocket->write("##login succeed, request for user_imformation");
148 |
149 | mode = Chatting;
150 | ui->frame_message->setEnabled(true); //用户能发送消息
151 | ui->le_username->setText(name);//设置用户名
152 | }
153 | else
154 | {
155 | QMessageBox::information(NULL,"Warning","登录或者注册失败!");
156 | on_buttonClose_clicked(); //断开连接!
157 | }
158 | }
159 | else if("question" ==QString(buf).section("##",1,1))//问题未发送
160 | {
161 | myquestion = QString(buf).section("##",2,2);
162 | findpassword* dlgf = new findpassword();
163 | dlgf->exec();
164 | tcpSocket->write(myanswer.toUtf8()); //发送给服务器答案
165 | isquestionreturned = true; //问题已经收到
166 | }
167 | else if("answer is right" == QString(buf).section("##",1,1))//"##answer is right##123##dingding"
168 | {
169 | name = QString(buf).section("##",3,3);
170 | QMessageBox::information(NULL,"密码找回",QString("%1,您的密码是:%2,已经自动登录").arg(name).arg(QString(buf).section("##",2,2))); //分割的第二部分
171 | tcpSocket->write("##login succeed, request for user_imformation");
172 | mode = Chatting;
173 | ui->frame_message->setEnabled(true); //用户能发送消息
174 | ui->le_username->setText(name);//设置用户名
175 | }
176 | else //收到其他答案
177 | {
178 | QMessageBox::information(NULL,"Warning",QString(buf));
179 | tcpSocket->write("##something wrong!");
180 | on_buttonClose_clicked(); //断开连接
181 | mode = Chatting;
182 | }
183 |
184 | }
185 | else if(mode == Client) //请求连接模式
186 | {
187 | if("fine, contact" == QString(buf).section("##",1,1)) //收到连接指令 ding##fine, contact##yaya 丁丁允许亚亚连接
188 | {
189 | if(name == QString(buf).section("##",2,2)) //与本机name一样
190 | {
191 | QString connect_name = QString(buf).section("##",0,0);
192 | QString myip = "";
193 | qint16 myport = 0;
194 | for(int i=0; iusername == connect_name) //找到对方的监听端口,对方的ip和port
197 | {
198 | myip = v[i]->ip;
199 | myport = v[i]->port;
200 | }
201 | }
202 | if(myip != "" && myport != 0)
203 | {
204 | try_connect_ip = myip;
205 | try_connect_port = myport;
206 | isAttempToConnect = true;
207 | Chat* dlgc = new Chat();
208 | dlgc->show();
209 | }
210 |
211 | }
212 | else //与本机连接不一样
213 | {
214 | QMessageBox::information(NULL,"Warning","收到连接对象非本机的点对点连接");
215 | }
216 | }
217 | mode = Chatting;
218 | ui->frame_message->setEnabled(true); //用户能发送消息
219 | }
220 | else if("request for contact" == QString(buf).section("##",1,1)) //服务器说要其他用户请求直接连接 dingding##request for contact##yaya
221 | {
222 | if(name != QString(buf).section("##",2,2))
223 | {
224 | QMessageBox::information(NULL,"信息发送错了",QString("来自%1的信息错误").arg(QString(buf).section("##",0,0)));
225 | }
226 | else
227 | {
228 | QString connected_name = QString(buf).section("##",0,0);
229 | for(int i=0; iusername == connected_name) //找到对方的ip,方便监听
232 | {
233 | connected_ip = v[i]->ip;
234 | }
235 | }
236 | ui->cb_client_on->setCurrentText(QString(buf).section("##",0,0));
237 | tcpSocket->write(QString("%1##fine, contact##%2").arg(name).arg(QString(buf).section("##",0,0)).toUtf8());
238 | isAttempToConnect = false; //被连接的对象
239 | qDebug() << Port_number;
240 | Chat* dlgc = new Chat();
241 | dlgc->show();
242 | }
243 | }
244 | else if("load users' states" == QString(buf).section("##",0,0))//用户状态变更 load users' states##10##....
245 | {
246 | for (int i=0; icb_client_off->currentText();
252 | QString b = ui->cb_client_on->currentText();
253 | ui->cb_client_off->clear();//清除用户列表
254 | ui->cb_client_off->addItem(QString("无"));
255 | ui->cb_client_on->clear();//清除用户列表
256 | ui->cb_client_on->addItem(QString("无"));
257 | ui->lineEditIp->clear();
258 | ui->lineEditPort->clear();
259 | //获取用户状态信息
260 | mysize = QString(buf).section("##",1,1).toInt(); // 10##.. 首先获取数组大小
261 | if(mysize > 0)
262 | {
263 | QString imformation = (QString(buf).section("##",2,2)); //用户信息
264 | QTextStream userinformation(&imformation);//读取用户信息
265 | int num_on = 0, num_off = 0;
266 | for(int i=0; i> myname ;
272 | userinformation >> ison;
273 | userinformation >> myip;
274 | userinformation >> myport;
275 | user_imformation *u = new user_imformation(myname,ison,myip,myport);
276 | v[i] = u;
277 | //加载用户列表信息
278 | if(!istititleseted && myname==name)
279 | {
280 | setWindowTitle(QString("ip:%1 客户服务端端口:%2").arg(myip).arg(myport));
281 | Port_number = myport;
282 | istititleseted = true; //已经创建
283 | }
284 | if(ison==1)//在线用户
285 | {
286 | ui->cb_client_on->addItem(myname);
287 | num_on ++;
288 | }
289 | else //离线
290 | {
291 | ui->cb_client_off->addItem(myname);
292 | num_off ++;
293 | }
294 | }
295 | ui->le_usernum_on->setText(QString("%1").arg(num_on));
296 | ui->le_usernum_off->setText(QString("%1").arg(num_off));
297 | ui->cb_client_off->setCurrentText(a);
298 | ui->cb_client_on->setCurrentText(b);
299 | }
300 | else
301 | {
302 | ui->le_usernum_on->setText(QString("0"));
303 | ui->le_usernum_off->setText(QString("0"));
304 | }
305 |
306 | if(!isoffline)//未加载离线信息
307 | {
308 | isoffline = true; //只需要连接服务器一次的时候请求
309 | tcpSocket->write(QString("Offline message##%1").arg(name).toUtf8()); //请求离线信息
310 | qDebug() << "Offline message##%1";
311 |
312 | }
313 | else
314 | {
315 | //do othing
316 | }
317 | }
318 | else if("offline message" == QString(buf).section("&&",0,0)) //离线消息处理
319 | {
320 | int count = QString(buf).section("&&",1,1).toInt();
321 |
322 | for(int indexofm=2; indexofmtextBrowser->append(sendername.append(QString(" to ")).
329 | append(recvname).append(QString(": ")).append(message)); //消息显示格式!
330 | }
331 | }
332 | else if("##permission for login" == QString(buf)) //接收到允许登录
333 | {
334 | timer->stop();
335 | LoginDialog *dlg = new LoginDialog(); //登录界面
336 | dlg->exec();
337 | isquestionreturned = false; //问题未传回
338 | qDebug() << "发送登录消息";
339 | ui->frame_message->setEnabled(false); //用户不能发送消息
340 | if(loginmessage != "")
341 | {
342 | tcpSocket->write(loginmessage.toUtf8());//发送登录信息
343 | ui->frame_message->setEnabled(false); //用户不能发送消息
344 | mode = Login; //登录
345 | }
346 | else
347 | {
348 | tcpSocket->write("login failed"); //断开连接
349 | }
350 | }
351 | else //处理普通消息 dingding##hello##yaya
352 | {
353 | QString sendername = QString(buf).section("##",0,0);
354 | QString message = QString(buf).section("##",1,1);
355 | QString recvname = QString(buf).section("##",2,2);
356 | ui->textBrowser->append("--------------" + QTime::currentTime().toString("hh:mm:ss") + "--------------");
357 | ui->textBrowser->append(QString("%1 to %2 : %3").arg(sendername).arg(recvname).
358 | arg(message)); //显示对方的信息消息显示格式!
359 | }
360 |
361 | });
362 | }
363 | ClientWidget::~ClientWidget()
364 | {
365 | for(int i=0; iclose();
374 | delete ui;
375 | }
376 |
377 | void ClientWidget::on_buttonConnect_clicked() //打开服务器
378 | {
379 | QString ip = ui->lineEditIp->text();
380 | qint16 port = ui->lineEditPort->text().toInt();
381 | tcpSocket->connectToHost(QHostAddress(ip),port);
382 | tcpSocket->write("##request for login");//发送请求
383 | timer->start(100); //0.1秒
384 | qDebug() << "##request for login";
385 | }
386 |
387 | void ClientWidget::connect_failure()
388 | {
389 | QMessageBox::information(this,"错误","未连接服务器或者服务器未打开", QMessageBox::Yes);
390 | timer->stop();
391 | }
392 |
393 | void ClientWidget::on_buttonClose_clicked()
394 | {
395 | for (int i=0; iisOpen())
402 | tcpSocket->disconnectFromHost();
403 | }
404 |
405 |
406 | void ClientWidget::on_cb_client_off_currentIndexChanged(int index)
407 | {
408 | if(index != 0) //不是无
409 | {
410 | ui->frame_client_on->setEnabled(false); //在线客户区不能选择
411 | ui->cb_client_on->setCurrentIndex(0); //回到0
412 | }
413 | else
414 | {
415 | ui->frame_client_on->setEnabled(true);
416 | }
417 | }
418 |
419 | void ClientWidget::on_cb_client_on_currentIndexChanged(int index)
420 | {
421 | if(index != 0)//不是无
422 | {
423 | if(ui->cb_client_on->currentText() == ui->le_username->text())
424 | {
425 | ui->cb_client_on->setCurrentIndex(0);
426 | }
427 | else
428 | {
429 | ui->frame_client_off->setEnabled(false); //离线客户不能选择
430 | ui->cb_client_off->setCurrentIndex(0); //回到0
431 | for(int i=0; iusername == ui->cb_client_on->currentText())
434 | {
435 | ui->lineEditIp->setText(v[i]->ip);
436 | ui->lineEditPort->setText(QString("%1").arg(v[i]->port)); //获得他的服务器端的port
437 | }
438 | }
439 | }
440 |
441 | }
442 | else
443 | {
444 | ui->frame_client_off->setEnabled(true); //如果index==0 离线客户区可以编辑
445 | }
446 | }
447 |
448 | void ClientWidget::on_bt_connect_client_clicked() //连接客户
449 | {
450 | if(ui->cb_client_on->currentIndex() != 0)
451 | {
452 | for(int i=0; iusername == ui->cb_client_on->currentText()) //找到对方的监听端口,对方的ip和port
455 | {
456 | if(v[i]->hasbeenConnected)
457 | {
458 | QMessageBox::information(this,"提示", "已经连接上了!");
459 | return; //直接退出
460 | }
461 | }
462 | }
463 | QString contact = QString("%1##request for contact##%2").arg(name).arg(ui->cb_client_on->currentText()); //用户名发送过去
464 | tcpSocket->write(contact.toUtf8());
465 | mode = Client;
466 | }
467 | }
468 |
469 | void ClientWidget::on_bt_message_send_clicked()
470 | {
471 | if(ui->le_message->text().trimmed() != "") //消息框不能为空字符
472 | {
473 | QString sendername = name;
474 | QString recvname = "";
475 | if(ui->cb_client_off->currentIndex() != 0)
476 | {
477 | recvname = ui->cb_client_off->currentText();
478 | }
479 | else if (ui->cb_client_on->currentIndex() != 0)
480 | {
481 | recvname = ui->cb_client_on->currentText();
482 | }
483 | else //都是无
484 | {
485 | ui->textBrowser->append("请选择有效发送对象!");
486 | return;
487 | }
488 | QString sendmessage = sendername.append(QString("##%1##").arg(ui->le_message->text()).append(recvname));
489 | tcpSocket->write(sendmessage.toUtf8()); //发送信息
490 | qDebug() << "server send message!";
491 | QString mymessage = QString("%1 to %2 : %3").arg(name).arg(recvname).
492 | arg(ui->le_message->text()); //显示我的信息
493 | ui->textBrowser->append("--------------" + QTime::currentTime().toString("hh:mm:ss") + "--------------");
494 | ui->textBrowser->append(mymessage);
495 | ui->le_message->clear(); //发送完清空le
496 | }
497 | }
498 |
--------------------------------------------------------------------------------