mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
Merge branch 'pr871'
This commit is contained in:
commit
3fe91d3563
|
@ -74,6 +74,15 @@ void Widget::init()
|
|||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
idleTimer = new QTimer();
|
||||
idleTimer->setSingleShot(true);
|
||||
setIdleTimer(Settings::getInstance().getAutoAwayTime());
|
||||
|
||||
//restore window state
|
||||
restoreGeometry(Settings::getInstance().getWindowGeometry());
|
||||
restoreState(Settings::getInstance().getWindowState());
|
||||
ui->mainSplitter->restoreState(Settings::getInstance().getSplitterState());
|
||||
|
||||
if (QSystemTrayIcon::isSystemTrayAvailable())
|
||||
{
|
||||
icon = new QSystemTrayIcon(this);
|
||||
|
@ -123,15 +132,6 @@ void Widget::init()
|
|||
ui->statusbar->hide();
|
||||
ui->menubar->hide();
|
||||
|
||||
idleTimer = new QTimer();
|
||||
idleTimer->setSingleShot(true);
|
||||
setIdleTimer(Settings::getInstance().getAutoAwayTime());
|
||||
|
||||
//restore window state
|
||||
restoreGeometry(Settings::getInstance().getWindowGeometry());
|
||||
restoreState(Settings::getInstance().getWindowState());
|
||||
ui->mainSplitter->restoreState(Settings::getInstance().getSplitterState());
|
||||
|
||||
layout()->setContentsMargins(0, 0, 0, 0);
|
||||
ui->friendList->setStyleSheet(Style::resolve(Style::getStylesheet(":ui/friendList/friendList.css")));
|
||||
|
||||
|
@ -257,6 +257,7 @@ void Widget::init()
|
|||
connect(ui->settingsButton, SIGNAL(clicked()), this, SLOT(onSettingsClicked()));
|
||||
connect(ui->nameLabel, SIGNAL(textChanged(QString, QString)), this, SLOT(onUsernameChanged(QString, QString)));
|
||||
connect(ui->statusLabel, SIGNAL(textChanged(QString, QString)), this, SLOT(onStatusMessageChanged(QString, QString)));
|
||||
connect(ui->mainSplitter, &QSplitter::splitterMoved, this, &Widget::onSplitterMoved);
|
||||
connect(profilePicture, SIGNAL(clicked()), this, SLOT(onAvatarClicked()));
|
||||
connect(setStatusOnline, SIGNAL(triggered()), this, SLOT(setStatusOnline()));
|
||||
connect(setStatusAway, SIGNAL(triggered()), this, SLOT(setStatusAway()));
|
||||
|
@ -336,9 +337,8 @@ void Widget::closeEvent(QCloseEvent *event)
|
|||
}
|
||||
else
|
||||
{
|
||||
Settings::getInstance().setWindowGeometry(saveGeometry());
|
||||
Settings::getInstance().setWindowState(saveState());
|
||||
Settings::getInstance().setSplitterState(ui->mainSplitter->saveState());
|
||||
saveWindowGeometry();
|
||||
saveSplitterGeometry();
|
||||
QWidget::closeEvent(event);
|
||||
}
|
||||
}
|
||||
|
@ -354,6 +354,12 @@ void Widget::changeEvent(QEvent *event)
|
|||
}
|
||||
}
|
||||
|
||||
void Widget::resizeEvent(QResizeEvent *event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
saveWindowGeometry();
|
||||
}
|
||||
|
||||
QString Widget::detectProfile()
|
||||
{
|
||||
QDir dir(Settings::getSettingsDirPath());
|
||||
|
@ -1157,6 +1163,23 @@ void Widget::onSetShowSystemTray(bool newValue){
|
|||
icon->setVisible(newValue);
|
||||
}
|
||||
|
||||
void Widget::saveWindowGeometry()
|
||||
{
|
||||
Settings::getInstance().setWindowGeometry(saveGeometry());
|
||||
Settings::getInstance().setWindowState(saveState());
|
||||
}
|
||||
|
||||
void Widget::saveSplitterGeometry()
|
||||
{
|
||||
Settings::getInstance().setSplitterState(ui->mainSplitter->saveState());
|
||||
}
|
||||
|
||||
void Widget::onSplitterMoved(int pos, int index)
|
||||
{
|
||||
Q_UNUSED(pos);
|
||||
Q_UNUSED(index);
|
||||
saveSplitterGeometry();
|
||||
}
|
||||
|
||||
QMessageBox::StandardButton Widget::showWarningMsgBox(const QString& title, const QString& msg, QMessageBox::StandardButtons buttons)
|
||||
{
|
||||
|
|
|
@ -72,6 +72,7 @@ public:
|
|||
|
||||
virtual void closeEvent(QCloseEvent *event);
|
||||
virtual void changeEvent(QEvent *event);
|
||||
virtual void resizeEvent(QResizeEvent *event);
|
||||
|
||||
void clearAllReceipts();
|
||||
|
||||
|
@ -132,6 +133,7 @@ private slots:
|
|||
void onUserAway();
|
||||
void getPassword(QString info, int passtype, uint8_t* salt);
|
||||
void onSetShowSystemTray(bool newValue);
|
||||
void onSplitterMoved(int pos, int index);
|
||||
|
||||
private:
|
||||
void init();
|
||||
|
@ -140,6 +142,8 @@ private:
|
|||
Group* createGroup(int groupId);
|
||||
void removeFriend(Friend* f, bool fake = false);
|
||||
void removeGroup(Group* g, bool fake = false);
|
||||
void saveWindowGeometry();
|
||||
void saveSplitterGeometry();
|
||||
QString askProfiles();
|
||||
QString detectProfile();
|
||||
QSystemTrayIcon *icon;
|
||||
|
|
Loading…
Reference in New Issue
Block a user