forked from blue/squawk
started to work on settings
This commit is contained in:
parent
62a59eb7a1
commit
6bee149e6b
10 changed files with 260 additions and 2 deletions
|
@ -22,3 +22,4 @@ target_sources(squawk PRIVATE
|
|||
|
||||
add_subdirectory(vcard)
|
||||
add_subdirectory(messageline)
|
||||
add_subdirectory(settings)
|
||||
|
|
7
ui/widgets/settings/CMakeLists.txt
Normal file
7
ui/widgets/settings/CMakeLists.txt
Normal file
|
@ -0,0 +1,7 @@
|
|||
target_sources(squawk PRIVATE
|
||||
settingslist.h
|
||||
settingslist.cpp
|
||||
settings.h
|
||||
settings.cpp
|
||||
settings.ui
|
||||
)
|
14
ui/widgets/settings/settings.cpp
Normal file
14
ui/widgets/settings/settings.cpp
Normal file
|
@ -0,0 +1,14 @@
|
|||
#include "settings.h"
|
||||
#include "ui_settings.h"
|
||||
|
||||
Settings::Settings(QWidget* parent):
|
||||
QWidget(parent),
|
||||
m_ui(new Ui::Settings())
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
}
|
||||
|
||||
Settings::~Settings()
|
||||
{
|
||||
}
|
||||
|
26
ui/widgets/settings/settings.h
Normal file
26
ui/widgets/settings/settings.h
Normal file
|
@ -0,0 +1,26 @@
|
|||
#ifndef SETTINGS_H
|
||||
#define SETTINGS_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <QScopedPointer>
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class Settings;
|
||||
}
|
||||
|
||||
/**
|
||||
* @todo write docs
|
||||
*/
|
||||
class Settings : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
Settings(QWidget* parent = nullptr);
|
||||
~Settings();
|
||||
|
||||
private:
|
||||
QScopedPointer<Ui::Settings> m_ui;
|
||||
};
|
||||
|
||||
#endif // SETTINGS_H
|
119
ui/widgets/settings/settings.ui
Normal file
119
ui/widgets/settings/settings.ui
Normal file
|
@ -0,0 +1,119 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>Settings</class>
|
||||
<widget class="QWidget" name="Settings">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>520</width>
|
||||
<height>363</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="SettingsList" name="listWidget">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="lineWidth">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="horizontalScrollBarPolicy">
|
||||
<enum>Qt::ScrollBarAlwaysOff</enum>
|
||||
</property>
|
||||
<property name="sizeAdjustPolicy">
|
||||
<enum>QAbstractScrollArea::AdjustToContents</enum>
|
||||
</property>
|
||||
<property name="editTriggers">
|
||||
<set>QAbstractItemView::NoEditTriggers</set>
|
||||
</property>
|
||||
<property name="showDropIndicator" stdset="0">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="dragDropMode">
|
||||
<enum>QAbstractItemView::NoDragDrop</enum>
|
||||
</property>
|
||||
<property name="verticalScrollMode">
|
||||
<enum>QAbstractItemView::ScrollPerPixel</enum>
|
||||
</property>
|
||||
<property name="movement">
|
||||
<enum>QListView::Static</enum>
|
||||
</property>
|
||||
<property name="flow">
|
||||
<enum>QListView::TopToBottom</enum>
|
||||
</property>
|
||||
<property name="isWrapping" stdset="0">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="resizeMode">
|
||||
<enum>QListView::Adjust</enum>
|
||||
</property>
|
||||
<property name="layoutMode">
|
||||
<enum>QListView::Batched</enum>
|
||||
</property>
|
||||
<property name="viewMode">
|
||||
<enum>QListView::IconMode</enum>
|
||||
</property>
|
||||
<property name="uniformItemSizes">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="itemAlignment">
|
||||
<set>Qt::AlignHCenter</set>
|
||||
</property>
|
||||
<property name="currentRow">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>General</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset theme="view-list-symbolic">
|
||||
<normaloff>.</normaloff>.</iconset>
|
||||
</property>
|
||||
<property name="flags">
|
||||
<set>ItemIsSelectable|ItemIsEnabled</set>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Appearance</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset theme="preferences-desktop-theme">
|
||||
<normaloff>.</normaloff>.</iconset>
|
||||
</property>
|
||||
<property name="flags">
|
||||
<set>ItemIsSelectable|ItemIsEnabled</set>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>SettingsList</class>
|
||||
<extends>QListWidget</extends>
|
||||
<header location="global">ui/widgets/settings/settingslist.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
27
ui/widgets/settings/settingslist.cpp
Normal file
27
ui/widgets/settings/settingslist.cpp
Normal file
|
@ -0,0 +1,27 @@
|
|||
#include "settingslist.h"
|
||||
|
||||
SettingsList::SettingsList(QWidget* parent):
|
||||
QListWidget(parent),
|
||||
lastWidth(0)
|
||||
{
|
||||
}
|
||||
|
||||
SettingsList::~SettingsList()
|
||||
{
|
||||
}
|
||||
|
||||
QStyleOptionViewItem SettingsList::viewOptions() const
|
||||
{
|
||||
QStyleOptionViewItem option = QListWidget::viewOptions();
|
||||
if (!iconSize().isValid()) {
|
||||
option.decorationSize.setWidth(lastWidth);
|
||||
}
|
||||
option.rect.setWidth(lastWidth);
|
||||
return option;
|
||||
}
|
||||
|
||||
void SettingsList::resizeEvent(QResizeEvent* event)
|
||||
{
|
||||
lastWidth = event->size().width();
|
||||
QListWidget::resizeEvent(event);
|
||||
}
|
25
ui/widgets/settings/settingslist.h
Normal file
25
ui/widgets/settings/settingslist.h
Normal file
|
@ -0,0 +1,25 @@
|
|||
#ifndef UI_SETTINGSLIST_H
|
||||
#define UI_SETTINGSLIST_H
|
||||
|
||||
#include <QListWidget>
|
||||
#include <QResizeEvent>
|
||||
|
||||
/**
|
||||
* @todo write docs
|
||||
*/
|
||||
class SettingsList : public QListWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
SettingsList(QWidget* parent = nullptr);
|
||||
~SettingsList();
|
||||
|
||||
protected:
|
||||
QStyleOptionViewItem viewOptions() const override;
|
||||
void resizeEvent(QResizeEvent * event) override;
|
||||
|
||||
private:
|
||||
int lastWidth;
|
||||
};
|
||||
|
||||
#endif // UI_SETTINGSLIST_H
|
Loading…
Add table
Add a link
Reference in a new issue