Permalink
Browse files

登录面板回车登录,去掉无功能的按钮

  • Loading branch information...
zhanlangsir committed Aug 4, 2012
1 parent 2bb4d75 commit f71ba44307bbb264c862ad029ab99f71ca431613
View
@@ -17,20 +17,27 @@ add_custom_target(uninstall
include(CheckIncludeFiles)
include(FindPkgConfig)
set(app Qtqq)
set(prefix ${CMAKE_INSTALL_PREFIX})
set(appPath ${prefix})
set(binPath ${prefix}/bin)
set(libPath ${Prefix}/lib)
set(includePath ${CMAKE_INSTALL_PREFIX}/include)
if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release")
endif()
if ( CMAKE_BUILD_TYPE MATCHES "Debug" )
set(prefix ${PROJECT_SOURCE_DIR})
set(pkgdatadir ${prefix}/data)
else ()
set(prefix ${CMAKE_INSTALL_PREFIX})
set(pkgdatadir ${prefix}/share/${package})
endif ()
set(package Qtqq)
set(bindir ${prefix}/bin)
set(libdir ${prefix}/lib)
set(includedir ${prefix}/include)
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/bin)
set(LIBRARY_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/lib)
configure_file(
${PROJECT_SOURCE_DIR}/config.h.in
${PROJECT_BINARY_DIR}/config.h
)
configure_file(${PROJECT_SOURCE_DIR}/config.h.in ${PROJECT_BINARY_DIR}/config.h)
include_directories(${PROJECT_BINARY_DIR})
@@ -39,10 +46,6 @@ set(LOG4QT_INCLUDE_DIR ${THIRD_PARTY_DIR}/log4qt/src)
set(QXGS_INCLUDE_DIR ${THIRD_PARTY_DIR}/qxtglobalshortcut)
set(TRANSLATIONS_DIR ${CMAKE_CURRENT_SOURCE_DIR}/data/translations)
if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release")
endif()
add_subdirectory(cmake)
add_subdirectory(3rdparty)
add_subdirectory(data)
View
@@ -132,6 +132,7 @@ set(UI_SOURCES
loginwin.cpp
groupitemmodel.cpp
qqiteminfohelper.cpp
qqglobal.cpp
)
set(UI_FILES
@@ -190,7 +191,6 @@ if (UPDATE_TRANSLATIONS)
else (UPDATE_TRANSLATIONS)
QT4_ADD_TRANSLATION(QM_FILES ${TRANSLATIONS_FILES})
endif (UPDATE_TRANSLATIONS)
core/singleton.h
add_executable(qtqq
${CORE_SOURCES} ${CORE_HEADERS_MOC}
@@ -209,5 +209,4 @@ target_link_libraries(qtqq
)
install(TARGETS qtqq DESTINATION ${prefix}/bin)
install(FILES ${QM_FILES} DESTINATION ${pkgdatadir}/translations)
@@ -54,7 +54,7 @@ QString QQAvatarRequester::requestOne(int type, QString id, QString save_path)
int format_end_idx = result.indexOf("\r\n", format_idx);
QString format = result.mid(format_idx, format_end_idx - format_idx);
QString save_full_path = save_path + id + "." + format;
QString save_full_path = save_path + '/' + id + "." + format;
QFile file(save_full_path);
file.open(QIODevice::WriteOnly);
View
@@ -41,17 +41,17 @@ class QQSettings : public QSettings
QString currSkinPath() const
{ return PKG_DATA_DIR"/skins/" + value("skin", "default").toString(); }
static QString resourcePath() const
{ return Singleton<QQGlobal>::instance()->resourcePath(); }
QString resourcePath() const
{ return QQGlobal::resourcePath(); }
QString QQSettings::configDir() const
static QString configDir()
{
return Singleton<QQGlobal>::instance()->resourcePath();
return QQGlobal::configPath();
}
QString QQSettings::tempPath() const
static QString tempPath()
{
return Singleton<QQGlobal>::instance()->tempPath();
return QQGlobal::tempPath();
}
void setCurrLoginInfo(QString id, QString name, FriendStatus status, QString avatar_path)
@@ -79,8 +79,6 @@ class QQSettings : public QSettings
QString loginName()
{ return curr_login_.name; }
static QString userConfigDir() ;
static QString configDir() ;
private:
static QPointer<QQSettings> settings_;
View
@@ -5,6 +5,7 @@
#include <QVector>
#include <QApplication>
#include <QFile>
#include <QDebug>
#include "qqskinable.h"
#include "qqsetting.h"
View
@@ -31,7 +31,7 @@ LoginWin::LoginWin(QWidget *parent) :
setObjectName("loginWindow");
setWindowIcon(QIcon(QQSkinEngine::instance()->getSkinRes("app_icon")));
connect(ui->pb_login, SIGNAL(clicked()), this, SLOT(onLoginBtnClicked()));
connect(ui->pb_login, SIGNAL(clicked()), this, SLOT(beginLogin()));
connect(login_core_, SIGNAL(sig_loginDone(QQLoginCore::LoginResult)),
this, SLOT(loginDone(QQLoginCore::LoginResult)));
connect(ui->comb_username_, SIGNAL(currentIndexChanged(QString)), this, SLOT(currentUserChanged(QString)));
@@ -40,7 +40,8 @@ LoginWin::LoginWin(QWidget *parent) :
move((QApplication::desktop()->width() - this->width()) /2, (QApplication::desktop()->height() - this->height()) /2);
//过滤回车键,因为每次在QComboBox中按回车会自动添加一个补全信息
ui->comb_username_->installEventFilter(this);
ui->comb_username_->installEventFilter(this);
ui->le_password_->installEventFilter(this);
setupStatus();
setupAccountRecords();
@@ -99,7 +100,7 @@ int LoginWin::getStatusIndex(FriendStatus status) const
return -1;
}
void LoginWin::onLoginBtnClicked()
void LoginWin::beginLogin()
{
if (ui->comb_username_->currentText().isEmpty() || ui->le_password_->text().isEmpty())
{
@@ -236,13 +237,14 @@ void LoginWin::checkAccoutStatus()
bool LoginWin::eventFilter(QObject *obj, QEvent *e)
{
if (obj == ui->comb_username_)
if (obj == ui->comb_username_ || obj == ui->le_password_)
{
if (e->type() == QEvent::KeyPress)
{
QKeyEvent *key_event = static_cast<QKeyEvent*>(e);
if (key_event->key() == Qt::Key_Enter || key_event->key() == Qt::Key_Return)
{
beginLogin();
return true;
}
}
View
@@ -38,7 +38,7 @@ class LoginWin : public QWidget
}
private slots:
void onLoginBtnClicked();
void beginLogin();
void loginDone(QQLoginCore::LoginResult result);
void onAutoLoginBtnClicked(bool checked);
void currentUserChanged(QString text);
View
@@ -8,7 +8,7 @@
#include "log4qt/logmanager.h"
#include "qtqq.h"
#include "config.h"
#include "qqglobal.h"
int main(int argc, char *argv[])
{
@@ -24,12 +24,12 @@ int main(int argc, char *argv[])
a.setQuitOnLastWindowClosed(false);
QTranslator translator;
QString transla_file_path = PKG_DATA_DIR"/translations";
QString transla_file_path = QQGlobal::dataPath() + "/translations";
translator.load(QLocale::system().name(), transla_file_path);
a.installTranslator(&translator);
Log4Qt::LogManager::setHandleQtMessages(true);
Log4Qt::PropertyConfigurator::configure(PKG_DATA_DIR"/log4qt.conf");
Log4Qt::PropertyConfigurator::configure(QQGlobal::dataPath() + "/misc/log4qt.conf");
Qtqq qtqq;
qtqq.start();
View
@@ -38,6 +38,7 @@
#include "core/msgencoder.h"
#include "core/friendmsgencoder.h"
#include "core/groupmsgencoder.h"
#include "qqglobal.h"
MainWindow::MainWindow(QWidget *parent) :
QWidget(parent),
@@ -314,7 +315,7 @@ void MainWindow::getOnlineBuddyDone(bool err)
void MainWindow::getPersonalFace()
{
QString avatar_path = QQAvatarRequester::requestOne(QQAvatarRequester::getTypeNumber(QQItem::kFriend), QQSettings::instance()->currLoginInfo().id, "temp/avatar/");
QString avatar_path = QQAvatarRequester::requestOne(QQAvatarRequester::getTypeNumber(QQItem::kFriend), QQSettings::instance()->currLoginInfo().id, QQGlobal::tempPath());
QQSettings::instance()->currLoginInfo().avatar_path = avatar_path;
QFile file(avatar_path);
View
@@ -0,0 +1,4 @@
#include "qqglobal.h"
const QString QQGlobal::app_name_ = PACKAGE;
const QString QQGlobal::data_path_ = PKG_DATA_DIR;
View
@@ -6,17 +6,16 @@
#include <QString>
#include "config.h"
#include "core/singleton.h"
class QQGlobal : public Singleton<QQGlobal>
class QQGlobal
{
public:
static QString appName() const
static QString appName()
{
return app_name_;
}
static QString configPath() const
static QString configPath()
{
QString config_path = QDir::homePath() + "/." + appName();
@@ -27,15 +26,21 @@ class QQGlobal : public Singleton<QQGlobal>
return config_path;
}
static QString resourcePath() const
static QString resourcePath()
{ return dataPath() + "/resources"; }
static QString tempPath() const
static QString tempPath()
{
return QDir::tempPath();
QString temp_path = QDir::tempPath() + '/' + appName();
QDir temp_dir(temp_path);
if ( !temp_dir.exists() )
temp_dir.mkdir(temp_path);
return temp_path;
}
static QString dataPath() const
static QString dataPath()
{
return data_path_;
}
@@ -50,7 +55,5 @@ class QQGlobal : public Singleton<QQGlobal>
static const QString data_path_;
};
const QString QQGlobal::app_name_ = PACKAGE;
const QString QQGlobal::data_path_ = PKG_DATA_DIR;
#endif //QTQQ_CORE_QQGLOBAL_H
View
@@ -35,7 +35,7 @@ SystemTray::SystemTray(QObject *parent) :
check_cursor_pos_.setInterval(500);
connect(&check_cursor_pos_, SIGNAL(timeout()), this, SLOT(checkCursorPos()));
tray_icon_ = gtk_status_icon_new_from_file(Singleton<QQGlobal>::instance()->resourcePath() + "/WebQQ.ico");
tray_icon_ = gtk_status_icon_new_from_file(QString(QQGlobal::resourcePath() + "/WebQQ.ico").toLatin1());
g_signal_connect(G_OBJECT(tray_icon_), "activate",
G_CALLBACK(gtkTrayIconActived), NULL);
View
@@ -117,19 +117,6 @@
<property name="spacing">
<number>6</number>
</property>
<item>
<widget class="QToolButton" name="toolButton_4">
<property name="text">
<string/>
</property>
<property name="iconSize">
<size>
<width>18</width>
<height>18</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="btn_qqface">
<property name="styleSheet">
@@ -173,32 +160,6 @@
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="toolButton_8">
<property name="text">
<string/>
</property>
<property name="iconSize">
<size>
<width>18</width>
<height>18</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="toolButton_9">
<property name="text">
<string/>
</property>
<property name="iconSize">
<size>
<width>18</width>
<height>18</height>
</size>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
View
@@ -130,19 +130,6 @@
<property name="spacing">
<number>4</number>
</property>
<item>
<widget class="QToolButton" name="toolButton_4">
<property name="text">
<string/>
</property>
<property name="iconSize">
<size>
<width>18</width>
<height>18</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="btn_qqface">
<property name="text">
@@ -169,32 +156,6 @@
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="toolButton_8">
<property name="text">
<string/>
</property>
<property name="iconSize">
<size>
<width>18</width>
<height>18</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="toolButton_9">
<property name="text">
<string/>
</property>
<property name="iconSize">
<size>
<width>18</width>
<height>18</height>
</size>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
Oops, something went wrong.

0 comments on commit f71ba44

Please sign in to comment.